_cairo_array_init:
   59|  5.16k|{
   60|  5.16k|    array->size = 0;
   61|  5.16k|    array->num_elements = 0;
   62|  5.16k|    array->element_size = element_size;
   63|  5.16k|    array->elements = NULL;
   64|  5.16k|}
_cairo_array_fini:
   76|  5.09k|{
   77|  5.09k|    free (array->elements);
   78|  5.09k|}
_cairo_array_grow_by:
   90|  1.29M|{
   91|  1.29M|    char *new_elements;
   92|  1.29M|    unsigned int old_size = array->size;
   93|  1.29M|    unsigned int required_size = array->num_elements + additional;
   94|  1.29M|    unsigned int new_size;
   95|       |
   96|       |    /* check for integer overflow */
   97|  1.29M|    if (required_size > INT_MAX || required_size < array->num_elements)
  ------------------
  |  Branch (97:9): [True: 0, False: 1.29M]
  |  Branch (97:36): [True: 0, False: 1.29M]
  ------------------
   98|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
   99|       |
  100|  1.29M|    if (CAIRO_INJECT_FAULT ())
  ------------------
  |  |   47|  1.29M|#define CAIRO_INJECT_FAULT() 0
  |  |  ------------------
  |  |  |  Branch (47:30): [Folded - Ignored]
  |  |  ------------------
  ------------------
  101|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  102|       |
  103|  1.29M|    if (required_size <= old_size)
  ------------------
  |  Branch (103:9): [True: 1.27M, False: 26.8k]
  ------------------
  104|  1.27M|	return CAIRO_STATUS_SUCCESS;
  105|       |
  106|  26.8k|    if (old_size == 0)
  ------------------
  |  Branch (106:9): [True: 4.81k, False: 22.0k]
  ------------------
  107|  4.81k|	new_size = 1;
  108|  22.0k|    else
  109|  22.0k|	new_size = old_size * 2;
  110|       |
  111|  42.0k|    while (new_size < required_size)
  ------------------
  |  Branch (111:12): [True: 15.1k, False: 26.8k]
  ------------------
  112|  15.1k|	new_size = new_size * 2;
  113|       |
  114|  26.8k|    array->size = new_size;
  115|  26.8k|    new_elements = _cairo_realloc_ab (array->elements,
  116|  26.8k|			              array->size, array->element_size);
  117|       |
  118|  26.8k|    if (unlikely (new_elements == NULL)) {
  ------------------
  |  |  141|  26.8k|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 26.8k]
  |  |  ------------------
  ------------------
  119|      0|	array->size = old_size;
  120|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  121|      0|    }
  122|       |
  123|  26.8k|    array->elements = new_elements;
  124|       |
  125|  26.8k|    return CAIRO_STATUS_SUCCESS;
  126|  26.8k|}
_cairo_array_index:
  168|    207|{
  169|       |    /* We allow an index of 0 for the no-elements case.
  170|       |     * This makes for cleaner calling code which will often look like:
  171|       |     *
  172|       |     *    elements = _cairo_array_index (array, 0);
  173|       |     *	  for (i=0; i < num_elements; i++) {
  174|       |     *        ... use elements[i] here ...
  175|       |     *    }
  176|       |     *
  177|       |     * which in the num_elements==0 case gets the NULL pointer here,
  178|       |     * but never dereferences it.
  179|       |     */
  180|    207|    if (index == 0 && array->num_elements == 0)
  ------------------
  |  Branch (180:9): [True: 207, False: 0]
  |  Branch (180:23): [True: 69, False: 138]
  ------------------
  181|     69|	return NULL;
  182|       |
  183|    138|    assert (index < array->num_elements);
  184|       |
  185|    138|    return array->elements + (size_t)index * array->element_size;
  186|    138|}
_cairo_array_append:
  266|     69|{
  267|     69|    return _cairo_array_append_multiple (array, element, 1);
  268|     69|}
_cairo_array_append_multiple:
  286|  1.29M|{
  287|  1.29M|    cairo_status_t status;
  288|  1.29M|    void *dest;
  289|       |
  290|  1.29M|    status = _cairo_array_allocate (array, num_elements, &dest);
  291|  1.29M|    if (unlikely (status))
  ------------------
  |  |  141|  1.29M|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1.29M]
  |  |  ------------------
  ------------------
  292|      0|	return status;
  293|       |
  294|  1.29M|    memcpy (dest, elements, (size_t)num_elements * array->element_size);
  295|       |
  296|  1.29M|    return CAIRO_STATUS_SUCCESS;
  297|  1.29M|}
_cairo_array_allocate:
  316|  1.29M|{
  317|  1.29M|    cairo_status_t status;
  318|       |
  319|  1.29M|    status = _cairo_array_grow_by (array, num_elements);
  320|  1.29M|    if (unlikely (status))
  ------------------
  |  |  141|  1.29M|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1.29M]
  |  |  ------------------
  ------------------
  321|      0|	return status;
  322|       |
  323|  1.29M|    assert (array->num_elements + num_elements <= array->size);
  324|       |
  325|  1.29M|    *elements = array->elements + (size_t)array->num_elements * array->element_size;
  326|       |
  327|  1.29M|    array->num_elements += num_elements;
  328|       |
  329|  1.29M|    return CAIRO_STATUS_SUCCESS;
  330|  1.29M|}
_cairo_array_num_elements:
  342|     69|{
  343|     69|    return array->num_elements;
  344|     69|}
_cairo_user_data_array_init:
  372|    414|{
  373|    414|    _cairo_array_init (array, sizeof (cairo_user_data_slot_t));
  374|    414|}
_cairo_user_data_array_fini:
  385|    345|{
  386|    345|    unsigned int num_slots;
  387|       |
  388|    345|    num_slots = array->num_elements;
  389|    345|    if (num_slots) {
  ------------------
  |  Branch (389:9): [True: 69, False: 276]
  ------------------
  390|     69|	cairo_user_data_slot_t *slots;
  391|       |
  392|     69|	slots = _cairo_array_index (array, 0);
  393|    138|	while (num_slots--) {
  ------------------
  |  Branch (393:9): [True: 69, False: 69]
  ------------------
  394|     69|	    cairo_user_data_slot_t *s = &slots[num_slots];
  395|     69|	    if (s->user_data != NULL && s->destroy != NULL)
  ------------------
  |  Branch (395:10): [True: 69, False: 0]
  |  Branch (395:34): [True: 69, False: 0]
  ------------------
  396|     69|		s->destroy (s->user_data);
  397|     69|	}
  398|     69|    }
  399|       |
  400|    345|    _cairo_array_fini (array);
  401|    345|}
_cairo_user_data_array_set_data:
  457|     69|{
  458|     69|    cairo_status_t status;
  459|     69|    unsigned int i, num_slots;
  460|     69|    cairo_user_data_slot_t *slots, *slot, new_slot;
  461|       |
  462|     69|    if (user_data) {
  ------------------
  |  Branch (462:9): [True: 69, False: 0]
  ------------------
  463|     69|	new_slot.key = key;
  464|     69|	new_slot.user_data = user_data;
  465|     69|	new_slot.destroy = destroy;
  466|     69|    } else {
  467|      0|	new_slot.key = NULL;
  468|      0|	new_slot.user_data = NULL;
  469|      0|	new_slot.destroy = NULL;
  470|      0|    }
  471|       |
  472|     69|    slot = NULL;
  473|     69|    num_slots = array->num_elements;
  474|     69|    slots = _cairo_array_index (array, 0);
  475|     69|    for (i = 0; i < num_slots; i++) {
  ------------------
  |  Branch (475:17): [True: 0, False: 69]
  ------------------
  476|      0|	if (slots[i].key == key) {
  ------------------
  |  Branch (476:6): [True: 0, False: 0]
  ------------------
  477|      0|	    slot = &slots[i];
  478|      0|	    if (slot->destroy && slot->user_data)
  ------------------
  |  Branch (478:10): [True: 0, False: 0]
  |  Branch (478:27): [True: 0, False: 0]
  ------------------
  479|      0|		slot->destroy (slot->user_data);
  480|      0|	    break;
  481|      0|	}
  482|      0|	if (user_data && slots[i].user_data == NULL) {
  ------------------
  |  Branch (482:6): [True: 0, False: 0]
  |  Branch (482:19): [True: 0, False: 0]
  ------------------
  483|      0|	    slot = &slots[i];	/* Have to keep searching for an exact match */
  484|      0|	}
  485|      0|    }
  486|       |
  487|     69|    if (slot) {
  ------------------
  |  Branch (487:9): [True: 0, False: 69]
  ------------------
  488|      0|	*slot = new_slot;
  489|      0|	return CAIRO_STATUS_SUCCESS;
  490|      0|    }
  491|       |
  492|     69|    if (user_data == NULL)
  ------------------
  |  Branch (492:9): [True: 0, False: 69]
  ------------------
  493|      0|	return CAIRO_STATUS_SUCCESS;
  494|       |
  495|     69|    status = _cairo_array_append (array, &new_slot);
  496|     69|    if (unlikely (status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  497|      0|	return status;
  498|       |
  499|     69|    return CAIRO_STATUS_SUCCESS;
  500|     69|}

cairo-pattern.c:_cairo_atomic_int_get:
   61|    483|{
   62|    483|    return atomic_load_explicit (x, memory_order_seq_cst);
   63|    483|}
cairo-surface.c:_cairo_atomic_int_cmpxchg_impl:
   92|    138|{
   93|    138|    int expected = oldv;
   94|    138|    return atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
   95|    138|}
cairo-surface.c:_cairo_atomic_int_get:
   61|  1.03k|{
   62|  1.03k|    return atomic_load_explicit (x, memory_order_seq_cst);
   63|  1.03k|}
cairo.c:_cairo_atomic_int_get:
   61|    138|{
   62|    138|    return atomic_load_explicit (x, memory_order_seq_cst);
   63|    138|}
cairo.c:_cairo_atomic_int_cmpxchg_impl:
   92|     69|{
   93|     69|    int expected = oldv;
   94|     69|    return atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
   95|     69|}
cairo-default-context.c:_cairo_atomic_int_get_relaxed:
   67|    138|{
   68|    138|    return atomic_load_explicit (x, memory_order_relaxed);
   69|    138|}
cairo-default-context.c:_cairo_atomic_ptr_get:
   79|     69|{
   80|     69|    return atomic_load_explicit (x, memory_order_seq_cst);
   81|     69|}
cairo-default-context.c:_cairo_atomic_ptr_cmpxchg_impl:
  115|    138|{
  116|    138|    void *expected = oldv;
  117|    138|    return atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
  118|    138|}
cairo-default-context.c:_cairo_atomic_int_set_relaxed:
   73|    137|{
   74|    137|    atomic_store_explicit (x, val, memory_order_relaxed);
   75|    137|}
cairo-freed-pool.c:_cairo_atomic_ptr_get:
   79|     16|{
   80|     16|    return atomic_load_explicit (x, memory_order_seq_cst);
   81|     16|}
cairo-freed-pool.c:_cairo_atomic_ptr_cmpxchg_impl:
  115|     16|{
  116|     16|    void *expected = oldv;
  117|     16|    return atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
  118|     16|}
cairo-freed-pool.c:_cairo_atomic_int_set_relaxed:
   73|      1|{
   74|      1|    atomic_store_explicit (x, val, memory_order_relaxed);
   75|      1|}
cairo-image-compositor.c:_cairo_atomic_init_once_enter:
  496|     70|{
  497|     70|    if (likely(_cairo_atomic_int_get(once) == CAIRO_ATOMIC_ONCE_INITIALIZED))
  ------------------
  |  |  140|     70|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (140:22): [True: 68, False: 2]
  |  |  ------------------
  ------------------
  498|     68|	return 0;
  499|       |
  500|      2|    if (_cairo_atomic_int_cmpxchg(once,
  ------------------
  |  |   98|      2|  _cairo_atomic_int_cmpxchg_impl(x, oldv, newv)
  |  |  ------------------
  |  |  |  Branch (98:3): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  501|      2|				  CAIRO_ATOMIC_ONCE_UNINITIALIZED,
  502|      2|				  CAIRO_ATOMIC_ONCE_INITIALIZING))
  503|      2|	return 1;
  504|       |
  505|      0|    while (_cairo_atomic_int_get(once) != CAIRO_ATOMIC_ONCE_INITIALIZED) {}
  ------------------
  |  |  491|      0|#define CAIRO_ATOMIC_ONCE_INITIALIZED   (2)
  ------------------
  |  Branch (505:12): [True: 0, False: 0]
  ------------------
  506|      0|    return 0;
  507|      2|}
cairo-image-compositor.c:_cairo_atomic_int_get:
   61|     70|{
   62|     70|    return atomic_load_explicit (x, memory_order_seq_cst);
   63|     70|}
cairo-image-compositor.c:_cairo_atomic_int_cmpxchg_impl:
   92|      4|{
   93|      4|    int expected = oldv;
   94|      4|    return atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
   95|      4|}
cairo-image-compositor.c:_cairo_atomic_init_once_leave:
  511|      2|{
  512|      2|    if (unlikely(!_cairo_atomic_int_cmpxchg(once,
  ------------------
  |  |  141|      2|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  513|      2|					    CAIRO_ATOMIC_ONCE_INITIALIZING,
  514|      2|					    CAIRO_ATOMIC_ONCE_INITIALIZED)))
  515|      0|	assert (0 && "incorrect use of _cairo_atomic_init_once API (once != CAIRO_ATOMIC_ONCE_INITIALIZING)");
  516|      2|}

cairo-gstate.c:_cairo_clip_is_all_clipped:
   43|     69|{
   44|     69|    return clip == &__cairo_clip_all;
   45|     69|}

_cairo_clip_destroy:
  129|     69|{
  130|     69|    if (clip == NULL || _cairo_clip_is_all_clipped (clip))
  ------------------
  |  Branch (130:9): [True: 69, False: 0]
  |  Branch (130:25): [True: 0, False: 0]
  ------------------
  131|     69|	return;
  132|       |
  133|      0|    if (clip->path != NULL)
  ------------------
  |  Branch (133:9): [True: 0, False: 0]
  ------------------
  134|      0|	_cairo_clip_path_destroy (clip->path);
  135|       |
  136|      0|    if (clip->boxes != &clip->embedded_box)
  ------------------
  |  Branch (136:9): [True: 0, False: 0]
  ------------------
  137|      0|	free (clip->boxes);
  138|      0|    cairo_region_destroy (clip->region);
  139|       |
  140|      0|    _freed_pool_put (&clip_pool, clip);
  141|      0|}

_cairo_default_context_fini:
   69|     69|{
   70|     69|    while (cr->gstate != &cr->gstate_tail[0]) {
  ------------------
  |  Branch (70:12): [True: 0, False: 69]
  ------------------
   71|      0|	if (_cairo_gstate_restore (&cr->gstate, &cr->gstate_freelist))
  ------------------
  |  Branch (71:6): [True: 0, False: 0]
  ------------------
   72|      0|	    break;
   73|      0|    }
   74|       |
   75|     69|    _cairo_gstate_fini (cr->gstate);
   76|     69|    cr->gstate_freelist = cr->gstate_freelist->next; /* skip over tail[1] */
   77|     69|    while (cr->gstate_freelist != NULL) {
  ------------------
  |  Branch (77:12): [True: 0, False: 69]
  ------------------
   78|      0|	cairo_gstate_t *gstate = cr->gstate_freelist;
   79|      0|	cr->gstate_freelist = gstate->next;
   80|      0|	free (gstate);
   81|      0|    }
   82|       |
   83|     69|    _cairo_path_fixed_fini (cr->path);
   84|       |
   85|     69|    _cairo_fini (&cr->base);
   86|     69|}
_cairo_default_context_init:
 1492|     69|{
 1493|     69|    _cairo_init (&cr->base, &_cairo_default_context_backend);
 1494|     69|    _cairo_path_fixed_init (cr->path);
 1495|       |
 1496|     69|    cr->gstate = &cr->gstate_tail[0];
 1497|     69|    cr->gstate_freelist = &cr->gstate_tail[1];
 1498|     69|    cr->gstate_tail[1].next = NULL;
 1499|       |
 1500|     69|    return _cairo_gstate_init (cr->gstate, target);
 1501|     69|}
_cairo_default_context_create:
 1505|     69|{
 1506|     69|    cairo_default_context_t *cr;
 1507|     69|    cairo_status_t status;
 1508|       |
 1509|     69|    cr = _freed_pool_get (&context_pool);
 1510|     69|    if (unlikely (cr == NULL)) {
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 1, False: 68]
  |  |  ------------------
  ------------------
 1511|      1|	cr = _cairo_calloc (sizeof (cairo_default_context_t));
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1512|      1|	if (unlikely (cr == NULL))
  ------------------
  |  |  141|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1513|      0|	    return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
 1514|      1|    }
 1515|       |
 1516|     69|    status = _cairo_default_context_init (cr, target);
 1517|     69|    if (unlikely (status)) {
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1518|      0|	_freed_pool_put (&context_pool, cr);
 1519|      0|	return _cairo_create_in_error (status);
 1520|      0|    }
 1521|       |
 1522|     69|    return &cr->base;
 1523|     69|}
cairo-default-context.c:_cairo_default_context_destroy:
   90|     69|{
   91|     69|    cairo_default_context_t *cr = abstract_cr;
   92|       |
   93|     69|    _cairo_default_context_fini (cr);
   94|       |
   95|       |    /* mark the context as invalid to protect against misuse */
   96|     69|    cr->base.status = CAIRO_STATUS_NULL_POINTER;
   97|     69|    _freed_pool_put (&context_pool, cr);
   98|     69|}
cairo-default-context.c:_cairo_default_context_set_source:
  261|     69|{
  262|     69|    cairo_default_context_t *cr = abstract_cr;
  263|       |
  264|     69|    return _cairo_gstate_set_source (cr->gstate, source);
  265|     69|}
cairo-default-context.c:_cairo_default_context_paint:
  980|     69|{
  981|     69|    cairo_default_context_t *cr = abstract_cr;
  982|       |
  983|     69|    return _cairo_gstate_paint (cr->gstate);
  984|     69|}

cairo_device_reference:
  208|     69|{
  209|     69|    if (device == NULL ||
  ------------------
  |  Branch (209:9): [True: 69, False: 0]
  ------------------
  210|     69|	CAIRO_REFERENCE_COUNT_IS_INVALID (&device->ref_count))
  ------------------
  |  |   58|      0|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|      0|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|      0|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  211|     69|    {
  212|     69|	return device;
  213|     69|    }
  214|       |
  215|      0|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&device->ref_count));
  216|      0|    _cairo_reference_count_inc (&device->ref_count);
  ------------------
  |  |   47|      0|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|      0|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
  217|       |
  218|      0|    return device;
  219|      0|}

_cairo_error:
   66|  4.95k|{
   67|  4.95k|    CAIRO_ENSURE_UNIQUE;
  ------------------
  |  |  195|  4.95k|#define CAIRO_ENSURE_UNIQUE    do { } while (0)
  |  |  ------------------
  |  |  |  Branch (195:46): [Folded - Ignored]
  |  |  ------------------
  ------------------
   68|  4.95k|    assert (_cairo_status_is_error (status));
   69|       |
   70|  4.95k|    return status;
   71|  4.95k|}

cairo_font_face_destroy:
  171|     69|{
  172|     69|    if (font_face == NULL ||
  ------------------
  |  Branch (172:9): [True: 69, False: 0]
  ------------------
  173|     69|	CAIRO_REFERENCE_COUNT_IS_INVALID (&font_face->ref_count))
  ------------------
  |  |   58|      0|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|      0|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|      0|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  174|     69|	return;
  175|       |
  176|      0|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&font_face->ref_count));
  177|       |
  178|       |    /* We allow resurrection to deal with some memory management for the
  179|       |     * FreeType backend where cairo_ft_font_face_t and cairo_ft_unscaled_font_t
  180|       |     * need to effectively mutually reference each other
  181|       |     */
  182|      0|    if (__put (&font_face->ref_count))
  ------------------
  |  Branch (182:9): [True: 0, False: 0]
  ------------------
  183|      0|	return;
  184|       |
  185|      0|    if (! font_face->backend->destroy (font_face))
  ------------------
  |  Branch (185:9): [True: 0, False: 0]
  ------------------
  186|      0|	return;
  187|       |
  188|      0|    _cairo_user_data_array_fini (&font_face->user_data);
  189|       |
  190|      0|    free (font_face);
  191|      0|}

_cairo_font_options_init_default:
   73|     69|{
   74|     69|    options->antialias = CAIRO_ANTIALIAS_DEFAULT;
   75|     69|    options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
   76|     69|    options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT;
   77|     69|    options->hint_style = CAIRO_HINT_STYLE_DEFAULT;
   78|     69|    options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT;
   79|     69|    options->round_glyph_positions = CAIRO_ROUND_GLYPH_POS_DEFAULT;
   80|     69|    options->variations = NULL;
   81|     69|    options->color_mode = CAIRO_COLOR_MODE_DEFAULT;
   82|     69|    options->palette_index = CAIRO_COLOR_PALETTE_DEFAULT;
  ------------------
  |  | 1517|     69|#define CAIRO_COLOR_PALETTE_DEFAULT 0
  ------------------
   83|     69|    options->custom_palette = NULL;
   84|     69|    options->custom_palette_size = 0;
   85|     69|}
_cairo_font_options_fini:
  209|     69|{
  210|     69|    free (options->variations);
  211|     69|    free (options->custom_palette);
  212|     69|}

cairo-default-context.c:_freed_pool_get:
   80|     69|{
   81|     69|    void *ptr;
   82|     69|    int i;
   83|       |
   84|     69|    i = _cairo_atomic_int_get_relaxed (&pool->top) - 1;
   85|     69|    if (i < 0)
  ------------------
  |  Branch (85:9): [True: 1, False: 68]
  ------------------
   86|      1|	i = 0;
   87|       |
   88|     69|    ptr = _atomic_fetch (&pool->pool[i]);
   89|     69|    if (likely (ptr != NULL)) {
  ------------------
  |  |  140|     69|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (140:22): [True: 68, False: 1]
  |  |  ------------------
  ------------------
   90|     68|	_cairo_atomic_int_set_relaxed (&pool->top, i);
   91|     68|	return ptr;
   92|     68|    }
   93|       |
   94|       |    /* either empty or contended */
   95|      1|    return _freed_pool_get_search (pool);
   96|     69|}
cairo-default-context.c:_atomic_fetch:
   59|     69|{
   60|     69|    void *ptr;
   61|       |
   62|     69|    do {
   63|     69|        ptr = _cairo_atomic_ptr_get (slot);
   64|     69|    } while (! _cairo_atomic_ptr_cmpxchg (slot, ptr, NULL));
  ------------------
  |  |  121|     69|  _cairo_atomic_ptr_cmpxchg_impl(x, oldv, newv)
  ------------------
  |  Branch (64:14): [True: 0, False: 69]
  ------------------
   65|       |
   66|     69|    return ptr;
   67|     69|}
cairo-default-context.c:_freed_pool_put:
  103|     69|{
  104|     69|    int i;
  105|       |
  106|     69|    i = _cairo_atomic_int_get_relaxed (&pool->top);
  107|     69|    if (likely (i < ARRAY_LENGTH (pool->pool) &&
  ------------------
  |  |  140|    138|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (140:22): [True: 69, False: 0]
  |  |  |  Branch (140:44): [True: 69, False: 0]
  |  |  |  Branch (140:44): [True: 69, False: 0]
  |  |  ------------------
  ------------------
  108|     69|		_atomic_store (&pool->pool[i], ptr)))
  109|     69|    {
  110|     69|	_cairo_atomic_int_set_relaxed (&pool->top, i + 1);
  111|     69|	return;
  112|     69|    }
  113|       |
  114|       |    /* either full or contended */
  115|      0|    _freed_pool_put_search (pool, ptr);
  116|      0|}
cairo-default-context.c:_atomic_store:
   71|     69|{
   72|     69|    return _cairo_atomic_ptr_cmpxchg (slot, NULL, ptr);
  ------------------
  |  |  121|     69|  _cairo_atomic_ptr_cmpxchg_impl(x, oldv, newv)
  ------------------
   73|     69|}
cairo-freed-pool.c:_atomic_fetch:
   59|     16|{
   60|     16|    void *ptr;
   61|       |
   62|     16|    do {
   63|     16|        ptr = _cairo_atomic_ptr_get (slot);
   64|     16|    } while (! _cairo_atomic_ptr_cmpxchg (slot, ptr, NULL));
  ------------------
  |  |  121|     16|  _cairo_atomic_ptr_cmpxchg_impl(x, oldv, newv)
  ------------------
  |  Branch (64:14): [True: 0, False: 16]
  ------------------
   65|       |
   66|     16|    return ptr;
   67|     16|}

_freed_pool_get_search:
   46|      1|{
   47|      1|    void *ptr;
   48|      1|    int i;
   49|       |
   50|     17|    for (i = ARRAY_LENGTH (pool->pool); i--;) {
  ------------------
  |  |  125|      1|#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
  ------------------
  |  Branch (50:41): [True: 16, False: 1]
  ------------------
   51|     16|	ptr = _atomic_fetch (&pool->pool[i]);
   52|     16|	if (ptr != NULL) {
  ------------------
  |  Branch (52:6): [True: 0, False: 16]
  ------------------
   53|      0|	    _cairo_atomic_int_set_relaxed (&pool->top, i);
   54|      0|	    return ptr;
   55|      0|	}
   56|     16|    }
   57|       |
   58|       |    /* empty */
   59|      1|    _cairo_atomic_int_set_relaxed (&pool->top, 0);
   60|      1|    return NULL;
   61|      1|}

_cairo_gstate_init:
   87|     69|{
   88|     69|    VG (VALGRIND_MAKE_MEM_UNDEFINED (gstate, sizeof (cairo_gstate_t)));
   89|       |
   90|     69|    gstate->next = NULL;
   91|       |
   92|     69|    gstate->op = CAIRO_GSTATE_OPERATOR_DEFAULT;
  ------------------
  |  |  725|     69|#define CAIRO_GSTATE_OPERATOR_DEFAULT	CAIRO_OPERATOR_OVER
  ------------------
   93|     69|    gstate->opacity = 1.;
   94|       |
   95|     69|    gstate->tolerance = CAIRO_GSTATE_TOLERANCE_DEFAULT;
  ------------------
  |  |  726|     69|#define CAIRO_GSTATE_TOLERANCE_DEFAULT	0.1
  ------------------
   96|     69|    gstate->antialias = CAIRO_ANTIALIAS_DEFAULT;
   97|       |
   98|     69|    _cairo_stroke_style_init (&gstate->stroke_style);
   99|       |
  100|     69|    gstate->fill_rule = CAIRO_GSTATE_FILL_RULE_DEFAULT;
  ------------------
  |  |  727|     69|#define CAIRO_GSTATE_FILL_RULE_DEFAULT	CAIRO_FILL_RULE_WINDING
  ------------------
  101|       |
  102|     69|    gstate->font_face = NULL;
  103|     69|    gstate->scaled_font = NULL;
  104|     69|    gstate->previous_scaled_font = NULL;
  105|       |
  106|     69|    cairo_matrix_init_scale (&gstate->font_matrix,
  107|     69|			     CAIRO_GSTATE_DEFAULT_FONT_SIZE,
  ------------------
  |  |  732|     69|#define CAIRO_GSTATE_DEFAULT_FONT_SIZE  10.0
  ------------------
  108|     69|			     CAIRO_GSTATE_DEFAULT_FONT_SIZE);
  ------------------
  |  |  732|     69|#define CAIRO_GSTATE_DEFAULT_FONT_SIZE  10.0
  ------------------
  109|       |
  110|     69|    _cairo_font_options_init_default (&gstate->font_options);
  111|       |
  112|     69|    gstate->clip = NULL;
  113|       |
  114|     69|    gstate->target = cairo_surface_reference (target);
  115|     69|    gstate->parent_target = NULL;
  116|     69|    gstate->original_target = cairo_surface_reference (target);
  117|       |
  118|     69|    gstate->device_transform_observer.callback = _cairo_gstate_update_device_transform;
  119|     69|    cairo_list_add (&gstate->device_transform_observer.link,
  120|     69|		    &gstate->target->device_transform_observers);
  121|       |
  122|     69|    gstate->is_identity = _cairo_matrix_is_identity (&gstate->target->device_transform);
  123|     69|    cairo_matrix_init_identity (&gstate->ctm);
  124|     69|    gstate->ctm_inverse = gstate->ctm;
  125|     69|    gstate->source_ctm_inverse = gstate->ctm;
  126|       |
  127|     69|    gstate->source = (cairo_pattern_t *) &_cairo_pattern_black.base;
  128|       |
  129|       |    /* Now that the gstate is fully initialized and ready for the eventual
  130|       |     * _cairo_gstate_fini(), we can check for errors (and not worry about
  131|       |     * the resource deallocation). */
  132|     69|    return target->status;
  133|     69|}
_cairo_gstate_fini:
  195|     69|{
  196|     69|    _cairo_stroke_style_fini (&gstate->stroke_style);
  197|     69|    _cairo_font_options_fini (&gstate->font_options);
  198|       |
  199|     69|    cairo_font_face_destroy (gstate->font_face);
  200|     69|    gstate->font_face = NULL;
  201|       |
  202|     69|    cairo_scaled_font_destroy (gstate->previous_scaled_font);
  203|     69|    gstate->previous_scaled_font = NULL;
  204|       |
  205|     69|    cairo_scaled_font_destroy (gstate->scaled_font);
  206|     69|    gstate->scaled_font = NULL;
  207|       |
  208|     69|    _cairo_clip_destroy (gstate->clip);
  209|       |
  210|     69|    cairo_list_del (&gstate->device_transform_observer.link);
  211|       |
  212|     69|    cairo_surface_destroy (gstate->target);
  213|     69|    gstate->target = NULL;
  214|       |
  215|     69|    cairo_surface_destroy (gstate->parent_target);
  216|     69|    gstate->parent_target = NULL;
  217|       |
  218|     69|    cairo_surface_destroy (gstate->original_target);
  219|     69|    gstate->original_target = NULL;
  220|       |
  221|     69|    cairo_pattern_destroy (gstate->source);
  222|     69|    gstate->source = NULL;
  223|       |
  224|     69|    VG (VALGRIND_MAKE_MEM_UNDEFINED (gstate, sizeof (cairo_gstate_t)));
  225|     69|}
_cairo_gstate_set_source:
  393|     69|{
  394|     69|    if (source->status)
  ------------------
  |  Branch (394:9): [True: 0, False: 69]
  ------------------
  395|      0|	return source->status;
  396|       |
  397|     69|    source = cairo_pattern_reference (source);
  398|     69|    cairo_pattern_destroy (gstate->source);
  399|     69|    gstate->source = source;
  400|     69|    gstate->source_ctm_inverse = gstate->ctm_inverse;
  401|       |
  402|     69|    return CAIRO_STATUS_SUCCESS;
  403|     69|}
_cairo_gstate_paint:
 1078|     69|{
 1079|     69|    cairo_pattern_union_t source_pattern;
 1080|     69|    const cairo_pattern_t *pattern;
 1081|     69|    cairo_status_t status;
 1082|     69|    cairo_operator_t op;
 1083|       |
 1084|     69|    status = _cairo_gstate_get_pattern_status (gstate->source);
 1085|     69|    if (unlikely (status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1086|      0|	return status;
 1087|       |
 1088|     69|    if (gstate->op == CAIRO_OPERATOR_DEST)
  ------------------
  |  Branch (1088:9): [True: 0, False: 69]
  ------------------
 1089|      0|	return CAIRO_STATUS_SUCCESS;
 1090|       |
 1091|     69|    if (_cairo_clip_is_all_clipped (gstate->clip))
  ------------------
  |  Branch (1091:9): [True: 0, False: 69]
  ------------------
 1092|      0|	return CAIRO_STATUS_SUCCESS;
 1093|       |
 1094|     69|    op = _reduce_op (gstate);
 1095|     69|    if (op == CAIRO_OPERATOR_CLEAR) {
  ------------------
  |  Branch (1095:9): [True: 0, False: 69]
  ------------------
 1096|      0|	pattern = &_cairo_pattern_clear.base;
 1097|     69|    } else {
 1098|     69|	_cairo_gstate_copy_transformed_source (gstate, &source_pattern.base);
 1099|     69|	pattern = &source_pattern.base;
 1100|     69|    }
 1101|       |
 1102|     69|    return _cairo_surface_paint (gstate->target,
 1103|     69|				 op, pattern,
 1104|     69|				 gstate->clip);
 1105|     69|}
cairo-gstate.c:_cairo_gstate_get_pattern_status:
 1064|     69|{
 1065|     69|    if (unlikely (pattern->type == CAIRO_PATTERN_TYPE_MESH &&
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  |  Branch (141:46): [True: 0, False: 69]
  |  |  |  Branch (141:46): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1066|     69|		  ((const cairo_mesh_pattern_t *) pattern)->current_patch))
 1067|      0|    {
 1068|       |	/* If current patch != NULL, the pattern is under construction
 1069|       |	 * and cannot be used as a source */
 1070|      0|	return CAIRO_STATUS_INVALID_MESH_CONSTRUCTION;
 1071|      0|    }
 1072|       |
 1073|     69|    return pattern->status;
 1074|     69|}
cairo-gstate.c:_reduce_op:
 1025|     69|{
 1026|     69|    cairo_operator_t op;
 1027|     69|    const cairo_pattern_t *pattern;
 1028|       |
 1029|     69|    op = gstate->op;
 1030|     69|    if (op != CAIRO_OPERATOR_SOURCE)
  ------------------
  |  Branch (1030:9): [True: 69, False: 0]
  ------------------
 1031|     69|	return op;
 1032|       |
 1033|      0|    pattern = gstate->source;
 1034|      0|    if (pattern->type == CAIRO_PATTERN_TYPE_SOLID) {
  ------------------
  |  Branch (1034:9): [True: 0, False: 0]
  ------------------
 1035|      0|	const cairo_solid_pattern_t *solid = (cairo_solid_pattern_t *) pattern;
 1036|      0|	if (solid->color.alpha_short <= 0x00ff) {
  ------------------
  |  Branch (1036:6): [True: 0, False: 0]
  ------------------
 1037|      0|	    op = CAIRO_OPERATOR_CLEAR;
 1038|      0|	} else if ((gstate->target->content & CAIRO_CONTENT_ALPHA) == 0) {
  ------------------
  |  Branch (1038:13): [True: 0, False: 0]
  ------------------
 1039|      0|	    if ((solid->color.red_short |
  ------------------
  |  Branch (1039:10): [True: 0, False: 0]
  ------------------
 1040|      0|		 solid->color.green_short |
 1041|      0|		 solid->color.blue_short) <= 0x00ff)
 1042|      0|	    {
 1043|      0|		op = CAIRO_OPERATOR_CLEAR;
 1044|      0|	    }
 1045|      0|	}
 1046|      0|    } else if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
  ------------------
  |  Branch (1046:16): [True: 0, False: 0]
  ------------------
 1047|      0|	const cairo_surface_pattern_t *surface = (cairo_surface_pattern_t *) pattern;
 1048|      0|	if (surface->surface->is_clear &&
  ------------------
  |  Branch (1048:6): [True: 0, False: 0]
  ------------------
 1049|      0|	    surface->surface->content & CAIRO_CONTENT_ALPHA)
  ------------------
  |  Branch (1049:6): [True: 0, False: 0]
  ------------------
 1050|      0|	{
 1051|      0|	    op = CAIRO_OPERATOR_CLEAR;
 1052|      0|	}
 1053|      0|    } else {
 1054|      0|	const cairo_gradient_pattern_t *gradient = (cairo_gradient_pattern_t *) pattern;
 1055|      0|	if (gradient->n_stops == 0)
  ------------------
  |  Branch (1055:6): [True: 0, False: 0]
  ------------------
 1056|      0|	    op = CAIRO_OPERATOR_CLEAR;
 1057|      0|    }
 1058|       |
 1059|      0|    return op;
 1060|     69|}
cairo-gstate.c:_cairo_gstate_copy_transformed_source:
 1007|     69|{
 1008|     69|    _cairo_gstate_copy_transformed_pattern (gstate, pattern,
 1009|     69|					    gstate->source,
 1010|     69|					    &gstate->source_ctm_inverse);
 1011|     69|}
cairo-gstate.c:_cairo_gstate_copy_transformed_pattern:
  967|     69|{
  968|       |    /*
  969|       |     * What calculations below do can be described in pseudo-code (so using nonexistent fields) as (using column vectors):
  970|       |     * pattern->matrix = surface->device_transform *
  971|       |     * 			 pattern->matrix *
  972|       |     * 			 ctm_inverse *
  973|       |     * 			 gstate->target->device_transform_inverse
  974|       |     *
  975|       |     * The inverse of which is:
  976|       |     * pattern->matrix_inverse = gstate->target->device_transform *
  977|       |     * 				 ctm *
  978|       |     * 				 pattern->matrix_inverse *
  979|       |     * 				 surface->device_transform_inverse
  980|       |     */
  981|       |
  982|     69|    _cairo_gstate_copy_pattern (pattern, original);
  983|       |
  984|     69|    if (original->type == CAIRO_PATTERN_TYPE_SURFACE) {
  ------------------
  |  Branch (984:9): [True: 0, False: 69]
  ------------------
  985|      0|	cairo_surface_pattern_t *surface_pattern;
  986|      0|	cairo_surface_t *surface;
  987|       |
  988|      0|        surface_pattern = (cairo_surface_pattern_t *) original;
  989|      0|        surface = surface_pattern->surface;
  990|       |
  991|      0|	if (_cairo_surface_has_device_transform (surface))
  ------------------
  |  Branch (991:6): [True: 0, False: 0]
  ------------------
  992|      0|	    _cairo_pattern_pretransform (pattern, &surface->device_transform);
  993|      0|    }
  994|       |
  995|     69|    if (! _cairo_matrix_is_identity (ctm_inverse))
  ------------------
  |  Branch (995:9): [True: 0, False: 69]
  ------------------
  996|      0|	_cairo_pattern_transform (pattern, ctm_inverse);
  997|       |
  998|     69|    if (_cairo_surface_has_device_transform (gstate->target)) {
  ------------------
  |  Branch (998:9): [True: 0, False: 69]
  ------------------
  999|      0|        _cairo_pattern_transform (pattern,
 1000|      0|                                  &gstate->target->device_transform_inverse);
 1001|      0|    }
 1002|     69|}
cairo-gstate.c:_cairo_gstate_copy_pattern:
  933|     69|{
  934|       |    /* First check if the we can replace the original with a much simpler
  935|       |     * pattern. For example, gradients that are uniform or just have a single
  936|       |     * stop can sometimes be replaced with a solid.
  937|       |     */
  938|       |
  939|     69|    if (_cairo_pattern_is_clear (original)) {
  ------------------
  |  Branch (939:9): [True: 0, False: 69]
  ------------------
  940|      0|        _cairo_pattern_init_solid ((cairo_solid_pattern_t *) pattern,
  941|      0|				   CAIRO_COLOR_TRANSPARENT);
  ------------------
  |  |  802|      0|#define CAIRO_COLOR_TRANSPARENT _cairo_stock_color (CAIRO_STOCK_TRANSPARENT)
  ------------------
  942|      0|	return;
  943|      0|    }
  944|       |
  945|     69|    if (original->type == CAIRO_PATTERN_TYPE_LINEAR ||
  ------------------
  |  Branch (945:9): [True: 0, False: 69]
  ------------------
  946|     69|	original->type == CAIRO_PATTERN_TYPE_RADIAL)
  ------------------
  |  Branch (946:2): [True: 0, False: 69]
  ------------------
  947|      0|    {
  948|      0|        cairo_color_t color;
  949|      0|	if (_cairo_gradient_pattern_is_solid ((cairo_gradient_pattern_t *) original,
  ------------------
  |  Branch (949:6): [True: 0, False: 0]
  ------------------
  950|      0|					      NULL,
  951|      0|					      &color))
  952|      0|	{
  953|      0|	    _cairo_pattern_init_solid ((cairo_solid_pattern_t *) pattern,
  954|      0|				       &color);
  955|      0|	    return;
  956|      0|	}
  957|      0|    }
  958|       |
  959|     69|    _cairo_pattern_init_static_copy (pattern, original);
  960|     69|}

_cairo_hash_table_create:
  164|      1|{
  165|      1|    cairo_hash_table_t *hash_table;
  166|       |
  167|      1|    hash_table = _cairo_calloc (sizeof (cairo_hash_table_t));
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [Folded - Ignored]
  |  |  ------------------
  ------------------
  168|      1|    if (unlikely (hash_table == NULL)) {
  ------------------
  |  |  141|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  169|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  170|      0|	return NULL;
  171|      0|    }
  172|       |
  173|      1|    if (keys_equal == NULL)
  ------------------
  |  Branch (173:9): [True: 0, False: 1]
  ------------------
  174|      0|	hash_table->keys_equal = _cairo_hash_table_uid_keys_equal;
  175|      1|    else
  176|      1|	hash_table->keys_equal = keys_equal;
  177|       |
  178|      1|    memset (&hash_table->cache, 0, sizeof (hash_table->cache));
  179|      1|    hash_table->table_size = &hash_table_sizes[0];
  180|       |
  181|      1|    hash_table->entries = _cairo_calloc_ab (*hash_table->table_size,
  182|      1|				  sizeof (cairo_hash_entry_t *));
  183|      1|    if (unlikely (hash_table->entries == NULL)) {
  ------------------
  |  |  141|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  184|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  185|      0|	free (hash_table);
  186|      0|	return NULL;
  187|      0|    }
  188|       |
  189|      1|    hash_table->live_entries = 0;
  190|      1|    hash_table->free_entries = *hash_table->table_size;
  191|      1|    hash_table->iterating = 0;
  192|       |
  193|      1|    return hash_table;
  194|      1|}
_cairo_hash_table_lookup:
  340|     69|{
  341|     69|    cairo_hash_entry_t *entry;
  342|     69|    unsigned long table_size, i, idx, step;
  343|     69|    uintptr_t hash = key->hash;
  344|       |
  345|     69|    entry = hash_table->cache[hash & 31];
  346|     69|    if (entry && entry->hash == hash && hash_table->keys_equal (key, entry))
  ------------------
  |  Branch (346:9): [True: 68, False: 1]
  |  Branch (346:18): [True: 68, False: 0]
  |  Branch (346:41): [True: 68, False: 0]
  ------------------
  347|     68|	return entry;
  348|       |
  349|      1|    table_size = *hash_table->table_size;
  350|      1|    idx = hash % table_size;
  351|       |
  352|      1|    entry = hash_table->entries[idx];
  353|      1|    if (ENTRY_IS_LIVE (entry)) {
  ------------------
  |  |   60|      1|#define ENTRY_IS_LIVE(entry) ((entry) >  DEAD_ENTRY)
  |  |  ------------------
  |  |  |  |   56|      1|#define DEAD_ENTRY ((cairo_hash_entry_t *) 0x1)
  |  |  ------------------
  |  |  |  Branch (60:30): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  354|      0|	if (entry->hash == hash && hash_table->keys_equal (key, entry))
  ------------------
  |  Branch (354:6): [True: 0, False: 0]
  |  Branch (354:29): [True: 0, False: 0]
  ------------------
  355|      0|		goto insert_cache;
  356|      1|    } else if (ENTRY_IS_FREE (entry))
  ------------------
  |  |   58|      1|#define ENTRY_IS_FREE(entry) ((entry) == NULL)
  |  |  ------------------
  |  |  |  Branch (58:30): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  357|      1|	return NULL;
  358|       |
  359|      0|    i = 1;
  360|      0|    step = 1 + hash % (table_size - 2);
  361|      0|    do {
  362|      0|	idx += step;
  363|      0|	if (idx >= table_size)
  ------------------
  |  Branch (363:6): [True: 0, False: 0]
  ------------------
  364|      0|	    idx -= table_size;
  365|       |
  366|      0|	entry = hash_table->entries[idx];
  367|      0|	if (ENTRY_IS_LIVE (entry)) {
  ------------------
  |  |   60|      0|#define ENTRY_IS_LIVE(entry) ((entry) >  DEAD_ENTRY)
  |  |  ------------------
  |  |  |  |   56|      0|#define DEAD_ENTRY ((cairo_hash_entry_t *) 0x1)
  |  |  ------------------
  |  |  |  Branch (60:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  368|      0|	    if (entry->hash == hash && hash_table->keys_equal (key, entry))
  ------------------
  |  Branch (368:10): [True: 0, False: 0]
  |  Branch (368:33): [True: 0, False: 0]
  ------------------
  369|      0|		    goto insert_cache;
  370|      0|	} else if (ENTRY_IS_FREE (entry))
  ------------------
  |  |   58|      0|#define ENTRY_IS_FREE(entry) ((entry) == NULL)
  |  |  ------------------
  |  |  |  Branch (58:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  371|      0|	    return NULL;
  372|      0|    } while (++i < table_size);
  ------------------
  |  Branch (372:14): [True: 0, False: 0]
  ------------------
  373|       |
  374|      0|    ASSERT_NOT_REACHED;
  ------------------
  |  |  143|      0|#define ASSERT_NOT_REACHED		\
  |  |  144|      0|do {					\
  |  |  145|      0|    assert (!"reached");		\
  |  |  146|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (146:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  375|      0|    return NULL;
  376|       |
  377|      0|insert_cache:
  378|      0|    hash_table->cache[hash & 31] = entry;
  379|      0|    return entry;
  380|      0|}
_cairo_hash_table_insert:
  457|      1|{
  458|      1|    cairo_hash_entry_t **entry;
  459|      1|    cairo_status_t status;
  460|       |
  461|       |    /* Insert is illegal while an iterator is running. */
  462|      1|    assert (hash_table->iterating == 0);
  463|       |
  464|      1|    status = _cairo_hash_table_manage (hash_table);
  465|      1|    if (unlikely (status))
  ------------------
  |  |  141|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  466|      0|	return status;
  467|       |
  468|      1|    entry = _cairo_hash_table_lookup_unique_key (hash_table, key_and_value);
  469|       |
  470|      1|    if (ENTRY_IS_FREE (*entry))
  ------------------
  |  |   58|      1|#define ENTRY_IS_FREE(entry) ((entry) == NULL)
  |  |  ------------------
  |  |  |  Branch (58:30): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  471|      1|	hash_table->free_entries--;
  472|       |
  473|      1|    *entry = key_and_value;
  474|      1|    hash_table->cache[key_and_value->hash & 31] = key_and_value;
  475|      1|    hash_table->live_entries++;
  476|       |
  477|      1|    return CAIRO_STATUS_SUCCESS;
  478|      1|}
cairo-hash.c:_cairo_hash_table_manage:
  269|      1|{
  270|      1|    cairo_hash_table_t tmp;
  271|      1|    unsigned long new_size, i;
  272|       |
  273|       |    /* Keep between 12.5% and 50% entries in the hash table alive and
  274|       |     * at least 25% free. */
  275|      1|    unsigned long live_high = *hash_table->table_size >> 1;
  276|      1|    unsigned long live_low = live_high >> 2;
  277|      1|    unsigned long free_low = live_high >> 1;
  278|       |
  279|      1|    tmp = *hash_table;
  280|       |
  281|      1|    if (hash_table->live_entries > live_high)
  ------------------
  |  Branch (281:9): [True: 0, False: 1]
  ------------------
  282|      0|    {
  283|      0|	tmp.table_size = hash_table->table_size + 1;
  284|       |	/* This code is being abused if we can't make a table big enough. */
  285|      0|	assert (tmp.table_size - hash_table_sizes <
  286|      0|		ARRAY_LENGTH (hash_table_sizes));
  287|      0|    }
  288|      1|    else if (hash_table->live_entries < live_low)
  ------------------
  |  Branch (288:14): [True: 1, False: 0]
  ------------------
  289|      1|    {
  290|       |	/* Can't shrink if we're at the smallest size */
  291|      1|	if (hash_table->table_size == &hash_table_sizes[0])
  ------------------
  |  Branch (291:6): [True: 1, False: 0]
  ------------------
  292|      1|	    tmp.table_size = hash_table->table_size;
  293|      0|	else
  294|      0|	    tmp.table_size = hash_table->table_size - 1;
  295|      1|    }
  296|       |
  297|      1|    if (tmp.table_size == hash_table->table_size &&
  ------------------
  |  Branch (297:9): [True: 1, False: 0]
  ------------------
  298|      1|	hash_table->free_entries > free_low)
  ------------------
  |  Branch (298:2): [True: 1, False: 0]
  ------------------
  299|      1|    {
  300|       |	/* The number of live entries is within the desired bounds
  301|       |	 * (we're not going to resize the table) and we have enough
  302|       |	 * free entries. Do nothing. */
  303|      1|	return CAIRO_STATUS_SUCCESS;
  304|      1|    }
  305|       |
  306|      0|    new_size = *tmp.table_size;
  307|      0|    tmp.entries = _cairo_calloc_ab (new_size, sizeof (cairo_hash_entry_t*));
  308|      0|    if (unlikely (tmp.entries == NULL))
  ------------------
  |  |  141|      0|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  309|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  310|       |
  311|      0|    for (i = 0; i < *hash_table->table_size; ++i) {
  ------------------
  |  Branch (311:17): [True: 0, False: 0]
  ------------------
  312|      0|	if (ENTRY_IS_LIVE (hash_table->entries[i])) {
  ------------------
  |  |   60|      0|#define ENTRY_IS_LIVE(entry) ((entry) >  DEAD_ENTRY)
  |  |  ------------------
  |  |  |  |   56|      0|#define DEAD_ENTRY ((cairo_hash_entry_t *) 0x1)
  |  |  ------------------
  |  |  |  Branch (60:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  313|      0|	    *_cairo_hash_table_lookup_unique_key (&tmp, hash_table->entries[i])
  314|      0|		= hash_table->entries[i];
  315|      0|	}
  316|      0|    }
  317|       |
  318|      0|    free (hash_table->entries);
  319|      0|    hash_table->entries = tmp.entries;
  320|      0|    hash_table->table_size = tmp.table_size;
  321|      0|    hash_table->free_entries = new_size - hash_table->live_entries;
  322|       |
  323|      0|    return CAIRO_STATUS_SUCCESS;
  324|      0|}
cairo-hash.c:_cairo_hash_table_lookup_unique_key:
  228|      1|{
  229|      1|    unsigned long table_size, i, idx, step;
  230|      1|    cairo_hash_entry_t **entry;
  231|       |
  232|      1|    table_size = *hash_table->table_size;
  233|      1|    idx = key->hash % table_size;
  234|       |
  235|      1|    entry = &hash_table->entries[idx];
  236|      1|    if (! ENTRY_IS_LIVE (*entry))
  ------------------
  |  |   60|      1|#define ENTRY_IS_LIVE(entry) ((entry) >  DEAD_ENTRY)
  |  |  ------------------
  |  |  |  |   56|      1|#define DEAD_ENTRY ((cairo_hash_entry_t *) 0x1)
  |  |  ------------------
  ------------------
  |  Branch (236:9): [True: 1, False: 0]
  ------------------
  237|      1|	return entry;
  238|       |
  239|      0|    i = 1;
  240|      0|    step = 1 + key->hash % (table_size - 2);
  241|      0|    do {
  242|      0|	idx += step;
  243|      0|	if (idx >= table_size)
  ------------------
  |  Branch (243:6): [True: 0, False: 0]
  ------------------
  244|      0|	    idx -= table_size;
  245|       |
  246|      0|	entry = &hash_table->entries[idx];
  247|      0|	if (! ENTRY_IS_LIVE (*entry))
  ------------------
  |  |   60|      0|#define ENTRY_IS_LIVE(entry) ((entry) >  DEAD_ENTRY)
  |  |  ------------------
  |  |  |  |   56|      0|#define DEAD_ENTRY ((cairo_hash_entry_t *) 0x1)
  |  |  ------------------
  ------------------
  |  Branch (247:6): [True: 0, False: 0]
  ------------------
  248|      0|	    return entry;
  249|      0|    } while (++i < table_size);
  ------------------
  |  Branch (249:14): [True: 0, False: 0]
  ------------------
  250|       |
  251|      0|    ASSERT_NOT_REACHED;
  ------------------
  |  |  143|      0|#define ASSERT_NOT_REACHED		\
  |  |  144|      0|do {					\
  |  |  145|      0|    assert (!"reached");		\
  |  |  146|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (146:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  252|      0|    return NULL;
  253|      0|}

_cairo_image_traps_compositor_get:
 1275|      1|{
 1276|      1|    static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT;
  ------------------
  |  |  492|      1|#define CAIRO_ATOMIC_ONCE_INIT          CAIRO_ATOMIC_ONCE_UNINITIALIZED
  |  |  ------------------
  |  |  |  |  489|      1|#define CAIRO_ATOMIC_ONCE_UNINITIALIZED (0)
  |  |  ------------------
  ------------------
 1277|      1|    static cairo_traps_compositor_t compositor;
 1278|       |
 1279|      1|    if (_cairo_atomic_init_once_enter(&once)) {
  ------------------
  |  Branch (1279:9): [True: 1, False: 0]
  ------------------
 1280|      1|	_cairo_traps_compositor_init(&compositor,
 1281|      1|				     &__cairo_no_compositor);
 1282|      1|	compositor.acquire = acquire;
 1283|      1|	compositor.release = release;
 1284|      1|	compositor.set_clip_region = set_clip_region;
 1285|      1|	compositor.pattern_to_surface = _cairo_image_source_create_for_pattern;
 1286|      1|	compositor.draw_image_boxes = draw_image_boxes;
 1287|       |	//compositor.copy_boxes = copy_boxes;
 1288|      1|	compositor.fill_boxes = fill_boxes;
 1289|      1|	compositor.check_composite = check_composite;
 1290|      1|	compositor.composite = composite;
 1291|      1|	compositor.lerp = lerp;
 1292|       |	//compositor.check_composite_boxes = check_composite_boxes;
 1293|      1|	compositor.composite_boxes = composite_boxes;
 1294|       |	//compositor.check_composite_traps = check_composite_traps;
 1295|      1|	compositor.composite_traps = composite_traps;
 1296|       |	//compositor.check_composite_tristrip = check_composite_traps;
 1297|      1|	compositor.composite_tristrip = composite_tristrip;
 1298|      1|	compositor.check_composite_glyphs = check_composite_glyphs;
 1299|      1|	compositor.composite_glyphs = composite_glyphs;
 1300|       |
 1301|      1|	_cairo_atomic_init_once_leave(&once);
 1302|      1|    }
 1303|       |
 1304|      1|    return &compositor.base;
 1305|      1|}
_cairo_image_spans_compositor_get:
 3144|     69|{
 3145|     69|    static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT;
  ------------------
  |  |  492|     69|#define CAIRO_ATOMIC_ONCE_INIT          CAIRO_ATOMIC_ONCE_UNINITIALIZED
  |  |  ------------------
  |  |  |  |  489|     69|#define CAIRO_ATOMIC_ONCE_UNINITIALIZED (0)
  |  |  ------------------
  ------------------
 3146|     69|    static cairo_spans_compositor_t spans;
 3147|     69|    static cairo_compositor_t shape;
 3148|       |
 3149|     69|    if (_cairo_atomic_init_once_enter(&once)) {
  ------------------
  |  Branch (3149:9): [True: 1, False: 68]
  ------------------
 3150|      1|	_cairo_shape_mask_compositor_init (&shape,
 3151|      1|					   _cairo_image_traps_compositor_get());
 3152|      1|	shape.glyphs = NULL;
 3153|       |
 3154|      1|	_cairo_spans_compositor_init (&spans, &shape);
 3155|       |
 3156|      1|	spans.flags = 0;
 3157|       |#if PIXMAN_HAS_OP_LERP
 3158|       |	spans.flags |= CAIRO_SPANS_COMPOSITOR_HAS_LERP;
 3159|       |#endif
 3160|       |
 3161|       |	//spans.acquire = acquire;
 3162|       |	//spans.release = release;
 3163|      1|	spans.fill_boxes = fill_boxes;
 3164|      1|	spans.draw_image_boxes = draw_image_boxes;
 3165|       |	//spans.copy_boxes = copy_boxes;
 3166|      1|	spans.pattern_to_surface = _cairo_image_source_create_for_pattern;
 3167|       |	//spans.check_composite_boxes = check_composite_boxes;
 3168|      1|	spans.composite_boxes = composite_boxes;
 3169|       |	//spans.check_span_renderer = check_span_renderer;
 3170|      1|	spans.renderer_init = span_renderer_init;
 3171|      1|	spans.renderer_fini = span_renderer_fini;
 3172|       |
 3173|      1|	_cairo_atomic_init_once_leave(&once);
 3174|      1|    }
 3175|       |
 3176|     69|    return &spans.base;
 3177|     69|}

cairo-image-surface.c:_cairo_surface_is_image:
   75|    138|{
   76|       |    /* _cairo_surface_nil sets a NULL backend so be safe */
   77|    138|    return surface->backend && surface->backend->type == CAIRO_SURFACE_TYPE_IMAGE;
  ------------------
  |  Branch (77:12): [True: 138, False: 0]
  |  Branch (77:32): [True: 138, False: 0]
  ------------------
   78|    138|}

_cairo_format_from_pixman_format:
   94|     69|{
   95|     69|    switch (pixman_format) {
   96|     14|    case PIXMAN_rgba_float:
  ------------------
  |  Branch (96:5): [True: 14, False: 55]
  ------------------
   97|     14|	return CAIRO_FORMAT_RGBA128F;
   98|     13|    case PIXMAN_rgb_float:
  ------------------
  |  Branch (98:5): [True: 13, False: 56]
  ------------------
   99|     13|	return CAIRO_FORMAT_RGB96F;
  100|      9|    case PIXMAN_a8r8g8b8:
  ------------------
  |  Branch (100:5): [True: 9, False: 60]
  ------------------
  101|      9|	return CAIRO_FORMAT_ARGB32;
  102|      0|    case PIXMAN_x2r10g10b10:
  ------------------
  |  Branch (102:5): [True: 0, False: 69]
  ------------------
  103|      0|	return CAIRO_FORMAT_RGB30;
  104|     33|    case PIXMAN_x8r8g8b8:
  ------------------
  |  Branch (104:5): [True: 33, False: 36]
  ------------------
  105|     33|	return CAIRO_FORMAT_RGB24;
  106|      0|    case PIXMAN_a8:
  ------------------
  |  Branch (106:5): [True: 0, False: 69]
  ------------------
  107|      0|	return CAIRO_FORMAT_A8;
  108|      0|    case PIXMAN_a1:
  ------------------
  |  Branch (108:5): [True: 0, False: 69]
  ------------------
  109|      0|	return CAIRO_FORMAT_A1;
  110|      0|    case PIXMAN_r5g6b5:
  ------------------
  |  Branch (110:5): [True: 0, False: 69]
  ------------------
  111|      0|	return CAIRO_FORMAT_RGB16_565;
  112|      0|    case PIXMAN_r8g8b8a8: case PIXMAN_r8g8b8x8:
  ------------------
  |  Branch (112:5): [True: 0, False: 69]
  |  Branch (112:27): [True: 0, False: 69]
  ------------------
  113|      0|    case PIXMAN_a8r8g8b8_sRGB:
  ------------------
  |  Branch (113:5): [True: 0, False: 69]
  ------------------
  114|      0|#if HAS_PIXMAN_r8g8b8_sRGB
  115|      0|    case PIXMAN_r8g8b8_sRGB:
  ------------------
  |  Branch (115:5): [True: 0, False: 69]
  ------------------
  116|      0|#endif
  117|      0|    case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: case PIXMAN_r8g8b8:
  ------------------
  |  Branch (117:5): [True: 0, False: 69]
  |  Branch (117:27): [True: 0, False: 69]
  |  Branch (117:49): [True: 0, False: 69]
  ------------------
  118|      0|    case PIXMAN_b8g8r8:   case PIXMAN_b5g6r5:
  ------------------
  |  Branch (118:5): [True: 0, False: 69]
  |  Branch (118:27): [True: 0, False: 69]
  ------------------
  119|      0|    case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5:
  ------------------
  |  Branch (119:5): [True: 0, False: 69]
  |  Branch (119:27): [True: 0, False: 69]
  |  Branch (119:49): [True: 0, False: 69]
  ------------------
  120|      0|    case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4:
  ------------------
  |  Branch (120:5): [True: 0, False: 69]
  |  Branch (120:27): [True: 0, False: 69]
  |  Branch (120:49): [True: 0, False: 69]
  ------------------
  121|      0|    case PIXMAN_a4b4g4r4: case PIXMAN_x4b4g4r4: case PIXMAN_r3g3b2:
  ------------------
  |  Branch (121:5): [True: 0, False: 69]
  |  Branch (121:27): [True: 0, False: 69]
  |  Branch (121:49): [True: 0, False: 69]
  ------------------
  122|      0|    case PIXMAN_b2g3r3:   case PIXMAN_a2r2g2b2: case PIXMAN_a2b2g2r2:
  ------------------
  |  Branch (122:5): [True: 0, False: 69]
  |  Branch (122:27): [True: 0, False: 69]
  |  Branch (122:49): [True: 0, False: 69]
  ------------------
  123|      0|    case PIXMAN_c8:       case PIXMAN_g8:       case PIXMAN_x4a4:
  ------------------
  |  Branch (123:5): [True: 0, False: 69]
  |  Branch (123:27): [True: 0, False: 69]
  |  Branch (123:49): [True: 0, False: 69]
  ------------------
  124|      0|    case PIXMAN_a4:       case PIXMAN_r1g2b1:   case PIXMAN_b1g2r1:
  ------------------
  |  Branch (124:5): [True: 0, False: 69]
  |  Branch (124:27): [True: 0, False: 69]
  |  Branch (124:49): [True: 0, False: 69]
  ------------------
  125|      0|    case PIXMAN_a1r1g1b1: case PIXMAN_a1b1g1r1: case PIXMAN_c4:
  ------------------
  |  Branch (125:5): [True: 0, False: 69]
  |  Branch (125:27): [True: 0, False: 69]
  |  Branch (125:49): [True: 0, False: 69]
  ------------------
  126|      0|    case PIXMAN_g4:       case PIXMAN_g1:
  ------------------
  |  Branch (126:5): [True: 0, False: 69]
  |  Branch (126:27): [True: 0, False: 69]
  ------------------
  127|      0|    case PIXMAN_yuy2:     case PIXMAN_yv12:
  ------------------
  |  Branch (127:5): [True: 0, False: 69]
  |  Branch (127:27): [True: 0, False: 69]
  ------------------
  128|      0|    case PIXMAN_b8g8r8x8:
  ------------------
  |  Branch (128:5): [True: 0, False: 69]
  ------------------
  129|      0|    case PIXMAN_b8g8r8a8:
  ------------------
  |  Branch (129:5): [True: 0, False: 69]
  ------------------
  130|      0|    case PIXMAN_a2b10g10r10:
  ------------------
  |  Branch (130:5): [True: 0, False: 69]
  ------------------
  131|      0|    case PIXMAN_x2b10g10r10:
  ------------------
  |  Branch (131:5): [True: 0, False: 69]
  ------------------
  132|      0|    case PIXMAN_a2r10g10b10:
  ------------------
  |  Branch (132:5): [True: 0, False: 69]
  ------------------
  133|      0|    case PIXMAN_x14r6g6b6:
  ------------------
  |  Branch (133:5): [True: 0, False: 69]
  ------------------
  134|      0|    default:
  ------------------
  |  Branch (134:5): [True: 0, False: 69]
  ------------------
  135|      0|	return CAIRO_FORMAT_INVALID;
  136|     69|    }
  137|       |
  138|      0|    return CAIRO_FORMAT_INVALID;
  139|     69|}
_cairo_content_from_pixman_format:
  143|     69|{
  144|     69|    cairo_content_t content;
  145|       |
  146|     69|    content = 0;
  147|     69|    if (PIXMAN_FORMAT_RGB (pixman_format))
  ------------------
  |  |  850|     69|#define PIXMAN_FORMAT_RGB(f)	(((f)      ) & 0xfff)
  |  |  ------------------
  |  |  |  Branch (850:30): [True: 69, False: 0]
  |  |  ------------------
  ------------------
  148|     69|	content |= CAIRO_CONTENT_COLOR;
  149|     69|    if (PIXMAN_FORMAT_A (pixman_format))
  ------------------
  |  |  846|     69|#define PIXMAN_FORMAT_A(f)	PIXMAN_FORMAT_RESHIFT(f, 12, 4)
  |  |  ------------------
  |  |  |  |  841|     69|	(((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (841:2): [True: 23, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  150|     23|	content |= CAIRO_CONTENT_ALPHA;
  151|       |
  152|     69|    return content;
  153|     69|}
_cairo_image_surface_init:
  159|     69|{
  160|     69|    surface->parent = NULL;
  161|     69|    surface->pixman_image = pixman_image;
  162|       |
  163|     69|    surface->pixman_format = pixman_format;
  164|     69|    surface->format = _cairo_format_from_pixman_format (pixman_format);
  165|     69|    surface->data = (uint8_t *) pixman_image_get_data (pixman_image);
  166|     69|    surface->owns_data = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  167|     69|    surface->transparency = CAIRO_IMAGE_UNKNOWN;
  168|     69|    surface->color = CAIRO_IMAGE_UNKNOWN_COLOR;
  169|       |
  170|     69|    surface->width = pixman_image_get_width (pixman_image);
  171|     69|    surface->height = pixman_image_get_height (pixman_image);
  172|     69|    surface->stride = pixman_image_get_stride (pixman_image);
  173|     69|    surface->depth = pixman_image_get_depth (pixman_image);
  174|       |
  175|     69|    surface->base.is_clear = surface->width == 0 || surface->height == 0;
  ------------------
  |  Branch (175:30): [True: 0, False: 69]
  |  Branch (175:53): [True: 0, False: 69]
  ------------------
  176|       |
  177|     69|    surface->compositor = _cairo_image_spans_compositor_get ();
  178|     69|}
_cairo_image_surface_create_for_pixman_image:
  183|     69|{
  184|     69|    cairo_image_surface_t *surface;
  185|       |
  186|     69|    surface = _cairo_calloc (sizeof (cairo_image_surface_t));
  ------------------
  |  |   79|     69|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [Folded - Ignored]
  |  |  ------------------
  ------------------
  187|     69|    if (unlikely (surface == NULL))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  188|      0|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  189|       |
  190|     69|    _cairo_surface_init (&surface->base,
  191|     69|			 &_cairo_image_surface_backend,
  192|     69|			 NULL, /* device */
  193|     69|			 _cairo_content_from_pixman_format (pixman_format),
  194|     69|			 FALSE); /* is_vector */
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  195|       |
  196|     69|    _cairo_image_surface_init (surface, pixman_image, pixman_format);
  197|       |
  198|     69|    return &surface->base;
  199|     69|}
_cairo_format_to_pixman_format_code:
  326|     69|{
  327|     69|    pixman_format_code_t ret;
  328|     69|    switch (format) {
  329|      0|    case CAIRO_FORMAT_A1:
  ------------------
  |  Branch (329:5): [True: 0, False: 69]
  ------------------
  330|      0|	ret = PIXMAN_a1;
  331|      0|	break;
  332|      0|    case CAIRO_FORMAT_A8:
  ------------------
  |  Branch (332:5): [True: 0, False: 69]
  ------------------
  333|      0|	ret = PIXMAN_a8;
  334|      0|	break;
  335|     33|    case CAIRO_FORMAT_RGB24:
  ------------------
  |  Branch (335:5): [True: 33, False: 36]
  ------------------
  336|     33|	ret = PIXMAN_x8r8g8b8;
  337|     33|	break;
  338|      0|    case CAIRO_FORMAT_RGB30:
  ------------------
  |  Branch (338:5): [True: 0, False: 69]
  ------------------
  339|      0|	ret = PIXMAN_x2r10g10b10;
  340|      0|	break;
  341|      0|    case CAIRO_FORMAT_RGB16_565:
  ------------------
  |  Branch (341:5): [True: 0, False: 69]
  ------------------
  342|      0|	ret = PIXMAN_r5g6b5;
  343|      0|	break;
  344|     13|    case CAIRO_FORMAT_RGB96F:
  ------------------
  |  Branch (344:5): [True: 13, False: 56]
  ------------------
  345|     13|	ret = PIXMAN_rgb_float;
  346|     13|	break;
  347|     14|    case CAIRO_FORMAT_RGBA128F:
  ------------------
  |  Branch (347:5): [True: 14, False: 55]
  ------------------
  348|     14|	ret = PIXMAN_rgba_float;
  349|     14|	break;
  350|      9|    case CAIRO_FORMAT_ARGB32:
  ------------------
  |  Branch (350:5): [True: 9, False: 60]
  ------------------
  351|      9|    case CAIRO_FORMAT_INVALID:
  ------------------
  |  Branch (351:5): [True: 0, False: 69]
  ------------------
  352|      9|    default:
  ------------------
  |  Branch (352:5): [True: 0, False: 69]
  ------------------
  353|      9|	ret = PIXMAN_a8r8g8b8;
  354|      9|	break;
  355|     69|    }
  356|     69|    return ret;
  357|     69|}
_cairo_image_surface_create_with_pixman_format:
  365|     69|{
  366|     69|    cairo_surface_t *surface;
  367|     69|    pixman_image_t *pixman_image;
  368|       |
  369|     69|    if (! _cairo_image_surface_is_size_valid (width, height))
  ------------------
  |  Branch (369:9): [True: 0, False: 69]
  ------------------
  370|      0|    {
  371|      0|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
  372|      0|    }
  373|       |
  374|     69|    pixman_image = pixman_image_create_bits (pixman_format, width, height,
  375|     69|					     (uint32_t *) data, stride);
  376|       |
  377|     69|    if (unlikely (pixman_image == NULL))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  378|      0|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  379|       |
  380|     69|    surface = _cairo_image_surface_create_for_pixman_image (pixman_image,
  381|     69|							    pixman_format);
  382|     69|    if (unlikely (surface->status)) {
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  383|      0|	pixman_image_unref (pixman_image);
  384|      0|	return surface;
  385|      0|    }
  386|       |
  387|       |    /* we can not make any assumptions about the initial state of user data */
  388|     69|    surface->is_clear = data == NULL;
  389|     69|    return surface;
  390|     69|}
cairo_format_stride_for_width:
  469|  1.08k|{
  470|  1.08k|    int bpp;
  471|       |
  472|  1.08k|    if (! CAIRO_FORMAT_VALID (format)) {
  ------------------
  |  | 1559|  1.08k|#define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 &&		\
  |  |  ------------------
  |  |  |  Branch (1559:37): [True: 1.08k, False: 0]
  |  |  ------------------
  |  | 1560|  1.08k|                                    (format) <= CAIRO_FORMAT_RGBA128F)
  |  |  ------------------
  |  |  |  Branch (1560:37): [True: 1.08k, False: 0]
  |  |  ------------------
  ------------------
  473|      0|	_cairo_error_throw (CAIRO_STATUS_INVALID_FORMAT);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  474|      0|	return -1;
  475|      0|    }
  476|       |
  477|  1.08k|    bpp = _cairo_format_bits_per_pixel (format);
  478|  1.08k|    if ((unsigned) (width) >= (INT32_MAX - 7) / (unsigned) (bpp))
  ------------------
  |  Branch (478:9): [True: 0, False: 1.08k]
  ------------------
  479|      0|	return -1;
  480|       |
  481|  1.08k|    return CAIRO_STRIDE_FOR_WIDTH_BPP (width, bpp);
  ------------------
  |  | 1565|  1.08k|   ((((bpp)*(w)+7)/8 + CAIRO_STRIDE_ALIGNMENT-1) & -CAIRO_STRIDE_ALIGNMENT)
  |  |  ------------------
  |  |  |  | 1563|  1.08k|#define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
  |  |  ------------------
  |  |                  ((((bpp)*(w)+7)/8 + CAIRO_STRIDE_ALIGNMENT-1) & -CAIRO_STRIDE_ALIGNMENT)
  |  |  ------------------
  |  |  |  | 1563|  1.08k|#define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
  |  |  ------------------
  ------------------
  482|  1.08k|}
cairo_image_surface_create_for_data:
  535|     71|{
  536|     71|    pixman_format_code_t pixman_format;
  537|     71|    int minstride;
  538|       |
  539|     71|    if (! CAIRO_FORMAT_VALID (format))
  ------------------
  |  | 1559|     71|#define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 &&		\
  |  |  ------------------
  |  |  |  Branch (1559:37): [True: 71, False: 0]
  |  |  ------------------
  |  | 1560|     71|                                    (format) <= CAIRO_FORMAT_RGBA128F)
  |  |  ------------------
  |  |  |  Branch (1560:37): [True: 71, False: 0]
  |  |  ------------------
  ------------------
  540|      0|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
  541|       |
  542|     71|    if ((stride & (CAIRO_STRIDE_ALIGNMENT-1)) != 0)
  ------------------
  |  | 1563|     71|#define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
  ------------------
  |  Branch (542:9): [True: 0, False: 71]
  ------------------
  543|      0|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
  544|       |
  545|     71|    if (! _cairo_image_surface_is_size_valid (width, height))
  ------------------
  |  Branch (545:9): [True: 2, False: 69]
  ------------------
  546|      2|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
  547|       |
  548|     69|    minstride = cairo_format_stride_for_width (format, width);
  549|     69|    if (stride < 0) {
  ------------------
  |  Branch (549:9): [True: 0, False: 69]
  ------------------
  550|      0|	if (stride > -minstride) {
  ------------------
  |  Branch (550:6): [True: 0, False: 0]
  ------------------
  551|      0|	    return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
  552|      0|	}
  553|     69|    } else {
  554|     69|	if (stride < minstride) {
  ------------------
  |  Branch (554:6): [True: 0, False: 69]
  ------------------
  555|      0|	    return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
  556|      0|	}
  557|     69|    }
  558|       |
  559|     69|    pixman_format = _cairo_format_to_pixman_format_code (format);
  560|     69|    return _cairo_image_surface_create_with_pixman_format (data,
  561|     69|							   pixman_format,
  562|     69|							   width, height,
  563|     69|							   stride);
  564|     69|}
cairo_image_surface_get_width:
  632|     69|{
  633|     69|    cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface;
  634|       |
  635|     69|    if (! _cairo_surface_is_image (surface)) {
  ------------------
  |  Branch (635:9): [True: 0, False: 69]
  ------------------
  636|      0|	_cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  637|      0|	return 0;
  638|      0|    }
  639|       |
  640|     69|    return image_surface->width;
  641|     69|}
cairo_image_surface_get_height:
  655|     69|{
  656|     69|    cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface;
  657|       |
  658|     69|    if (! _cairo_surface_is_image (surface)) {
  ------------------
  |  Branch (658:9): [True: 0, False: 69]
  ------------------
  659|      0|	_cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  660|      0|	return 0;
  661|      0|    }
  662|       |
  663|     69|    return image_surface->height;
  664|     69|}
_cairo_format_bits_per_pixel:
  736|  1.08k|{
  737|  1.08k|    switch (format) {
  738|    153|    case CAIRO_FORMAT_RGBA128F:
  ------------------
  |  Branch (738:5): [True: 153, False: 927]
  ------------------
  739|    153|	return 128;
  740|    544|    case CAIRO_FORMAT_RGB96F:
  ------------------
  |  Branch (740:5): [True: 544, False: 536]
  ------------------
  741|    544|	return 96;
  742|    165|    case CAIRO_FORMAT_ARGB32:
  ------------------
  |  Branch (742:5): [True: 165, False: 915]
  ------------------
  743|    165|    case CAIRO_FORMAT_RGB30:
  ------------------
  |  Branch (743:5): [True: 0, False: 1.08k]
  ------------------
  744|    383|    case CAIRO_FORMAT_RGB24:
  ------------------
  |  Branch (744:5): [True: 218, False: 862]
  ------------------
  745|    383|	return 32;
  746|      0|    case CAIRO_FORMAT_RGB16_565:
  ------------------
  |  Branch (746:5): [True: 0, False: 1.08k]
  ------------------
  747|      0|	return 16;
  748|      0|    case CAIRO_FORMAT_A8:
  ------------------
  |  Branch (748:5): [True: 0, False: 1.08k]
  ------------------
  749|      0|	return 8;
  750|      0|    case CAIRO_FORMAT_A1:
  ------------------
  |  Branch (750:5): [True: 0, False: 1.08k]
  ------------------
  751|      0|	return 1;
  752|      0|    case CAIRO_FORMAT_INVALID:
  ------------------
  |  Branch (752:5): [True: 0, False: 1.08k]
  ------------------
  753|      0|    default:
  ------------------
  |  Branch (753:5): [True: 0, False: 1.08k]
  ------------------
  754|      0|	ASSERT_NOT_REACHED;
  ------------------
  |  |  143|      0|#define ASSERT_NOT_REACHED		\
  |  |  144|      0|do {					\
  |  |  145|      0|    assert (!"reached");		\
  |  |  146|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (146:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  755|      0|	return 0;
  756|  1.08k|    }
  757|  1.08k|}
_cairo_image_surface_finish:
  865|     69|{
  866|     69|    cairo_image_surface_t *surface = abstract_surface;
  867|       |
  868|     69|    if (surface->pixman_image) {
  ------------------
  |  Branch (868:9): [True: 69, False: 0]
  ------------------
  869|     69|	pixman_image_unref (surface->pixman_image);
  870|     69|	surface->pixman_image = NULL;
  871|     69|    }
  872|       |
  873|     69|    if (surface->owns_data) {
  ------------------
  |  Branch (873:9): [True: 69, False: 0]
  ------------------
  874|     69|	free (surface->data);
  875|     69|	surface->data = NULL;
  876|     69|    }
  877|       |
  878|     69|    if (surface->parent) {
  ------------------
  |  Branch (878:9): [True: 0, False: 69]
  ------------------
  879|      0|	cairo_surface_t *parent = surface->parent;
  880|      0|	surface->parent = NULL;
  881|      0|	cairo_surface_destroy (parent);
  882|      0|    }
  883|       |
  884|     69|    return CAIRO_STATUS_SUCCESS;
  885|     69|}
_cairo_image_surface_assume_ownership_of_data:
  889|     69|{
  890|     69|    surface->owns_data = TRUE;
  ------------------
  |  |  109|     69|#define TRUE 1
  ------------------
  891|     69|}
cairo-image-surface.c:_cairo_image_surface_is_size_valid:
   87|    140|{
   88|    140|    return 0 <= width  &&  width <= MAX_IMAGE_SIZE &&
  ------------------
  |  |   62|    280|#define MAX_IMAGE_SIZE 32767
  ------------------
  |  Branch (88:12): [True: 140, False: 0]
  |  Branch (88:28): [True: 139, False: 1]
  ------------------
   89|    140|	   0 <= height && height <= MAX_IMAGE_SIZE;
  ------------------
  |  |   62|    139|#define MAX_IMAGE_SIZE 32767
  ------------------
  |  Branch (89:5): [True: 139, False: 0]
  |  Branch (89:20): [True: 138, False: 1]
  ------------------
   90|    140|}

cairo-pattern.c:cairo_list_init:
  187|    138|{
  188|    138|    entry->next = entry;
  189|    138|    entry->prev = entry;
  190|    138|}
cairo-surface.c:cairo_list_init:
  187|    138|{
  188|    138|    entry->next = entry;
  189|    138|    entry->prev = entry;
  190|    138|}
cairo-surface.c:cairo_list_is_empty:
  345|    207|{
  346|    207|    cairo_list_validate (head);
  347|    207|    return head->next == head;
  348|    207|}
cairo-gstate.c:cairo_list_add:
  212|     69|{
  213|     69|    cairo_list_validate (head);
  214|     69|    cairo_list_validate_is_empty (entry);
  215|     69|    __cairo_list_add (entry, head, head->next);
  216|     69|    cairo_list_validate (head);
  217|     69|}
cairo-gstate.c:__cairo_list_add:
  196|     69|{
  197|     69|    next->prev = entry;
  198|     69|    entry->next = next;
  199|     69|    entry->prev = prev;
  200|     69|    prev->next = entry;
  201|     69|}
cairo-gstate.c:cairo_list_del:
  256|     69|{
  257|     69|    _cairo_list_del (entry);
  258|     69|    cairo_list_init (entry);
  259|     69|}
cairo-gstate.c:_cairo_list_del:
  244|     69|{
  245|     69|    __cairo_list_del (entry->prev, entry->next);
  246|     69|}
cairo-gstate.c:__cairo_list_del:
  237|     69|{
  238|     69|    next->prev = prev;
  239|     69|    prev->next = next;
  240|     69|}
cairo-gstate.c:cairo_list_init:
  187|     69|{
  188|     69|    entry->next = entry;
  189|     69|    entry->prev = entry;
  190|     69|}
cairo-path-fixed.c:cairo_list_init:
  187|     69|{
  188|     69|    entry->next = entry;
  189|     69|    entry->prev = entry;
  190|     69|}

cairo-png.c:_cairo_malloc_ab:
  100|  2.02k|{
  101|  2.02k|    size_t c;
  102|  2.02k|    if (_cairo_mul_size_t_overflow (a, size, &c))
  ------------------
  |  |  235|  2.02k|#define _cairo_mul_size_t_overflow(a, b, c)  __builtin_mul_overflow((size_t)(a), (size_t)(b), (size_t*)(c))
  |  |  ------------------
  |  |  |  Branch (235:46): [True: 0, False: 2.02k]
  |  |  ------------------
  ------------------
  103|      0|	return NULL;
  104|       |
  105|  2.02k|    return _cairo_malloc(c);
  ------------------
  |  |   63|  2.02k|   ((size) != 0 ? malloc(size) : NULL)
  |  |  ------------------
  |  |  |  Branch (63:5): [True: 2.02k, False: 0]
  |  |  ------------------
  ------------------
  106|  2.02k|}
cairo-array.c:_cairo_realloc_ab:
  153|  26.8k|{
  154|  26.8k|    size_t c;
  155|  26.8k|    if (_cairo_mul_size_t_overflow (a, size, &c))
  ------------------
  |  |  235|  26.8k|#define _cairo_mul_size_t_overflow(a, b, c)  __builtin_mul_overflow((size_t)(a), (size_t)(b), (size_t*)(c))
  |  |  ------------------
  |  |  |  Branch (235:46): [True: 0, False: 26.8k]
  |  |  ------------------
  ------------------
  156|      0|	return NULL;
  157|       |
  158|  26.8k|    return realloc(ptr, c);
  159|  26.8k|}
cairo-hash.c:_cairo_calloc_ab:
  125|      1|{
  126|      1|    size_t c;
  127|      1|    if (_cairo_mul_size_t_overflow (a, size, &c))
  ------------------
  |  |  235|      1|#define _cairo_mul_size_t_overflow(a, b, c)  __builtin_mul_overflow((size_t)(a), (size_t)(b), (size_t*)(c))
  |  |  ------------------
  |  |  |  Branch (235:46): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  128|      0|	return NULL;
  129|       |
  130|      1|    return _cairo_calloc(c);
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  131|      1|}

cairo_matrix_init_identity:
   82|    276|{
   83|    276|    cairo_matrix_init (matrix,
   84|    276|		       1, 0,
   85|    276|		       0, 1,
   86|    276|		       0, 0);
   87|    276|}
cairo_matrix_init:
  115|    345|{
  116|    345|    matrix->xx = xx; matrix->yx = yx;
  117|    345|    matrix->xy = xy; matrix->yy = yy;
  118|    345|    matrix->x0 = x0; matrix->y0 = y0;
  119|    345|}
cairo_matrix_init_scale:
  217|     69|{
  218|     69|    cairo_matrix_init (matrix,
  219|     69|		       sx,  0,
  220|     69|		       0, sy,
  221|     69|		       0, 0);
  222|     69|}

_cairo_fopen:
  937|  4.74k|{
  938|  4.74k|    FILE *result;
  939|       |#ifdef _WIN32 /* also defined on x86_64 */
  940|       |    uint16_t *filename_w;
  941|       |    uint16_t *mode_w;
  942|       |    cairo_status_t status;
  943|       |
  944|       |    *file_out = NULL;
  945|       |
  946|       |    if (filename == NULL || mode == NULL) {
  947|       |	errno = EINVAL;
  948|       |	return CAIRO_STATUS_SUCCESS;
  949|       |    }
  950|       |
  951|       |    if ((status = _cairo_utf8_to_utf16 (filename, -1, &filename_w, NULL)) != CAIRO_STATUS_SUCCESS) {
  952|       |	errno = EINVAL;
  953|       |	return status;
  954|       |    }
  955|       |
  956|       |    if ((status = _cairo_utf8_to_utf16 (mode, -1, &mode_w, NULL)) != CAIRO_STATUS_SUCCESS) {
  957|       |	free (filename_w);
  958|       |	errno = EINVAL;
  959|       |	return status;
  960|       |    }
  961|       |
  962|       |    result = _wfopen (filename_w, mode_w);
  963|       |
  964|       |    free (filename_w);
  965|       |    free (mode_w);
  966|       |
  967|       |#else /* Use fopen directly */
  968|       |
  969|  4.74k|#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)
  970|       |    /* Glibc 2.7 supports the "e" mode flag that opens the file with O_CLOEXEC.
  971|       |     * this avoid the race condition in the fcntl fallback below. */
  972|       |
  973|  4.74k|    char new_mode[20];
  974|  4.74k|    snprintf (new_mode, sizeof (new_mode), "%s%s", mode, "e");
  975|  4.74k|    result = fopen (filename, new_mode);
  976|       |
  977|       |#else /* fopen "e" not available */
  978|       |
  979|       |    result = fopen (filename, mode);
  980|       |
  981|       |#if defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC)
  982|       |    /* Manually set CLOEXEC */
  983|       |    if (result != NULL) {
  984|       |	int fd = fileno (result);
  985|       |	if (fd != -1) {
  986|       |	    int flags = fcntl (fd, F_GETFD);
  987|       |	    if (flags >= 0)
  988|       |		flags = fcntl (fd, F_SETFD, flags | FD_CLOEXEC);
  989|       |	}
  990|       |    }
  991|       |#endif /* defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) */
  992|       |
  993|       |#endif /* fopen "e" not available */
  994|       |
  995|  4.74k|#endif /* !_WIN32 */
  996|       |
  997|  4.74k|    *file_out = result;
  998|       |
  999|  4.74k|    return CAIRO_STATUS_SUCCESS;
 1000|  4.74k|}
_cairo_string_hash:
 1118|     69|{
 1119|     69|    const signed char *p = (const signed char *) str;
 1120|     69|    unsigned int h = *p;
 1121|       |
 1122|    690|    for (p += 1; len > 0; len--, p++)
  ------------------
  |  Branch (1122:18): [True: 621, False: 69]
  ------------------
 1123|    621|	h = (h << 5) - h + *p;
 1124|       |
 1125|     69|    return h;
 1126|     69|}
_cairo_intern_string:
 1142|     69|{
 1143|     69|    char *str = (char *) *str_inout;
 1144|     69|    cairo_intern_string_t tmpl, *istring;
 1145|     69|    cairo_status_t status = CAIRO_STATUS_SUCCESS;
 1146|       |
 1147|     69|    if (CAIRO_INJECT_FAULT ())
  ------------------
  |  |   47|     69|#define CAIRO_INJECT_FAULT() 0
  |  |  ------------------
  |  |  |  Branch (47:30): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1148|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 1149|       |
 1150|     69|    if (len < 0)
  ------------------
  |  Branch (1150:9): [True: 69, False: 0]
  ------------------
 1151|     69|	len = strlen (str);
 1152|     69|    tmpl.hash_entry.hash = _cairo_string_hash (str, len);
 1153|     69|    tmpl.len = len;
 1154|     69|    tmpl.string = (char *) str;
 1155|       |
 1156|     69|    CAIRO_MUTEX_LOCK (_cairo_intern_string_mutex);
  ------------------
  |  |  175|     69|#define CAIRO_MUTEX_LOCK		CAIRO_MUTEX_IMPL_LOCK
  |  |  ------------------
  |  |  |  |  206|     69|# define CAIRO_MUTEX_IMPL_LOCK(mutex) pthread_mutex_lock (&(mutex))
  |  |  ------------------
  ------------------
 1157|     69|    if (_cairo_intern_string_ht == NULL) {
  ------------------
  |  Branch (1157:9): [True: 1, False: 68]
  ------------------
 1158|      1|	_cairo_intern_string_ht = _cairo_hash_table_create (_intern_string_equal);
 1159|      1|	if (unlikely (_cairo_intern_string_ht == NULL)) {
  ------------------
  |  |  141|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1160|      0|	    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
 1161|      0|	    goto BAIL;
 1162|      0|	}
 1163|      1|    }
 1164|       |
 1165|     69|    istring = _cairo_hash_table_lookup (_cairo_intern_string_ht,
 1166|     69|					&tmpl.hash_entry);
 1167|     69|    if (istring == NULL) {
  ------------------
  |  Branch (1167:9): [True: 1, False: 68]
  ------------------
 1168|      1|	istring = _cairo_malloc (sizeof (cairo_intern_string_t) + len + 1);
  ------------------
  |  |   63|      1|   ((size) != 0 ? malloc(size) : NULL)
  |  |  ------------------
  |  |  |  Branch (63:5): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 1169|      1|	if (likely (istring != NULL)) {
  ------------------
  |  |  140|      1|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (140:22): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 1170|      1|	    istring->hash_entry.hash = tmpl.hash_entry.hash;
 1171|      1|	    istring->len = tmpl.len;
 1172|      1|	    istring->string = (char *) (istring + 1);
 1173|      1|	    memcpy (istring->string, str, len);
 1174|      1|	    istring->string[len] = '\0';
 1175|       |
 1176|      1|	    status = _cairo_hash_table_insert (_cairo_intern_string_ht,
 1177|      1|					       &istring->hash_entry);
 1178|      1|	    if (unlikely (status)) {
  ------------------
  |  |  141|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1179|      0|		free (istring);
 1180|      0|		goto BAIL;
 1181|      0|	    }
 1182|      1|	} else {
 1183|      0|	    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
 1184|      0|	    goto BAIL;
 1185|      0|	}
 1186|      1|    }
 1187|       |
 1188|     69|    *str_inout = istring->string;
 1189|       |
 1190|     69|  BAIL:
 1191|     69|    CAIRO_MUTEX_UNLOCK (_cairo_intern_string_mutex);
  ------------------
  |  |  177|     69|#define CAIRO_MUTEX_UNLOCK		CAIRO_MUTEX_IMPL_UNLOCK
  |  |  ------------------
  |  |  |  |  208|     69|# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
  |  |  ------------------
  ------------------
 1192|     69|    return status;
 1193|     69|}
cairo-misc.c:_intern_string_equal:
 1130|     68|{
 1131|     68|    const cairo_intern_string_t *a = _a;
 1132|     68|    const cairo_intern_string_t *b = _b;
 1133|       |
 1134|     68|    if (a->len != b->len)
  ------------------
  |  Branch (1134:9): [True: 0, False: 68]
  ------------------
 1135|      0|	return FALSE;
  ------------------
  |  |  105|      0|#define FALSE 0
  ------------------
 1136|       |
 1137|     68|    return memcmp (a->string, b->string, a->len) == 0;
 1138|     68|}

_cairo_output_stream_init:
   77|  4.74k|{
   78|  4.74k|    stream->write_func = write_func;
   79|  4.74k|    stream->flush_func = flush_func;
   80|  4.74k|    stream->close_func = close_func;
   81|  4.74k|    stream->position = 0;
   82|  4.74k|    stream->status = CAIRO_STATUS_SUCCESS;
   83|  4.74k|    stream->closed = FALSE;
  ------------------
  |  |  105|  4.74k|#define FALSE 0
  ------------------
   84|  4.74k|}
_cairo_output_stream_fini:
   88|  4.74k|{
   89|  4.74k|    return _cairo_output_stream_close (stream);
   90|  4.74k|}
_cairo_output_stream_close:
  215|  4.74k|{
  216|  4.74k|    cairo_status_t status;
  217|       |
  218|  4.74k|    if (stream->closed)
  ------------------
  |  Branch (218:9): [True: 0, False: 4.74k]
  ------------------
  219|      0|	return stream->status;
  220|       |
  221|  4.74k|    if (stream == &_cairo_output_stream_nil ||
  ------------------
  |  Branch (221:9): [True: 0, False: 4.74k]
  ------------------
  222|  4.74k|	stream == &_cairo_output_stream_nil_write_error)
  ------------------
  |  Branch (222:2): [True: 0, False: 4.74k]
  ------------------
  223|      0|    {
  224|      0|	return stream->status;
  225|      0|    }
  226|       |
  227|  4.74k|    if (stream->close_func) {
  ------------------
  |  Branch (227:9): [True: 4.74k, False: 0]
  ------------------
  228|  4.74k|	status = stream->close_func (stream);
  229|       |	/* Don't overwrite a pre-existing status failure. */
  230|  4.74k|	if (stream->status == CAIRO_STATUS_SUCCESS)
  ------------------
  |  Branch (230:6): [True: 4.74k, False: 0]
  ------------------
  231|  4.74k|	    stream->status = status;
  232|  4.74k|    }
  233|       |
  234|  4.74k|    stream->closed = TRUE;
  ------------------
  |  |  109|  4.74k|#define TRUE 1
  ------------------
  235|       |
  236|  4.74k|    return stream->status;
  237|  4.74k|}
_cairo_output_stream_destroy:
  241|  4.74k|{
  242|  4.74k|    cairo_status_t status;
  243|       |
  244|  4.74k|    assert (stream != NULL);
  245|       |
  246|  4.74k|    if (stream == &_cairo_output_stream_nil ||
  ------------------
  |  Branch (246:9): [True: 0, False: 4.74k]
  ------------------
  247|  4.74k|	stream == &_cairo_output_stream_nil_write_error)
  ------------------
  |  Branch (247:2): [True: 0, False: 4.74k]
  ------------------
  248|      0|    {
  249|      0|	return stream->status;
  250|      0|    }
  251|       |
  252|  4.74k|    status = _cairo_output_stream_fini (stream);
  253|  4.74k|    free (stream);
  254|       |
  255|  4.74k|    return status;
  256|  4.74k|}
_cairo_output_stream_write:
  261|  1.34M|{
  262|  1.34M|    if (length == 0 || stream->status)
  ------------------
  |  Branch (262:9): [True: 43.7k, False: 1.29M]
  |  Branch (262:24): [True: 0, False: 1.29M]
  ------------------
  263|  43.7k|	return;
  264|       |
  265|  1.29M|    if (stream->closed) {
  ------------------
  |  Branch (265:9): [True: 0, False: 1.29M]
  ------------------
  266|      0|	stream->status = CAIRO_STATUS_WRITE_ERROR;
  267|      0|	return;
  268|      0|    }
  269|       |
  270|  1.29M|    stream->status = stream->write_func (stream, data, length);
  271|  1.29M|    stream->position += length;
  272|  1.29M|}
_cairo_memory_stream_create:
  738|  4.74k|{
  739|  4.74k|    memory_stream_t *stream;
  740|       |
  741|  4.74k|    stream = _cairo_calloc (sizeof *stream);
  ------------------
  |  |   79|  4.74k|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [Folded - Ignored]
  |  |  ------------------
  ------------------
  742|  4.74k|    if (unlikely (stream == NULL)) {
  ------------------
  |  |  141|  4.74k|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 4.74k]
  |  |  ------------------
  ------------------
  743|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  744|      0|	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
  745|      0|    }
  746|       |
  747|  4.74k|    _cairo_output_stream_init (&stream->base, memory_write, NULL, memory_close);
  748|  4.74k|    _cairo_array_init (&stream->array, 1);
  749|       |
  750|  4.74k|    return &stream->base;
  751|  4.74k|}
_cairo_memory_stream_destroy:
  757|     69|{
  758|     69|    memory_stream_t *stream;
  759|     69|    cairo_status_t status;
  760|       |
  761|     69|    status = abstract_stream->status;
  762|     69|    if (unlikely (status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  763|      0|	return _cairo_output_stream_destroy (abstract_stream);
  764|       |
  765|     69|    stream = (memory_stream_t *) abstract_stream;
  766|       |
  767|     69|    *length_out = _cairo_array_num_elements (&stream->array);
  768|     69|    *data_out = _cairo_calloc (*length_out);
  ------------------
  |  |   79|     69|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 69, False: 0]
  |  |  ------------------
  ------------------
  769|     69|    if (unlikely (*data_out == NULL)) {
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  770|      0|	status = _cairo_output_stream_destroy (abstract_stream);
  771|      0|	assert (status == CAIRO_STATUS_SUCCESS);
  772|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  773|      0|    }
  774|     69|    memcpy (*data_out, _cairo_array_index (&stream->array, 0), *length_out);
  775|       |
  776|     69|    return _cairo_output_stream_destroy (abstract_stream);
  777|     69|}
cairo-output-stream.c:memory_write:
  720|  1.29M|{
  721|  1.29M|    memory_stream_t *stream = (memory_stream_t *) base;
  722|       |
  723|  1.29M|    return _cairo_array_append_multiple (&stream->array, data, length);
  724|  1.29M|}
cairo-output-stream.c:memory_close:
  728|  4.74k|{
  729|  4.74k|    memory_stream_t *stream = (memory_stream_t *) base;
  730|       |
  731|  4.74k|    _cairo_array_fini (&stream->array);
  732|       |
  733|  4.74k|    return CAIRO_STATUS_SUCCESS;
  734|  4.74k|}

_cairo_surface_is_paginated:
  142|     69|{
  143|     69|    return surface->backend == &cairo_paginated_surface_backend;
  144|     69|}

_cairo_path_fixed_init:
   74|     69|{
   75|     69|    VG (VALGRIND_MAKE_MEM_UNDEFINED (path, sizeof (cairo_path_fixed_t)));
   76|       |
   77|     69|    cairo_list_init (&path->buf.base.link);
   78|       |
   79|     69|    path->buf.base.num_ops = 0;
   80|     69|    path->buf.base.num_points = 0;
   81|     69|    path->buf.base.size_ops = ARRAY_LENGTH (path->buf.op);
  ------------------
  |  |  125|     69|#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
  ------------------
   82|     69|    path->buf.base.size_points = ARRAY_LENGTH (path->buf.points);
  ------------------
  |  |  125|     69|#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
  ------------------
   83|     69|    path->buf.base.op = path->buf.op;
   84|     69|    path->buf.base.points = path->buf.points;
   85|       |
   86|     69|    path->current_point.x = 0;
   87|     69|    path->current_point.y = 0;
   88|     69|    path->last_move_point = path->current_point;
   89|       |
   90|     69|    path->has_current_point = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
   91|     69|    path->needs_move_to = TRUE;
  ------------------
  |  |  109|     69|#define TRUE 1
  ------------------
   92|     69|    path->has_extents = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
   93|     69|    path->has_curve_to = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
   94|     69|    path->stroke_is_rectilinear = TRUE;
  ------------------
  |  |  109|     69|#define TRUE 1
  ------------------
   95|     69|    path->fill_is_rectilinear = TRUE;
  ------------------
  |  |  109|     69|#define TRUE 1
  ------------------
   96|     69|    path->fill_maybe_region = TRUE;
  ------------------
  |  |  109|     69|#define TRUE 1
  ------------------
   97|     69|    path->fill_is_empty = TRUE;
  ------------------
  |  |  109|     69|#define TRUE 1
  ------------------
   98|       |
   99|     69|    path->extents.p1.x = path->extents.p1.y = 0;
  100|     69|    path->extents.p2.x = path->extents.p2.y = 0;
  101|     69|}
_cairo_path_fixed_fini:
  340|     69|{
  341|     69|    cairo_path_buf_t *buf;
  342|       |
  343|     69|    buf = cairo_path_buf_next (cairo_path_head (path));
  ------------------
  |  |   66|     69|    cairo_list_entry ((pos__)->link.next, cairo_path_buf_t, link)
  |  |  ------------------
  |  |  |  |   51|     69|	cairo_container_of(ptr, type, member)
  |  |  |  |  ------------------
  |  |  |  |  |  |  133|     69|#define cairo_container_of(ptr, type, member) ({ \
  |  |  |  |  |  |  134|     69|    const __typeof__ (((type *) 0)->member) *mptr__ = (ptr); \
  |  |  |  |  |  |  135|     69|    (type *) ((char *) mptr__ - offsetof (type, member)); \
  |  |  |  |  |  |  136|     69|})
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  344|     69|    while (buf != cairo_path_head (path)) {
  ------------------
  |  |   62|     69|#define cairo_path_head(path__) (&(path__)->buf.base)
  ------------------
  |  Branch (344:12): [True: 0, False: 69]
  ------------------
  345|      0|	cairo_path_buf_t *this = buf;
  346|      0|	buf = cairo_path_buf_next (buf);
  ------------------
  |  |   66|      0|    cairo_list_entry ((pos__)->link.next, cairo_path_buf_t, link)
  |  |  ------------------
  |  |  |  |   51|      0|	cairo_container_of(ptr, type, member)
  |  |  |  |  ------------------
  |  |  |  |  |  |  133|      0|#define cairo_container_of(ptr, type, member) ({ \
  |  |  |  |  |  |  134|      0|    const __typeof__ (((type *) 0)->member) *mptr__ = (ptr); \
  |  |  |  |  |  |  135|      0|    (type *) ((char *) mptr__ - offsetof (type, member)); \
  |  |  |  |  |  |  136|      0|})
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  347|      0|	_cairo_path_buf_destroy (this);
  348|      0|    }
  349|       |
  350|     69|    VG (VALGRIND_MAKE_MEM_UNDEFINED (path, sizeof (cairo_path_fixed_t)));
  351|     69|}

_cairo_pattern_init:
  212|     69|{
  213|       |#if HAVE_VALGRIND
  214|       |    switch (type) {
  215|       |    case CAIRO_PATTERN_TYPE_SOLID:
  216|       |	VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_solid_pattern_t));
  217|       |	break;
  218|       |    case CAIRO_PATTERN_TYPE_SURFACE:
  219|       |	VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_surface_pattern_t));
  220|       |	break;
  221|       |    case CAIRO_PATTERN_TYPE_LINEAR:
  222|       |	VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_linear_pattern_t));
  223|       |	break;
  224|       |    case CAIRO_PATTERN_TYPE_RADIAL:
  225|       |	VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_radial_pattern_t));
  226|       |	break;
  227|       |    case CAIRO_PATTERN_TYPE_MESH:
  228|       |	VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_mesh_pattern_t));
  229|       |	break;
  230|       |    case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
  231|       |	break;
  232|       |    }
  233|       |#endif
  234|       |
  235|     69|    pattern->type      = type;
  236|     69|    pattern->status    = CAIRO_STATUS_SUCCESS;
  237|       |
  238|       |    /* Set the reference count to zero for on-stack patterns.
  239|       |     * Callers needs to explicitly increment the count for heap allocations. */
  240|     69|    CAIRO_REFERENCE_COUNT_INIT (&pattern->ref_count, 0);
  ------------------
  |  |   51|     69|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
  241|       |
  242|     69|    _cairo_user_data_array_init (&pattern->user_data);
  243|       |
  244|     69|    if (type == CAIRO_PATTERN_TYPE_SURFACE ||
  ------------------
  |  Branch (244:9): [True: 0, False: 69]
  ------------------
  245|     69|	type == CAIRO_PATTERN_TYPE_RASTER_SOURCE)
  ------------------
  |  Branch (245:2): [True: 69, False: 0]
  ------------------
  246|     69|	pattern->extend = CAIRO_EXTEND_SURFACE_DEFAULT;
  ------------------
  |  |  671|     69|#define CAIRO_EXTEND_SURFACE_DEFAULT CAIRO_EXTEND_NONE
  ------------------
  247|      0|    else
  248|      0|	pattern->extend = CAIRO_EXTEND_GRADIENT_DEFAULT;
  ------------------
  |  |  672|      0|#define CAIRO_EXTEND_GRADIENT_DEFAULT CAIRO_EXTEND_PAD
  ------------------
  249|       |
  250|     69|    pattern->filter    = CAIRO_FILTER_DEFAULT;
  ------------------
  |  |  673|     69|#define CAIRO_FILTER_DEFAULT CAIRO_FILTER_GOOD
  ------------------
  251|     69|    pattern->opacity   = 1.0;
  252|       |
  253|     69|    pattern->has_component_alpha = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  254|     69|    pattern->is_foreground_marker = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  255|       |
  256|     69|    pattern->dither    = CAIRO_DITHER_DEFAULT;
  257|       |
  258|     69|    cairo_matrix_init_identity (&pattern->matrix);
  259|       |
  260|     69|    cairo_list_init (&pattern->observers);
  261|     69|}
_cairo_pattern_init_static_copy:
  389|     69|{
  390|     69|    int size;
  391|       |
  392|     69|    assert (other->status == CAIRO_STATUS_SUCCESS);
  393|       |
  394|     69|    switch (other->type) {
  395|      0|    default:
  ------------------
  |  Branch (395:5): [True: 0, False: 69]
  ------------------
  396|      0|	ASSERT_NOT_REACHED;
  ------------------
  |  |  143|      0|#define ASSERT_NOT_REACHED		\
  |  |  144|      0|do {					\
  |  |  145|      0|    assert (!"reached");		\
  |  |  146|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (146:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  397|      0|    case CAIRO_PATTERN_TYPE_SOLID:
  ------------------
  |  Branch (397:5): [True: 0, False: 69]
  ------------------
  398|      0|	size = sizeof (cairo_solid_pattern_t);
  399|      0|	break;
  400|      0|    case CAIRO_PATTERN_TYPE_SURFACE:
  ------------------
  |  Branch (400:5): [True: 0, False: 69]
  ------------------
  401|      0|	size = sizeof (cairo_surface_pattern_t);
  402|      0|	break;
  403|      0|    case CAIRO_PATTERN_TYPE_LINEAR:
  ------------------
  |  Branch (403:5): [True: 0, False: 69]
  ------------------
  404|      0|	size = sizeof (cairo_linear_pattern_t);
  405|      0|	break;
  406|      0|    case CAIRO_PATTERN_TYPE_RADIAL:
  ------------------
  |  Branch (406:5): [True: 0, False: 69]
  ------------------
  407|      0|	size = sizeof (cairo_radial_pattern_t);
  408|      0|	break;
  409|      0|    case CAIRO_PATTERN_TYPE_MESH:
  ------------------
  |  Branch (409:5): [True: 0, False: 69]
  ------------------
  410|      0|	size = sizeof (cairo_mesh_pattern_t);
  411|      0|	break;
  412|     69|    case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
  ------------------
  |  Branch (412:5): [True: 69, False: 0]
  ------------------
  413|     69|	size = sizeof (cairo_raster_source_pattern_t);
  414|     69|	break;
  415|     69|    }
  416|       |
  417|     69|    memcpy (pattern, other, size);
  418|       |
  419|     69|    CAIRO_REFERENCE_COUNT_INIT (&pattern->ref_count, 0);
  ------------------
  |  |   51|     69|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
  420|     69|    _cairo_user_data_array_init (&pattern->user_data);
  421|     69|    cairo_list_init (&pattern->observers);
  422|     69|}
_cairo_pattern_fini:
  456|     69|{
  457|     69|    _cairo_user_data_array_fini (&pattern->user_data);
  458|       |
  459|     69|    switch (pattern->type) {
  ------------------
  |  Branch (459:13): [True: 0, False: 69]
  ------------------
  460|      0|    case CAIRO_PATTERN_TYPE_SOLID:
  ------------------
  |  Branch (460:5): [True: 0, False: 69]
  ------------------
  461|      0|	break;
  462|      0|    case CAIRO_PATTERN_TYPE_SURFACE: {
  ------------------
  |  Branch (462:5): [True: 0, False: 69]
  ------------------
  463|      0|	cairo_surface_pattern_t *surface_pattern =
  464|      0|	    (cairo_surface_pattern_t *) pattern;
  465|       |
  466|      0|	cairo_surface_destroy (surface_pattern->surface);
  467|      0|    } break;
  468|      0|    case CAIRO_PATTERN_TYPE_LINEAR:
  ------------------
  |  Branch (468:5): [True: 0, False: 69]
  ------------------
  469|      0|    case CAIRO_PATTERN_TYPE_RADIAL: {
  ------------------
  |  Branch (469:5): [True: 0, False: 69]
  ------------------
  470|      0|	cairo_gradient_pattern_t *gradient =
  471|      0|	    (cairo_gradient_pattern_t *) pattern;
  472|       |
  473|      0|	if (gradient->stops && gradient->stops != gradient->stops_embedded)
  ------------------
  |  Branch (473:6): [True: 0, False: 0]
  |  Branch (473:25): [True: 0, False: 0]
  ------------------
  474|      0|	    free (gradient->stops);
  475|      0|    } break;
  476|      0|    case CAIRO_PATTERN_TYPE_MESH: {
  ------------------
  |  Branch (476:5): [True: 0, False: 69]
  ------------------
  477|      0|	cairo_mesh_pattern_t *mesh =
  478|      0|	    (cairo_mesh_pattern_t *) pattern;
  479|       |
  480|      0|	_cairo_array_fini (&mesh->patches);
  481|      0|    } break;
  482|     69|    case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
  ------------------
  |  Branch (482:5): [True: 69, False: 0]
  ------------------
  483|     69|	_cairo_raster_source_pattern_finish (pattern);
  484|     69|	break;
  485|     69|    }
  486|       |
  487|       |#if HAVE_VALGRIND
  488|       |    switch (pattern->type) {
  489|       |    case CAIRO_PATTERN_TYPE_SOLID:
  490|       |	VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_solid_pattern_t));
  491|       |	break;
  492|       |    case CAIRO_PATTERN_TYPE_SURFACE:
  493|       |	VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_surface_pattern_t));
  494|       |	break;
  495|       |    case CAIRO_PATTERN_TYPE_LINEAR:
  496|       |	VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_linear_pattern_t));
  497|       |	break;
  498|       |    case CAIRO_PATTERN_TYPE_RADIAL:
  499|       |	VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_radial_pattern_t));
  500|       |	break;
  501|       |    case CAIRO_PATTERN_TYPE_MESH:
  502|       |	VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_mesh_pattern_t));
  503|       |	break;
  504|       |    case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
  505|       |	break;
  506|       |    }
  507|       |#endif
  508|     69|}
cairo_pattern_reference:
 1088|     69|{
 1089|     69|    if (pattern == NULL ||
  ------------------
  |  Branch (1089:9): [True: 0, False: 69]
  ------------------
 1090|     69|	    CAIRO_REFERENCE_COUNT_IS_INVALID (&pattern->ref_count))
  ------------------
  |  |   58|     69|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|     69|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|     69|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1091|      0|	return pattern;
 1092|       |
 1093|     69|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&pattern->ref_count));
 1094|       |
 1095|     69|    _cairo_reference_count_inc (&pattern->ref_count);
  ------------------
  |  |   47|     69|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|     69|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
 1096|       |
 1097|     69|    return pattern;
 1098|     69|}
cairo_pattern_destroy:
 1148|    207|{
 1149|    207|    cairo_pattern_type_t type;
 1150|       |
 1151|    207|    if (pattern == NULL ||
  ------------------
  |  Branch (1151:9): [True: 0, False: 207]
  ------------------
 1152|    207|	    CAIRO_REFERENCE_COUNT_IS_INVALID (&pattern->ref_count))
  ------------------
  |  |   58|    207|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|    207|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|    207|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 69, False: 138]
  |  |  ------------------
  ------------------
 1153|     69|	return;
 1154|       |
 1155|    138|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&pattern->ref_count));
 1156|       |
 1157|    138|    if (! _cairo_reference_count_dec_and_test (&pattern->ref_count))
  ------------------
  |  |   49|    138|#define _cairo_reference_count_dec_and_test(RC) _cairo_atomic_int_dec_and_test (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   85|    138|# define _cairo_atomic_int_dec_and_test(x) (atomic_fetch_sub_explicit(x, 1, memory_order_seq_cst) == 1)
  |  |  ------------------
  ------------------
  |  Branch (1157:9): [True: 69, False: 69]
  ------------------
 1158|     69|	return;
 1159|       |
 1160|     69|    type = pattern->type;
 1161|     69|    _cairo_pattern_fini (pattern);
 1162|       |
 1163|       |    /* maintain a small cache of freed patterns */
 1164|     69|    if (type < ARRAY_LENGTH (freed_pattern_pool))
  ------------------
  |  |  125|     69|#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
  ------------------
  |  Branch (1164:9): [True: 0, False: 69]
  ------------------
 1165|      0|	_freed_pool_put (&freed_pattern_pool[type], pattern);
 1166|     69|    else
 1167|     69|	free (pattern);
 1168|     69|}
_cairo_pattern_is_clear:
 3434|     69|{
 3435|     69|    const cairo_pattern_union_t *pattern;
 3436|       |
 3437|     69|    if (abstract_pattern->has_component_alpha)
  ------------------
  |  Branch (3437:9): [True: 0, False: 69]
  ------------------
 3438|      0|	return FALSE;
  ------------------
  |  |  105|      0|#define FALSE 0
  ------------------
 3439|       |
 3440|     69|    pattern = (cairo_pattern_union_t *) abstract_pattern;
 3441|     69|    switch (abstract_pattern->type) {
  ------------------
  |  Branch (3441:13): [True: 0, False: 69]
  ------------------
 3442|      0|    case CAIRO_PATTERN_TYPE_SOLID:
  ------------------
  |  Branch (3442:5): [True: 0, False: 69]
  ------------------
 3443|      0|	return CAIRO_COLOR_IS_CLEAR (&pattern->solid.color);
  ------------------
  |  |  159|      0|#define CAIRO_COLOR_IS_CLEAR(color) CAIRO_ALPHA_SHORT_IS_CLEAR ((color)->alpha_short)
  |  |  ------------------
  |  |  |  |  153|      0|#define CAIRO_ALPHA_SHORT_IS_CLEAR(alpha) ((alpha) <= 0x00ff)
  |  |  ------------------
  ------------------
 3444|      0|    case CAIRO_PATTERN_TYPE_SURFACE:
  ------------------
  |  Branch (3444:5): [True: 0, False: 69]
  ------------------
 3445|      0|	return _surface_is_clear (&pattern->surface);
 3446|     69|    case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
  ------------------
  |  Branch (3446:5): [True: 69, False: 0]
  ------------------
 3447|     69|	return _raster_source_is_clear (&pattern->raster_source);
 3448|      0|    case CAIRO_PATTERN_TYPE_LINEAR:
  ------------------
  |  Branch (3448:5): [True: 0, False: 69]
  ------------------
 3449|      0|    case CAIRO_PATTERN_TYPE_RADIAL:
  ------------------
  |  Branch (3449:5): [True: 0, False: 69]
  ------------------
 3450|      0|	return _gradient_is_clear (&pattern->gradient.base, NULL);
 3451|      0|    case CAIRO_PATTERN_TYPE_MESH:
  ------------------
  |  Branch (3451:5): [True: 0, False: 69]
  ------------------
 3452|      0|	return _mesh_is_clear (&pattern->mesh);
 3453|     69|    }
 3454|       |
 3455|      0|    ASSERT_NOT_REACHED;
  ------------------
  |  |  143|      0|#define ASSERT_NOT_REACHED		\
  |  |  144|      0|do {					\
  |  |  145|      0|    assert (!"reached");		\
  |  |  146|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (146:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3456|      0|    return FALSE;
  ------------------
  |  |  105|      0|#define FALSE 0
  ------------------
 3457|      0|}
cairo-pattern.c:_raster_source_is_clear:
 3345|     69|{
 3346|     69|    return pattern->extents.width == 0 || pattern->extents.height == 0;
  ------------------
  |  Branch (3346:12): [True: 0, False: 69]
  |  Branch (3346:43): [True: 0, False: 69]
  ------------------
 3347|     69|}

cairo_pdf_surface_set_metadata:
  922|     69|{
  923|     69|    cairo_pdf_surface_t *pdf_surface = NULL; /* hide compiler warning */
  924|     69|    cairo_status_t status;
  925|       |
  926|     69|    if (! _extract_pdf_surface (surface, &pdf_surface))
  ------------------
  |  Branch (926:9): [True: 69, False: 0]
  ------------------
  927|     69|	return;
  928|       |
  929|      0|    status = _cairo_pdf_interchange_set_metadata (pdf_surface, metadata, utf8);
  930|      0|    if (status)
  ------------------
  |  Branch (930:9): [True: 0, False: 0]
  ------------------
  931|      0|	status = _cairo_surface_set_error (surface, status);
  932|      0|}
cairo_pdf_surface_set_page_label:
  982|     69|{
  983|     69|    cairo_pdf_surface_t *pdf_surface = NULL; /* hide compiler warning */
  984|       |
  985|     69|    if (! _extract_pdf_surface (surface, &pdf_surface))
  ------------------
  |  Branch (985:9): [True: 69, False: 0]
  ------------------
  986|     69|	return;
  987|       |
  988|      0|    free (pdf_surface->current_page_label);
  989|      0|    pdf_surface->current_page_label = utf8 ? strdup (utf8) : NULL;
  ------------------
  |  Branch (989:39): [True: 0, False: 0]
  ------------------
  990|      0|}
cairo-pdf-surface.c:_extract_pdf_surface:
  694|    138|{
  695|    138|    cairo_surface_t *target;
  696|    138|    cairo_status_t status_ignored;
  697|       |
  698|    138|    if (surface->status)
  ------------------
  |  Branch (698:9): [True: 69, False: 69]
  ------------------
  699|     69|	return FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  700|     69|    if (surface->finished) {
  ------------------
  |  Branch (700:9): [True: 0, False: 69]
  ------------------
  701|      0|	status_ignored = _cairo_surface_set_error (surface,
  702|      0|						   _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
  703|      0|        return FALSE;
  ------------------
  |  |  105|      0|#define FALSE 0
  ------------------
  704|      0|    }
  705|       |
  706|     69|    if (! _cairo_surface_is_paginated (surface)) {
  ------------------
  |  Branch (706:9): [True: 69, False: 0]
  ------------------
  707|     69|	status_ignored = _cairo_surface_set_error (surface,
  708|     69|						   _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
  709|     69|	return FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  710|     69|    }
  711|       |
  712|      0|    target = _cairo_paginated_surface_get_target (surface);
  713|      0|    if (target->status) {
  ------------------
  |  Branch (713:9): [True: 0, False: 0]
  ------------------
  714|      0|	status_ignored = _cairo_surface_set_error (surface,
  715|      0|						   target->status);
  716|      0|	return FALSE;
  ------------------
  |  |  105|      0|#define FALSE 0
  ------------------
  717|      0|    }
  718|      0|    if (target->finished) {
  ------------------
  |  Branch (718:9): [True: 0, False: 0]
  ------------------
  719|      0|	status_ignored = _cairo_surface_set_error (surface,
  720|      0|						   _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
  721|      0|	return FALSE;
  ------------------
  |  |  105|      0|#define FALSE 0
  ------------------
  722|      0|    }
  723|       |
  724|      0|    if (! _cairo_surface_is_pdf (target)) {
  ------------------
  |  Branch (724:9): [True: 0, False: 0]
  ------------------
  725|      0|	status_ignored = _cairo_surface_set_error (surface,
  726|      0|						   _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
  727|      0|	return FALSE;
  ------------------
  |  |  105|      0|#define FALSE 0
  ------------------
  728|      0|    }
  729|       |
  730|      0|    *pdf_surface = (cairo_pdf_surface_t *) target;
  731|      0|    return TRUE;
  ------------------
  |  |  109|      0|#define TRUE 1
  ------------------
  732|      0|}

cairo_image_surface_create_from_png:
  915|  4.74k|{
  916|  4.74k|    struct png_read_closure_t png_closure;
  917|  4.74k|    cairo_surface_t *surface;
  918|  4.74k|    cairo_status_t status;
  919|       |
  920|  4.74k|    status = _cairo_fopen (filename, "rb", (FILE **) &png_closure.closure);
  921|       |
  922|  4.74k|    if (status != CAIRO_STATUS_SUCCESS)
  ------------------
  |  Branch (922:9): [True: 0, False: 4.74k]
  ------------------
  923|      0|	return _cairo_surface_create_in_error (status);
  924|       |
  925|  4.74k|    if (png_closure.closure == NULL) {
  ------------------
  |  Branch (925:9): [True: 0, False: 4.74k]
  ------------------
  926|      0|	switch (errno) {
  927|      0|	case ENOMEM:
  ------------------
  |  Branch (927:2): [True: 0, False: 0]
  ------------------
  928|      0|	    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
  929|      0|	    break;
  930|      0|	case ENOENT:
  ------------------
  |  Branch (930:2): [True: 0, False: 0]
  ------------------
  931|      0|	    status = _cairo_error (CAIRO_STATUS_FILE_NOT_FOUND);
  932|      0|	    break;
  933|      0|	default:
  ------------------
  |  Branch (933:2): [True: 0, False: 0]
  ------------------
  934|      0|	    status = _cairo_error (CAIRO_STATUS_READ_ERROR);
  935|      0|	    break;
  936|      0|	}
  937|      0|	return _cairo_surface_create_in_error (status);
  938|      0|    }
  939|       |
  940|  4.74k|    png_closure.read_func = stdio_read_func;
  941|       |
  942|  4.74k|    surface = read_png (&png_closure);
  943|       |
  944|  4.74k|    fclose (png_closure.closure);
  945|       |
  946|  4.74k|    return surface;
  947|  4.74k|}
cairo-png.c:png_simple_error_callback:
  212|  4.67k|{
  213|  4.67k|    cairo_status_t *error = png_get_error_ptr (png);
  214|       |
  215|       |    /* default to the most likely error */
  216|  4.67k|    if (*error == CAIRO_STATUS_SUCCESS)
  ------------------
  |  Branch (216:9): [True: 302, False: 4.37k]
  ------------------
  217|    302|	*error = _cairo_error (CAIRO_STATUS_PNG_ERROR);
  218|       |
  219|  4.67k|#ifdef PNG_SETJMP_SUPPORTED
  220|  4.67k|    longjmp (png_jmpbuf (png), 1);
  ------------------
  |  |  952|  4.67k|      (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))
  ------------------
  221|  4.67k|#endif
  222|       |
  223|       |    /* if we get here, then we have to choice but to abort ... */
  224|  4.67k|}
cairo-png.c:png_simple_warning_callback:
  229|   107k|{
  230|       |    /* png does not expect to abort and will try to tidy up and continue
  231|       |     * loading the image after a warning. So we also want to return the
  232|       |     * (incorrect?) surface.
  233|       |     *
  234|       |     * We use our own warning callback to squelch any attempts by libpng
  235|       |     * to write to stderr as we may not be in control of that output.
  236|       |     */
  237|   107k|}
cairo-png.c:stdio_read_func:
  631|  1.34M|{
  632|  1.34M|    FILE *file = closure;
  633|       |
  634|  2.64M|    while (size) {
  ------------------
  |  Branch (634:12): [True: 1.30M, False: 1.34M]
  ------------------
  635|  1.30M|	size_t ret;
  636|       |
  637|  1.30M|	ret = fread (data, 1, size, file);
  638|  1.30M|	size -= ret;
  639|  1.30M|	data += ret;
  640|       |
  641|  1.30M|	if (size && (feof (file) || ferror (file)))
  ------------------
  |  Branch (641:6): [True: 4.37k, False: 1.29M]
  |  Branch (641:15): [True: 4.37k, False: 0]
  |  Branch (641:30): [True: 0, False: 0]
  ------------------
  642|  4.37k|	    return _cairo_error (CAIRO_STATUS_READ_ERROR);
  643|  1.30M|    }
  644|       |
  645|  1.34M|    return CAIRO_STATUS_SUCCESS;
  646|  1.34M|}
cairo-png.c:read_png:
  668|  4.74k|{
  669|  4.74k|    cairo_surface_t * volatile surface;
  670|  4.74k|    png_struct *png = NULL;
  671|  4.74k|    png_info *info;
  672|  4.74k|    png_byte * volatile data = NULL;
  673|  4.74k|    png_byte ** volatile row_pointers = NULL;
  674|  4.74k|    png_uint_32 png_width, png_height;
  675|  4.74k|    int depth, color_type, interlace, stride;
  676|  4.74k|    unsigned int i;
  677|  4.74k|    cairo_format_t format;
  678|  4.74k|    cairo_status_t status;
  679|  4.74k|    unsigned char *mime_data;
  680|  4.74k|    unsigned long mime_data_length;
  681|       |
  682|  4.74k|    png_closure->png_data = _cairo_memory_stream_create ();
  683|       |
  684|       |    /* XXX: Perhaps we'll want some other error handlers? */
  685|  4.74k|    png = png_create_read_struct (PNG_LIBPNG_VER_STRING,
  ------------------
  |  |  278|  4.74k|#define PNG_LIBPNG_VER_STRING "1.6.43"
  ------------------
  686|  4.74k|                                  &status,
  687|  4.74k|	                          png_simple_error_callback,
  688|  4.74k|	                          png_simple_warning_callback);
  689|  4.74k|    if (unlikely (png == NULL)) {
  ------------------
  |  |  141|  4.74k|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 4.74k]
  |  |  ------------------
  ------------------
  690|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  691|      0|	goto BAIL;
  692|      0|    }
  693|       |
  694|  4.74k|    info = png_create_info_struct (png);
  695|  4.74k|    if (unlikely (info == NULL)) {
  ------------------
  |  |  141|  4.74k|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 4.74k]
  |  |  ------------------
  ------------------
  696|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  697|      0|	goto BAIL;
  698|      0|    }
  699|       |
  700|  4.74k|    png_set_read_fn (png, png_closure, stream_read_func);
  701|       |
  702|  4.74k|    status = CAIRO_STATUS_SUCCESS;
  703|  4.74k|#ifdef PNG_SETJMP_SUPPORTED
  704|  4.74k|    if (setjmp (png_jmpbuf (png))) {
  705|  4.67k|	surface = _cairo_surface_create_in_error (status);
  706|  4.67k|	goto BAIL;
  707|  4.67k|    }
  708|     71|#endif
  709|       |
  710|     71|    png_read_info (png, info);
  711|       |
  712|     71|#ifndef WORDS_BIGENDIAN
  713|       |    /* libpng treats 16-bit data as big-endian by default. Swapping the
  714|       |     * byte-order on little endian ensures the native-endian data can be
  715|       |     * provided to png_read_image. This does not affect 8-bit data.
  716|       |     */
  717|     71|    png_set_swap (png);
  718|     71|#endif
  719|       |
  720|     71|    png_get_IHDR (png, info,
  721|     71|                  &png_width, &png_height, &depth,
  722|     71|                  &color_type, &interlace, NULL, NULL);
  723|     71|    if (unlikely (status)) { /* catch any early warnings */
  ------------------
  |  |  141|     71|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 71]
  |  |  ------------------
  ------------------
  724|      0|	surface = _cairo_surface_create_in_error (status);
  725|      0|	goto BAIL;
  726|      0|    }
  727|       |
  728|       |    /* convert palette/gray image to rgb */
  729|     71|    if (color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|     71|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|     71|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|     71|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (729:9): [True: 84, False: 18.4E]
  ------------------
  730|     84|        png_set_palette_to_rgb (png);
  731|       |
  732|       |    /* expand gray bit depth if needed */
  733|     71|    if (color_type == PNG_COLOR_TYPE_GRAY)
  ------------------
  |  |  667|     71|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (733:9): [True: 132, False: 18.4E]
  ------------------
  734|    132|        png_set_expand_gray_1_2_4_to_8 (png);
  735|       |
  736|       |    /* transform transparency to alpha */
  737|     71|    if (png_get_valid (png, info, PNG_INFO_tRNS))
  ------------------
  |  |  735|     71|#define PNG_INFO_tRNS 0x0010U
  ------------------
  |  Branch (737:9): [True: 216, False: 18.4E]
  ------------------
  738|    216|        png_set_tRNS_to_alpha (png);
  739|       |
  740|     71|    if (depth < 8)
  ------------------
  |  Branch (740:9): [True: 134, False: 18.4E]
  ------------------
  741|    134|        png_set_packing (png);
  742|       |
  743|       |    /* convert grayscale to RGB */
  744|     71|    if (color_type == PNG_COLOR_TYPE_GRAY ||
  ------------------
  |  |  667|    142|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (744:9): [True: 18.4E, False: 879]
  ------------------
  745|    879|	color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
  ------------------
  |  |  671|    879|#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|    879|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (745:2): [True: 31, False: 848]
  ------------------
  746|    163|    {
  747|    163|	png_set_gray_to_rgb (png);
  748|    163|    }
  749|       |
  750|     71|    if (interlace != PNG_INTERLACE_NONE)
  ------------------
  |  |  686|     71|#define PNG_INTERLACE_NONE        0 /* Non-interlaced image */
  ------------------
  |  Branch (750:9): [True: 710, False: 18.4E]
  ------------------
  751|    710|        png_set_interlace_handling (png);
  752|       |
  753|     71|    png_set_filler (png, 0xff, PNG_FILLER_AFTER);
  ------------------
  |  | 1248|     71|#  define PNG_FILLER_AFTER 1
  ------------------
  754|       |
  755|       |    /* recheck header after setting EXPAND options */
  756|     71|    png_read_update_info (png, info);
  757|     71|    png_get_IHDR (png, info,
  758|     71|                  &png_width, &png_height, &depth,
  759|     71|                  &color_type, &interlace, NULL, NULL);
  760|    670|    if ((depth != 8 && depth != 16) ||
  ------------------
  |  Branch (760:10): [True: 670, False: 18.4E]
  |  Branch (760:24): [True: 0, False: 670]
  ------------------
  761|  1.01k|	! (color_type == PNG_COLOR_TYPE_RGB ||
  ------------------
  |  |  669|  2.02k|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|  1.01k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (761:5): [True: 716, False: 295]
  ------------------
  762|  1.01k|	   color_type == PNG_COLOR_TYPE_RGB_ALPHA))
  ------------------
  |  |  670|    295|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|    295|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|    295|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (762:5): [True: 295, False: 0]
  ------------------
  763|      0|    {
  764|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_READ_ERROR));
  765|      0|	goto BAIL;
  766|      0|    }
  767|       |
  768|     71|    switch (color_type) {
  769|      0|	default:
  ------------------
  |  Branch (769:2): [True: 0, False: 71]
  ------------------
  770|      0|	    ASSERT_NOT_REACHED;
  ------------------
  |  |  143|      0|#define ASSERT_NOT_REACHED		\
  |  |  144|      0|do {					\
  |  |  145|      0|    assert (!"reached");		\
  |  |  146|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (146:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  771|       |	    /* fall-through just in case ;-) */
  772|       |
  773|    295|	case PNG_COLOR_TYPE_RGB_ALPHA:
  ------------------
  |  |  670|    295|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|    295|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|    295|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (773:2): [True: 295, False: 18.4E]
  ------------------
  774|    295|	    if (depth == 8) {
  ------------------
  |  Branch (774:10): [True: 156, False: 139]
  ------------------
  775|    156|		format = CAIRO_FORMAT_ARGB32;
  776|    156|		png_set_read_user_transform_fn (png, premultiply_data);
  777|    156|	    } else {
  778|    139|		format = CAIRO_FORMAT_RGBA128F;
  779|    139|	    }
  780|    295|	    break;
  781|       |
  782|    716|	case PNG_COLOR_TYPE_RGB:
  ------------------
  |  |  669|    716|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|    716|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (782:2): [True: 716, False: 18.4E]
  ------------------
  783|    716|	    if (depth == 8) {
  ------------------
  |  Branch (783:10): [True: 185, False: 531]
  ------------------
  784|    185|		format = CAIRO_FORMAT_RGB24;
  785|    185|		png_set_read_user_transform_fn (png, convert_bytes_to_data);
  786|    531|	    } else {
  787|    531|		format = CAIRO_FORMAT_RGB96F;
  788|    531|	    }
  789|    716|	    break;
  790|     71|    }
  791|       |
  792|  1.01k|    stride = cairo_format_stride_for_width (format, png_width);
  793|  1.01k|    if (stride < 0) {
  ------------------
  |  Branch (793:9): [True: 0, False: 1.01k]
  ------------------
  794|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
  795|      0|	goto BAIL;
  796|      0|    }
  797|       |
  798|  1.01k|    data = _cairo_malloc_ab (png_height, stride);
  799|  1.01k|    if (unlikely (data == NULL)) {
  ------------------
  |  |  141|  1.01k|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1.01k]
  |  |  ------------------
  ------------------
  800|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  801|      0|	goto BAIL;
  802|      0|    }
  803|       |
  804|  1.01k|    row_pointers = _cairo_malloc_ab (png_height, sizeof (char *));
  805|  1.01k|    if (unlikely (row_pointers == NULL)) {
  ------------------
  |  |  141|  1.01k|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1.01k]
  |  |  ------------------
  ------------------
  806|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  807|      0|	goto BAIL;
  808|      0|    }
  809|       |
  810|  5.19M|    for (i = 0; i < png_height; i++)
  ------------------
  |  Branch (810:17): [True: 5.19M, False: 1.01k]
  ------------------
  811|  5.19M|        row_pointers[i] = &data[i * (ptrdiff_t)stride];
  812|       |
  813|  1.01k|    png_read_image (png, row_pointers);
  814|  1.01k|    png_read_end (png, info);
  815|       |
  816|  1.01k|    if (unlikely (status)) { /* catch any late warnings - probably hit an error already */
  ------------------
  |  |  141|  1.01k|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1.01k]
  |  |  ------------------
  ------------------
  817|      0|	surface = _cairo_surface_create_in_error (status);
  818|      0|	goto BAIL;
  819|      0|    }
  820|       |
  821|  1.01k|    if (format == CAIRO_FORMAT_RGBA128F) {
  ------------------
  |  Branch (821:9): [True: 14, False: 997]
  ------------------
  822|     14|	i = png_height;
  823|       |
  824|    676|	while (i--) {
  ------------------
  |  Branch (824:9): [True: 662, False: 14]
  ------------------
  825|    662|	    float *float_line = (float *)row_pointers[i];
  826|    662|	    uint16_t *u16_line = (uint16_t *)row_pointers[i];
  827|       |
  828|    662|	    premultiply_float (float_line, u16_line, png_width);
  829|    662|	}
  830|    997|    } else if (format == CAIRO_FORMAT_RGB96F) {
  ------------------
  |  Branch (830:16): [True: 13, False: 984]
  ------------------
  831|     13|	i = png_height;
  832|       |
  833|    926|	while (i--) {
  ------------------
  |  Branch (833:9): [True: 913, False: 13]
  ------------------
  834|    913|	    float *float_line = (float *)row_pointers[i];
  835|    913|	    uint16_t *u16_line = (uint16_t *)row_pointers[i];
  836|       |
  837|    913|	    convert_u16_to_float (float_line, u16_line, png_width);
  838|    913|	}
  839|     13|    }
  840|       |
  841|  1.01k|    surface = cairo_image_surface_create_for_data (data, format,
  842|  1.01k|						   png_width, png_height,
  843|  1.01k|						   stride);
  844|  1.01k|    if (surface->status)
  ------------------
  |  Branch (844:9): [True: 2, False: 1.00k]
  ------------------
  845|      2|	goto BAIL;
  846|       |
  847|  1.00k|    _cairo_image_surface_assume_ownership_of_data ((cairo_image_surface_t*)surface);
  848|  1.00k|    data = NULL;
  849|       |
  850|  1.00k|    _cairo_debug_check_image_surface_is_defined (surface);
  851|       |
  852|  1.00k|    status = _cairo_memory_stream_destroy (png_closure->png_data,
  853|  1.00k|					   &mime_data,
  854|  1.00k|					   &mime_data_length);
  855|  1.00k|    png_closure->png_data = NULL;
  856|  1.00k|    if (unlikely (status)) {
  ------------------
  |  |  141|  1.00k|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1.00k]
  |  |  ------------------
  ------------------
  857|      0|	cairo_surface_destroy (surface);
  858|      0|	surface = _cairo_surface_create_in_error (status);
  859|      0|	goto BAIL;
  860|      0|    }
  861|       |
  862|  1.00k|    status = cairo_surface_set_mime_data (surface,
  863|  1.00k|					  CAIRO_MIME_TYPE_PNG,
  ------------------
  |  | 2621|  1.00k|#define CAIRO_MIME_TYPE_PNG "image/png"
  ------------------
  864|  1.00k|					  mime_data,
  865|  1.00k|					  mime_data_length,
  866|  1.00k|					  free,
  867|  1.00k|					  mime_data);
  868|  1.00k|    if (unlikely (status)) {
  ------------------
  |  |  141|  1.00k|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 1.00k]
  |  |  ------------------
  ------------------
  869|      0|	free (mime_data);
  870|      0|	cairo_surface_destroy (surface);
  871|      0|	surface = _cairo_surface_create_in_error (status);
  872|      0|	goto BAIL;
  873|      0|    }
  874|       |
  875|  4.74k| BAIL:
  876|  4.74k|    free (row_pointers);
  877|  4.74k|    free (data);
  878|  4.74k|    if (png != NULL)
  ------------------
  |  Branch (878:9): [True: 4.74k, False: 0]
  ------------------
  879|  4.74k|	png_destroy_read_struct (&png, &info, NULL);
  880|  4.74k|    if (png_closure->png_data != NULL) {
  ------------------
  |  Branch (880:9): [True: 4.67k, False: 69]
  ------------------
  881|  4.67k|	cairo_status_t status_ignored;
  882|       |
  883|  4.67k|	status_ignored = _cairo_output_stream_destroy (png_closure->png_data);
  884|  4.67k|    }
  885|       |
  886|  4.74k|    return surface;
  887|  1.00k|}
cairo-png.c:stream_read_func:
  650|  1.34M|{
  651|  1.34M|    cairo_status_t status;
  652|  1.34M|    struct png_read_closure_t *png_closure;
  653|       |
  654|  1.34M|    png_closure = png_get_io_ptr (png);
  655|  1.34M|    status = png_closure->read_func (png_closure->closure, data, size);
  656|  1.34M|    if (unlikely (status)) {
  ------------------
  |  |  141|  1.34M|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 4.37k, False: 1.34M]
  |  |  ------------------
  ------------------
  657|  4.37k|	cairo_status_t *error = png_get_error_ptr (png);
  658|  4.37k|	if (*error == CAIRO_STATUS_SUCCESS)
  ------------------
  |  Branch (658:6): [True: 4.37k, False: 0]
  ------------------
  659|  4.37k|	    *error = status;
  660|  4.37k|	png_error (png, NULL);
  661|  4.37k|    }
  662|       |
  663|  1.34M|    _cairo_output_stream_write (png_closure->png_data, data, size);
  664|  1.34M|}
cairo-png.c:premultiply_data:
  585|  68.1k|{
  586|  68.1k|    unsigned int i;
  587|       |
  588|   891k|    for (i = 0; i < row_info->rowbytes; i += 4) {
  ------------------
  |  Branch (588:17): [True: 823k, False: 68.1k]
  ------------------
  589|   823k|	uint8_t *base  = &data[i];
  590|   823k|	uint8_t  alpha = base[3];
  591|   823k|	uint32_t p;
  592|       |
  593|   823k|	if (alpha == 0) {
  ------------------
  |  Branch (593:6): [True: 178k, False: 644k]
  ------------------
  594|   178k|	    p = 0;
  595|   644k|	} else {
  596|   644k|	    uint8_t  red   = base[0];
  597|   644k|	    uint8_t  green = base[1];
  598|   644k|	    uint8_t  blue  = base[2];
  599|       |
  600|   644k|	    if (alpha != 0xff) {
  ------------------
  |  Branch (600:10): [True: 256k, False: 388k]
  ------------------
  601|   256k|		red   = multiply_alpha (alpha, red);
  602|   256k|		green = multiply_alpha (alpha, green);
  603|   256k|		blue  = multiply_alpha (alpha, blue);
  604|   256k|	    }
  605|   644k|	    p = ((uint32_t)alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
  606|   644k|	}
  607|   823k|	memcpy (base, &p, sizeof (uint32_t));
  608|   823k|    }
  609|  68.1k|}
cairo-png.c:multiply_alpha:
  575|   768k|{
  576|   768k|    int temp = (alpha * color) + 0x80;
  577|   768k|    return ((temp + (temp >> 8)) >> 8);
  578|   768k|}
cairo-png.c:convert_bytes_to_data:
  614|  15.3k|{
  615|  15.3k|    unsigned int i;
  616|       |
  617|  12.9M|    for (i = 0; i < row_info->rowbytes; i += 4) {
  ------------------
  |  Branch (617:17): [True: 12.9M, False: 15.3k]
  ------------------
  618|  12.9M|	uint8_t *base  = &data[i];
  619|  12.9M|	uint8_t  red   = base[0];
  620|  12.9M|	uint8_t  green = base[1];
  621|  12.9M|	uint8_t  blue  = base[2];
  622|  12.9M|	uint32_t pixel;
  623|       |
  624|  12.9M|	pixel = (0xffu << 24) | (red << 16) | (green << 8) | (blue << 0);
  625|  12.9M|	memcpy (base, &pixel, sizeof (uint32_t));
  626|  12.9M|    }
  627|  15.3k|}
cairo-png.c:premultiply_float:
  147|    662|{
  148|    662|    unsigned int i = width;
  149|       |
  150|       |    /* Convert d16 in place back to float */
  151|  1.72k|    while (i--) {
  ------------------
  |  Branch (151:12): [True: 1.06k, False: 662]
  ------------------
  152|  1.06k|	float a = d16[i * 4 + 3] / 65535.f;
  153|       |
  154|  1.06k|	f[i * 4 + 3] = a;
  155|  1.06k|	f[i * 4 + 2] = (float)d16[i * 4 + 2] / 65535.f * a;
  156|  1.06k|	f[i * 4 + 1] = (float)d16[i * 4 + 1] / 65535.f * a;
  157|  1.06k|	f[i * 4] = (float)d16[i * 4] / 65535.f * a;
  158|  1.06k|    }
  159|    662|}
cairo-png.c:convert_u16_to_float:
  162|    913|{
  163|       |    /* Convert d16 in place back to float */
  164|    913|    unsigned int i = width;
  165|       |
  166|  3.03k|    while (i--) {
  ------------------
  |  Branch (166:12): [True: 2.12k, False: 913]
  ------------------
  167|  2.12k|	f[i * 3 + 2] = (float)d16[i * 4 + 2] / 65535.f;
  168|  2.12k|	f[i * 3 + 1] = (float)d16[i * 4 + 1] / 65535.f;
  169|  2.12k|	f[i * 3] = (float)d16[i * 4] / 65535.f;
  170|  2.12k|    }
  171|    913|}

_cairo_raster_source_pattern_finish:
  125|     69|{
  126|     69|    cairo_raster_source_pattern_t *pattern =
  127|     69|	(cairo_raster_source_pattern_t *) abstract_pattern;
  128|       |
  129|     69|    if (pattern->finish == NULL)
  ------------------
  |  Branch (129:9): [True: 69, False: 0]
  ------------------
  130|     69|	return;
  131|       |
  132|      0|    pattern->finish (&pattern->base, pattern->user_data);
  133|      0|}
cairo_pattern_create_raster_source:
  160|     69|{
  161|     69|    cairo_raster_source_pattern_t *pattern;
  162|       |
  163|     69|    CAIRO_MUTEX_INITIALIZE ();
  ------------------
  |  |  173|     69|#define CAIRO_MUTEX_INITIALIZE		CAIRO_MUTEX_IMPL_INITIALIZE
  |  |  ------------------
  |  |  |  |   88|     69|#  define CAIRO_MUTEX_IMPL_INITIALIZE() CAIRO_MUTEX_IMPL_NOOP
  |  |  |  |  ------------------
  |  |  |  |  |  |   53|     69|#define CAIRO_MUTEX_IMPL_NOOP	do {/*no-op*/} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (53:53): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  164|       |
  165|     69|    if (width < 0 || height < 0)
  ------------------
  |  Branch (165:9): [True: 0, False: 69]
  |  Branch (165:22): [True: 0, False: 69]
  ------------------
  166|      0|	return _cairo_pattern_create_in_error (CAIRO_STATUS_INVALID_SIZE);
  167|       |
  168|     69|    if (! CAIRO_CONTENT_VALID (content))
  ------------------
  |  | 1567|     69|#define CAIRO_CONTENT_VALID(content) ((content) && 			         \
  |  |  ------------------
  |  |  |  Branch (1567:39): [True: 69, False: 0]
  |  |  ------------------
  |  | 1568|     69|				      (((content) & ~(CAIRO_CONTENT_COLOR |      \
  |  |  ------------------
  |  |  |  Branch (1568:11): [True: 69, False: 0]
  |  |  ------------------
  |  | 1569|     69|						      CAIRO_CONTENT_ALPHA |      \
  |  | 1570|     69|						      CAIRO_CONTENT_COLOR_ALPHA))\
  |  | 1571|     69|				       == 0))
  ------------------
  169|      0|	return _cairo_pattern_create_in_error (CAIRO_STATUS_INVALID_CONTENT);
  170|       |
  171|     69|    pattern = _cairo_calloc (sizeof (*pattern));
  ------------------
  |  |   79|     69|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [Folded - Ignored]
  |  |  ------------------
  ------------------
  172|     69|    if (unlikely (pattern == NULL))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  173|      0|	return _cairo_pattern_create_in_error (CAIRO_STATUS_NO_MEMORY);
  174|       |
  175|     69|    _cairo_pattern_init (&pattern->base,
  176|     69|			 CAIRO_PATTERN_TYPE_RASTER_SOURCE);
  177|     69|    CAIRO_REFERENCE_COUNT_INIT (&pattern->base.ref_count, 1);
  ------------------
  |  |   51|     69|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
  178|       |
  179|     69|    pattern->content = content;
  180|       |
  181|     69|    pattern->extents.x = 0;
  182|     69|    pattern->extents.y = 0;
  183|     69|    pattern->extents.width  = width;
  184|     69|    pattern->extents.height = height;
  185|       |
  186|     69|    pattern->user_data = user_data;
  187|       |
  188|     69|    return &pattern->base;
  189|     69|}
cairo_raster_source_pattern_set_acquire:
  258|     69|{
  259|     69|    cairo_raster_source_pattern_t *pattern;
  260|       |
  261|     69|    if (abstract_pattern->type != CAIRO_PATTERN_TYPE_RASTER_SOURCE)
  ------------------
  |  Branch (261:9): [True: 0, False: 69]
  ------------------
  262|      0|	return;
  263|       |
  264|     69|    pattern = (cairo_raster_source_pattern_t *) abstract_pattern;
  265|     69|    pattern->acquire = acquire;
  266|     69|    pattern->release = release;
  267|     69|}

cairo_scaled_font_destroy:
 1347|    138|{
 1348|    138|    cairo_scaled_font_t *lru = NULL;
 1349|    138|    cairo_scaled_font_map_t *font_map;
 1350|       |
 1351|    138|    assert (CAIRO_MUTEX_IS_UNLOCKED (_cairo_scaled_font_map_mutex));
 1352|       |
 1353|    138|    if (scaled_font == NULL ||
  ------------------
  |  Branch (1353:9): [True: 138, False: 0]
  ------------------
 1354|    138|	    CAIRO_REFERENCE_COUNT_IS_INVALID (&scaled_font->ref_count))
  ------------------
  |  |   58|      0|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|      0|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|      0|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1355|    138|	return;
 1356|       |
 1357|      0|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&scaled_font->ref_count));
 1358|       |
 1359|      0|    font_map = _cairo_scaled_font_map_lock ();
 1360|      0|    assert (font_map != NULL);
 1361|       |
 1362|      0|    if (! _cairo_reference_count_dec_and_test (&scaled_font->ref_count))
  ------------------
  |  |   49|      0|#define _cairo_reference_count_dec_and_test(RC) _cairo_atomic_int_dec_and_test (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   85|      0|# define _cairo_atomic_int_dec_and_test(x) (atomic_fetch_sub_explicit(x, 1, memory_order_seq_cst) == 1)
  |  |  ------------------
  ------------------
  |  Branch (1362:9): [True: 0, False: 0]
  ------------------
 1363|      0|	goto unlock;
 1364|       |
 1365|      0|    assert (! scaled_font->cache_frozen);
 1366|      0|    assert (! scaled_font->global_cache_frozen);
 1367|       |
 1368|       |    /* Another thread may have resurrected the font whilst we waited */
 1369|      0|    if (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&scaled_font->ref_count)) {
  ------------------
  |  |   60|      0|#define CAIRO_REFERENCE_COUNT_HAS_REFERENCE(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) > 0)
  |  |  ------------------
  |  |  |  |   53|      0|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  ------------------
  |  Branch (1369:9): [True: 0, False: 0]
  ------------------
 1370|      0|	if (! scaled_font->placeholder &&
  ------------------
  |  Branch (1370:6): [True: 0, False: 0]
  ------------------
 1371|      0|	    scaled_font->hash_entry.hash != ZOMBIE)
  ------------------
  |  |  236|      0|#define ZOMBIE 0
  ------------------
  |  Branch (1371:6): [True: 0, False: 0]
  ------------------
 1372|      0|	{
 1373|       |	    /* Another thread may have already inserted us into the holdovers */
 1374|      0|	    if (scaled_font->holdover)
  ------------------
  |  Branch (1374:10): [True: 0, False: 0]
  ------------------
 1375|      0|		goto unlock;
 1376|       |
 1377|       |	    /* Rather than immediately destroying this object, we put it into
 1378|       |	     * the font_map->holdovers array in case it will get used again
 1379|       |	     * soon (and is why we must hold the lock over the atomic op on
 1380|       |	     * the reference count). To make room for it, we do actually
 1381|       |	     * destroy the least-recently-used holdover.
 1382|       |	     */
 1383|       |
 1384|      0|	    if (font_map->num_holdovers == CAIRO_SCALED_FONT_MAX_HOLDOVERS) {
  ------------------
  |  |  361|      0|#define CAIRO_SCALED_FONT_MAX_HOLDOVERS 256
  ------------------
  |  Branch (1384:10): [True: 0, False: 0]
  ------------------
 1385|      0|		lru = font_map->holdovers[0];
 1386|      0|		assert (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&lru->ref_count));
 1387|       |
 1388|      0|		_cairo_hash_table_remove (font_map->hash_table,
 1389|      0|					  &lru->hash_entry);
 1390|       |
 1391|      0|		font_map->num_holdovers--;
 1392|      0|		memmove (&font_map->holdovers[0],
 1393|      0|			 &font_map->holdovers[1],
 1394|      0|			 font_map->num_holdovers * sizeof (cairo_scaled_font_t*));
 1395|      0|	    }
 1396|       |
 1397|      0|	    font_map->holdovers[font_map->num_holdovers++] = scaled_font;
 1398|      0|	    scaled_font->holdover = TRUE;
  ------------------
  |  |  109|      0|#define TRUE 1
  ------------------
 1399|      0|	} else
 1400|      0|	    lru = scaled_font;
 1401|      0|    }
 1402|       |
 1403|      0|  unlock:
 1404|      0|    _cairo_scaled_font_map_unlock ();
 1405|       |
 1406|       |    /* If we pulled an item from the holdovers array, (while the font
 1407|       |     * map lock was held, of course), then there is no way that anyone
 1408|       |     * else could have acquired a reference to it. So we can now
 1409|       |     * safely call fini on it without any lock held. This is desirable
 1410|       |     * as we never want to call into any backend function with a lock
 1411|       |     * held. */
 1412|      0|    if (lru != NULL) {
  ------------------
  |  Branch (1412:9): [True: 0, False: 0]
  ------------------
 1413|      0|	_cairo_scaled_font_fini_internal (lru);
 1414|      0|	free (lru);
 1415|      0|    }
 1416|      0|}

_cairo_shape_mask_compositor_init:
  332|      1|{
  333|      1|    compositor->delegate = delegate;
  334|       |
  335|      1|    compositor->paint  = NULL;
  336|      1|    compositor->mask   = NULL;
  337|      1|    compositor->fill   = _cairo_shape_mask_compositor_fill;
  338|      1|    compositor->stroke = _cairo_shape_mask_compositor_stroke;
  339|      1|    compositor->glyphs = _cairo_shape_mask_compositor_glyphs;
  340|      1|}

_cairo_spans_compositor_init:
 1193|      1|{
 1194|      1|    compositor->base.delegate = delegate;
 1195|       |
 1196|      1|    compositor->base.paint  = _cairo_spans_compositor_paint;
 1197|      1|    compositor->base.mask   = _cairo_spans_compositor_mask;
 1198|      1|    compositor->base.fill   = _cairo_spans_compositor_fill;
 1199|      1|    compositor->base.stroke = _cairo_spans_compositor_stroke;
 1200|      1|    compositor->base.glyphs = NULL;
 1201|      1|}

_cairo_stroke_style_init:
   41|     69|{
   42|     69|    VG (VALGRIND_MAKE_MEM_UNDEFINED (style, sizeof (cairo_stroke_style_t)));
   43|       |
   44|     69|    style->line_width = CAIRO_GSTATE_LINE_WIDTH_DEFAULT;
  ------------------
  |  |  728|     69|#define CAIRO_GSTATE_LINE_WIDTH_DEFAULT	2.0
  ------------------
   45|     69|    style->line_cap = CAIRO_GSTATE_LINE_CAP_DEFAULT;
  ------------------
  |  |  729|     69|#define CAIRO_GSTATE_LINE_CAP_DEFAULT	CAIRO_LINE_CAP_BUTT
  ------------------
   46|     69|    style->line_join = CAIRO_GSTATE_LINE_JOIN_DEFAULT;
  ------------------
  |  |  730|     69|#define CAIRO_GSTATE_LINE_JOIN_DEFAULT	CAIRO_LINE_JOIN_MITER
  ------------------
   47|     69|    style->miter_limit = CAIRO_GSTATE_MITER_LIMIT_DEFAULT;
  ------------------
  |  |  731|     69|#define CAIRO_GSTATE_MITER_LIMIT_DEFAULT	10.0
  ------------------
   48|       |
   49|     69|    style->dash = NULL;
   50|     69|    style->num_dashes = 0;
   51|     69|    style->dash_offset = 0.0;
   52|       |
   53|     69|    style->is_hairline = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
   54|     69|}
_cairo_stroke_style_fini:
   92|     69|{
   93|     69|    free (style->dash);
   94|     69|    style->dash = NULL;
   95|       |
   96|     69|    style->num_dashes = 0;
   97|       |
   98|     69|    VG (VALGRIND_MAKE_MEM_UNDEFINED (style, sizeof (cairo_stroke_style_t)));
   99|     69|}

cairo-surface.c:__cairo_surface_flush:
   45|     69|{
   46|     69|    cairo_status_t status = CAIRO_STATUS_SUCCESS;
   47|     69|    if (surface->backend->flush)
  ------------------
  |  Branch (47:9): [True: 0, False: 69]
  ------------------
   48|      0|	status = surface->backend->flush (surface, flags);
   49|     69|    return status;
   50|     69|}

_cairo_surface_set_error:
  193|     69|{
  194|       |    /* NOTHING_TO_DO is magic. We use it to break out of the inner-most
  195|       |     * surface function, but anything higher just sees "success".
  196|       |     */
  197|     69|    if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
  ------------------
  |  Branch (197:9): [True: 0, False: 69]
  ------------------
  198|      0|	status = CAIRO_INT_STATUS_SUCCESS;
  199|       |
  200|     69|    if (status == CAIRO_INT_STATUS_SUCCESS ||
  ------------------
  |  Branch (200:9): [True: 0, False: 69]
  ------------------
  201|     69|        status >= (int)CAIRO_INT_STATUS_LAST_STATUS)
  ------------------
  |  Branch (201:9): [True: 0, False: 69]
  ------------------
  202|      0|        return status;
  203|       |
  204|       |    /* Don't overwrite an existing error. This preserves the first
  205|       |     * error, which is the most significant. */
  206|     69|    _cairo_status_set_error (&surface->status, (cairo_status_t)status);
  ------------------
  |  |  477|     69|#define _cairo_status_set_error(status, err) do { \
  |  |  478|     69|    int ret__; \
  |  |  479|     69|    assert (err < CAIRO_STATUS_LAST_STATUS); \
  |  |  480|     69|    assert (sizeof(*status) == sizeof(cairo_atomic_int_t)); \
  |  |  481|     69|    /* hide compiler warnings about cairo_status_t != int (gcc treats its as \
  |  |  482|     69|     * an unsigned integer instead, and about ignoring the return value. */  \
  |  |  483|     69|    ret__ = _cairo_atomic_int_cmpxchg ((cairo_atomic_int_t *) status, CAIRO_STATUS_SUCCESS, err); \
  |  |  ------------------
  |  |  |  |   98|     69|  _cairo_atomic_int_cmpxchg_impl(x, oldv, newv)
  |  |  ------------------
  |  |  484|     69|    (void) ret__; \
  |  |  485|     69|} while (0)
  |  |  ------------------
  |  |  |  Branch (485:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  207|       |
  208|     69|    return _cairo_error (status);
  209|     69|}
cairo_surface_get_content:
  246|     69|{
  247|     69|    return surface->content;
  248|     69|}
cairo_surface_status:
  266|  4.74k|{
  267|  4.74k|    return surface->status;
  268|  4.74k|}
_cairo_surface_init:
  412|     69|{
  413|     69|    CAIRO_MUTEX_INITIALIZE ();
  ------------------
  |  |  173|     69|#define CAIRO_MUTEX_INITIALIZE		CAIRO_MUTEX_IMPL_INITIALIZE
  |  |  ------------------
  |  |  |  |   88|     69|#  define CAIRO_MUTEX_IMPL_INITIALIZE() CAIRO_MUTEX_IMPL_NOOP
  |  |  |  |  ------------------
  |  |  |  |  |  |   53|     69|#define CAIRO_MUTEX_IMPL_NOOP	do {/*no-op*/} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (53:53): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  414|       |
  415|     69|    surface->backend = backend;
  416|     69|    surface->device = cairo_device_reference (device);
  417|     69|    surface->content = content;
  418|     69|    surface->type = backend->type;
  419|     69|    surface->is_vector = is_vector;
  420|       |
  421|     69|    CAIRO_REFERENCE_COUNT_INIT (&surface->ref_count, 1);
  ------------------
  |  |   51|     69|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
  422|     69|    surface->status = CAIRO_STATUS_SUCCESS;
  423|     69|    surface->unique_id = _cairo_surface_allocate_unique_id ();
  424|     69|    surface->finished = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  425|     69|    surface->_finishing = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  426|     69|    surface->is_clear = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  427|     69|    surface->serial = 0;
  428|     69|    surface->damage = NULL;
  429|     69|    surface->owns_device = (device != NULL);
  430|       |
  431|     69|    _cairo_user_data_array_init (&surface->user_data);
  432|     69|    _cairo_user_data_array_init (&surface->mime_data);
  433|       |
  434|     69|    cairo_matrix_init_identity (&surface->device_transform);
  435|     69|    cairo_matrix_init_identity (&surface->device_transform_inverse);
  436|     69|    cairo_list_init (&surface->device_transform_observers);
  437|       |
  438|     69|    surface->x_resolution = CAIRO_SURFACE_RESOLUTION_DEFAULT;
  ------------------
  |  |  734|     69|#define CAIRO_SURFACE_RESOLUTION_DEFAULT 72.0
  ------------------
  439|     69|    surface->y_resolution = CAIRO_SURFACE_RESOLUTION_DEFAULT;
  ------------------
  |  |  734|     69|#define CAIRO_SURFACE_RESOLUTION_DEFAULT 72.0
  ------------------
  440|       |
  441|     69|    surface->x_fallback_resolution = CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT;
  ------------------
  |  |  735|     69|#define CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT 300.0
  ------------------
  442|     69|    surface->y_fallback_resolution = CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT;
  ------------------
  |  |  735|     69|#define CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT 300.0
  ------------------
  443|       |
  444|     69|    cairo_list_init (&surface->snapshots);
  445|     69|    surface->snapshot_of = NULL;
  446|       |
  447|     69|    surface->has_font_options = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  448|       |
  449|     69|    surface->foreground_source = NULL;
  450|     69|    surface->foreground_used = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
  451|     69|}
cairo_surface_reference:
  934|    138|{
  935|    138|    if (surface == NULL ||
  ------------------
  |  Branch (935:9): [True: 0, False: 138]
  ------------------
  936|    138|	    CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count))
  ------------------
  |  |   58|    138|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|    138|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|    138|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 138]
  |  |  ------------------
  ------------------
  937|      0|	return surface;
  938|       |
  939|    138|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
  940|       |
  941|    138|    _cairo_reference_count_inc (&surface->ref_count);
  ------------------
  |  |   47|    138|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|    138|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
  942|       |
  943|    138|    return surface;
  944|    138|}
cairo_surface_destroy:
  958|    276|{
  959|    276|    if (surface == NULL ||
  ------------------
  |  Branch (959:9): [True: 69, False: 207]
  ------------------
  960|    276|	    CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count))
  ------------------
  |  |   58|    207|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|    207|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|    207|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 207]
  |  |  ------------------
  ------------------
  961|     69|	return;
  962|       |
  963|    207|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
  964|       |
  965|    207|    if (! _cairo_reference_count_dec_and_test (&surface->ref_count))
  ------------------
  |  |   49|    207|#define _cairo_reference_count_dec_and_test(RC) _cairo_atomic_int_dec_and_test (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   85|    207|# define _cairo_atomic_int_dec_and_test(x) (atomic_fetch_sub_explicit(x, 1, memory_order_seq_cst) == 1)
  |  |  ------------------
  ------------------
  |  Branch (965:9): [True: 138, False: 69]
  ------------------
  966|    138|	return;
  967|       |
  968|     69|    assert (surface->snapshot_of == NULL);
  969|       |
  970|     69|    if (! surface->finished) {
  ------------------
  |  Branch (970:9): [True: 69, False: 0]
  ------------------
  971|     69|	_cairo_surface_finish_snapshots (surface);
  972|       |	/* We may have been referenced by a snapshot prior to have
  973|       |	 * detaching it with the copy-on-write.
  974|       |	 */
  975|     69|	if (CAIRO_REFERENCE_COUNT_GET_VALUE (&surface->ref_count))
  ------------------
  |  |   53|     69|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  Branch (53:45): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  976|      0|	    return;
  977|       |
  978|     69|	_cairo_surface_finish (surface);
  979|     69|    }
  980|       |
  981|     69|    if (surface->damage)
  ------------------
  |  Branch (981:9): [True: 0, False: 69]
  ------------------
  982|      0|	_cairo_damage_destroy (surface->damage);
  983|       |
  984|     69|    _cairo_user_data_array_fini (&surface->user_data);
  985|     69|    _cairo_user_data_array_fini (&surface->mime_data);
  986|       |
  987|     69|    if (surface->foreground_source)
  ------------------
  |  Branch (987:9): [True: 0, False: 69]
  ------------------
  988|      0|	cairo_pattern_destroy (surface->foreground_source);
  989|       |
  990|     69|    if (surface->owns_device)
  ------------------
  |  Branch (990:9): [True: 0, False: 69]
  ------------------
  991|      0|        cairo_device_destroy (surface->device);
  992|       |
  993|     69|    if (surface->has_font_options)
  ------------------
  |  Branch (993:9): [True: 0, False: 69]
  ------------------
  994|      0|	_cairo_font_options_fini (&surface->font_options);
  995|       |
  996|     69|    assert (surface->snapshot_of == NULL);
  997|     69|    assert (! _cairo_surface_has_snapshots (surface));
  998|       |    /* paranoid check that nobody took a reference whilst finishing */
  999|     69|    assert (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
 1000|       |
 1001|     69|    free (surface);
 1002|     69|}
cairo_surface_set_mime_data:
 1432|     69|{
 1433|     69|    cairo_status_t status;
 1434|     69|    cairo_mime_data_t *mime_data;
 1435|       |
 1436|     69|    if (CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count))
  ------------------
  |  |   58|     69|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|     69|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|     69|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1437|      0|	return surface->status;
 1438|       |
 1439|     69|    if (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count))
  ------------------
  |  |   60|     69|#define CAIRO_REFERENCE_COUNT_HAS_REFERENCE(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) > 0)
  |  |  ------------------
  |  |  |  |   53|     69|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  ------------------
  |  Branch (1439:9): [True: 0, False: 69]
  ------------------
 1440|      0|	return _cairo_error (CAIRO_STATUS_SURFACE_FINISHED);
 1441|       |
 1442|     69|    if (unlikely (surface->status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1443|      0|	return surface->status;
 1444|     69|    if (unlikely (surface->finished))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1445|      0|	return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
 1446|       |
 1447|     69|    status = _cairo_intern_string (&mime_type, -1);
 1448|     69|    if (unlikely (status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1449|      0|	return _cairo_surface_set_error (surface, status);
 1450|       |
 1451|     69|    if (data != NULL) {
  ------------------
  |  Branch (1451:9): [True: 69, False: 0]
  ------------------
 1452|     69|	mime_data = _cairo_calloc (sizeof (cairo_mime_data_t));
  ------------------
  |  |   79|     69|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1453|     69|	if (unlikely (mime_data == NULL))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1454|      0|	    return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_NO_MEMORY));
 1455|       |
 1456|     69|	CAIRO_REFERENCE_COUNT_INIT (&mime_data->ref_count, 1);
  ------------------
  |  |   51|     69|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
 1457|       |
 1458|     69|	mime_data->data = (unsigned char *) data;
 1459|     69|	mime_data->length = length;
 1460|     69|	mime_data->destroy = destroy;
 1461|     69|	mime_data->closure = closure;
 1462|     69|    } else
 1463|      0|	mime_data = NULL;
 1464|       |
 1465|     69|    status = _cairo_user_data_array_set_data (&surface->mime_data,
 1466|     69|					      (cairo_user_data_key_t *) mime_type,
 1467|     69|					      mime_data,
 1468|     69|					      _cairo_mime_data_destroy);
 1469|     69|    if (unlikely (status)) {
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1470|      0|	free (mime_data);
 1471|       |
 1472|      0|	return _cairo_surface_set_error (surface, status);
 1473|      0|    }
 1474|       |
 1475|     69|    surface->is_clear = FALSE;
  ------------------
  |  |  105|     69|#define FALSE 0
  ------------------
 1476|       |
 1477|     69|    return CAIRO_STATUS_SUCCESS;
 1478|     69|}
_cairo_surface_flush:
 1632|     69|{
 1633|       |    /* update the current snapshots *before* the user updates the surface */
 1634|     69|    _cairo_surface_detach_snapshots (surface);
 1635|     69|    if (surface->snapshot_of != NULL)
  ------------------
  |  Branch (1635:9): [True: 0, False: 69]
  ------------------
 1636|      0|	_cairo_surface_detach_snapshot (surface);
 1637|     69|    _cairo_surface_detach_mime_data (surface);
 1638|       |
 1639|     69|    return __cairo_surface_flush (surface, flags);
 1640|     69|}
_cairo_surface_has_device_transform:
 2018|     69|{
 2019|     69|    return ! _cairo_matrix_is_identity (&surface->device_transform);
 2020|     69|}
_cairo_surface_paint:
 2175|     69|{
 2176|     69|    cairo_int_status_t status;
 2177|     69|    cairo_bool_t is_clear;
 2178|       |
 2179|     69|    TRACE ((stderr, "%s\n", __FUNCTION__));
 2180|     69|    if (unlikely (surface->status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 69, False: 0]
  |  |  ------------------
  ------------------
 2181|     69|	return surface->status;
 2182|      0|    if (unlikely (surface->finished))
  ------------------
  |  |  141|      0|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2183|      0|	return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
 2184|       |
 2185|      0|    if (_cairo_clip_is_all_clipped (clip))
  ------------------
  |  Branch (2185:9): [True: 0, False: 0]
  ------------------
 2186|      0|	return CAIRO_STATUS_SUCCESS;
 2187|       |
 2188|      0|    status = _pattern_has_error (source);
 2189|      0|    if (unlikely (status))
  ------------------
  |  |  141|      0|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2190|      0|	return status;
 2191|       |
 2192|      0|    if (nothing_to_do (surface, op, source))
  ------------------
  |  Branch (2192:9): [True: 0, False: 0]
  ------------------
 2193|      0|	return CAIRO_STATUS_SUCCESS;
 2194|       |
 2195|      0|    status = _cairo_surface_begin_modification (surface);
 2196|      0|    if (unlikely (status))
  ------------------
  |  |  141|      0|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2197|      0|	return status;
 2198|       |
 2199|      0|    if (source->is_foreground_marker && surface->foreground_source) {
  ------------------
  |  Branch (2199:9): [True: 0, False: 0]
  |  Branch (2199:41): [True: 0, False: 0]
  ------------------
 2200|      0|	source = surface->foreground_source;
 2201|      0|	surface->foreground_used = TRUE;
  ------------------
  |  |  109|      0|#define TRUE 1
  ------------------
 2202|      0|    }
 2203|       |
 2204|      0|    status = surface->backend->paint (surface, op, source, clip);
 2205|      0|    is_clear = op == CAIRO_OPERATOR_CLEAR && clip == NULL;
  ------------------
  |  Branch (2205:16): [True: 0, False: 0]
  |  Branch (2205:46): [True: 0, False: 0]
  ------------------
 2206|      0|    if (status != CAIRO_INT_STATUS_NOTHING_TO_DO || is_clear) {
  ------------------
  |  Branch (2206:9): [True: 0, False: 0]
  |  Branch (2206:53): [True: 0, False: 0]
  ------------------
 2207|      0|	surface->is_clear = is_clear;
 2208|      0|	surface->serial++;
 2209|      0|    }
 2210|       |
 2211|      0|    return _cairo_surface_set_error (surface, status);
 2212|      0|}
_cairo_surface_create_in_error:
 3106|  4.67k|{
 3107|  4.67k|    assert (status < CAIRO_STATUS_LAST_STATUS);
 3108|  4.67k|    switch (status) {
 3109|      0|    case CAIRO_STATUS_NO_MEMORY:
  ------------------
  |  Branch (3109:5): [True: 0, False: 4.67k]
  ------------------
 3110|      0|	return (cairo_surface_t *) &_cairo_surface_nil;
 3111|      0|    case CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
  ------------------
  |  Branch (3111:5): [True: 0, False: 4.67k]
  ------------------
 3112|      0|	return (cairo_surface_t *) &_cairo_surface_nil_surface_type_mismatch;
 3113|      0|    case CAIRO_STATUS_INVALID_STATUS:
  ------------------
  |  Branch (3113:5): [True: 0, False: 4.67k]
  ------------------
 3114|      0|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_status;
 3115|      0|    case CAIRO_STATUS_INVALID_CONTENT:
  ------------------
  |  Branch (3115:5): [True: 0, False: 4.67k]
  ------------------
 3116|      0|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_content;
 3117|      0|    case CAIRO_STATUS_INVALID_FORMAT:
  ------------------
  |  Branch (3117:5): [True: 0, False: 4.67k]
  ------------------
 3118|      0|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_format;
 3119|      0|    case CAIRO_STATUS_INVALID_VISUAL:
  ------------------
  |  Branch (3119:5): [True: 0, False: 4.67k]
  ------------------
 3120|      0|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_visual;
 3121|  4.37k|    case CAIRO_STATUS_READ_ERROR:
  ------------------
  |  Branch (3121:5): [True: 4.37k, False: 304]
  ------------------
 3122|  4.37k|	return (cairo_surface_t *) &_cairo_surface_nil_read_error;
 3123|      0|    case CAIRO_STATUS_WRITE_ERROR:
  ------------------
  |  Branch (3123:5): [True: 0, False: 4.67k]
  ------------------
 3124|      0|	return (cairo_surface_t *) &_cairo_surface_nil_write_error;
 3125|      0|    case CAIRO_STATUS_FILE_NOT_FOUND:
  ------------------
  |  Branch (3125:5): [True: 0, False: 4.67k]
  ------------------
 3126|      0|	return (cairo_surface_t *) &_cairo_surface_nil_file_not_found;
 3127|      0|    case CAIRO_STATUS_TEMP_FILE_ERROR:
  ------------------
  |  Branch (3127:5): [True: 0, False: 4.67k]
  ------------------
 3128|      0|	return (cairo_surface_t *) &_cairo_surface_nil_temp_file_error;
 3129|      0|    case CAIRO_STATUS_INVALID_STRIDE:
  ------------------
  |  Branch (3129:5): [True: 0, False: 4.67k]
  ------------------
 3130|      0|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_stride;
 3131|      2|    case CAIRO_STATUS_INVALID_SIZE:
  ------------------
  |  Branch (3131:5): [True: 2, False: 4.67k]
  ------------------
 3132|      2|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_size;
 3133|      0|    case CAIRO_STATUS_DEVICE_TYPE_MISMATCH:
  ------------------
  |  Branch (3133:5): [True: 0, False: 4.67k]
  ------------------
 3134|      0|	return (cairo_surface_t *) &_cairo_surface_nil_device_type_mismatch;
 3135|      0|    case CAIRO_STATUS_DEVICE_ERROR:
  ------------------
  |  Branch (3135:5): [True: 0, False: 4.67k]
  ------------------
 3136|      0|	return (cairo_surface_t *) &_cairo_surface_nil_device_error;
 3137|    302|    case CAIRO_STATUS_PNG_ERROR:
  ------------------
  |  Branch (3137:5): [True: 302, False: 4.37k]
  ------------------
 3138|    302|	return (cairo_surface_t *) &_cairo_surface_nil_png_error;
 3139|      0|    case CAIRO_STATUS_SUCCESS:
  ------------------
  |  Branch (3139:5): [True: 0, False: 4.67k]
  ------------------
 3140|      0|    case CAIRO_STATUS_LAST_STATUS:
  ------------------
  |  Branch (3140:5): [True: 0, False: 4.67k]
  ------------------
 3141|      0|	ASSERT_NOT_REACHED;
  ------------------
  |  |  143|      0|#define ASSERT_NOT_REACHED		\
  |  |  144|      0|do {					\
  |  |  145|      0|    assert (!"reached");		\
  |  |  146|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (146:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3142|       |	/* fall-through */
 3143|      0|    case CAIRO_STATUS_INVALID_RESTORE:
  ------------------
  |  Branch (3143:5): [True: 0, False: 4.67k]
  ------------------
 3144|      0|    case CAIRO_STATUS_INVALID_POP_GROUP:
  ------------------
  |  Branch (3144:5): [True: 0, False: 4.67k]
  ------------------
 3145|      0|    case CAIRO_STATUS_NO_CURRENT_POINT:
  ------------------
  |  Branch (3145:5): [True: 0, False: 4.67k]
  ------------------
 3146|      0|    case CAIRO_STATUS_INVALID_MATRIX:
  ------------------
  |  Branch (3146:5): [True: 0, False: 4.67k]
  ------------------
 3147|      0|    case CAIRO_STATUS_NULL_POINTER:
  ------------------
  |  Branch (3147:5): [True: 0, False: 4.67k]
  ------------------
 3148|      0|    case CAIRO_STATUS_INVALID_STRING:
  ------------------
  |  Branch (3148:5): [True: 0, False: 4.67k]
  ------------------
 3149|      0|    case CAIRO_STATUS_INVALID_PATH_DATA:
  ------------------
  |  Branch (3149:5): [True: 0, False: 4.67k]
  ------------------
 3150|      0|    case CAIRO_STATUS_SURFACE_FINISHED:
  ------------------
  |  Branch (3150:5): [True: 0, False: 4.67k]
  ------------------
 3151|      0|    case CAIRO_STATUS_PATTERN_TYPE_MISMATCH:
  ------------------
  |  Branch (3151:5): [True: 0, False: 4.67k]
  ------------------
 3152|      0|    case CAIRO_STATUS_INVALID_DASH:
  ------------------
  |  Branch (3152:5): [True: 0, False: 4.67k]
  ------------------
 3153|      0|    case CAIRO_STATUS_INVALID_DSC_COMMENT:
  ------------------
  |  Branch (3153:5): [True: 0, False: 4.67k]
  ------------------
 3154|      0|    case CAIRO_STATUS_INVALID_INDEX:
  ------------------
  |  Branch (3154:5): [True: 0, False: 4.67k]
  ------------------
 3155|      0|    case CAIRO_STATUS_CLIP_NOT_REPRESENTABLE:
  ------------------
  |  Branch (3155:5): [True: 0, False: 4.67k]
  ------------------
 3156|      0|    case CAIRO_STATUS_FONT_TYPE_MISMATCH:
  ------------------
  |  Branch (3156:5): [True: 0, False: 4.67k]
  ------------------
 3157|      0|    case CAIRO_STATUS_USER_FONT_IMMUTABLE:
  ------------------
  |  Branch (3157:5): [True: 0, False: 4.67k]
  ------------------
 3158|      0|    case CAIRO_STATUS_USER_FONT_ERROR:
  ------------------
  |  Branch (3158:5): [True: 0, False: 4.67k]
  ------------------
 3159|      0|    case CAIRO_STATUS_NEGATIVE_COUNT:
  ------------------
  |  Branch (3159:5): [True: 0, False: 4.67k]
  ------------------
 3160|      0|    case CAIRO_STATUS_INVALID_CLUSTERS:
  ------------------
  |  Branch (3160:5): [True: 0, False: 4.67k]
  ------------------
 3161|      0|    case CAIRO_STATUS_INVALID_SLANT:
  ------------------
  |  Branch (3161:5): [True: 0, False: 4.67k]
  ------------------
 3162|      0|    case CAIRO_STATUS_INVALID_WEIGHT:
  ------------------
  |  Branch (3162:5): [True: 0, False: 4.67k]
  ------------------
 3163|      0|    case CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED:
  ------------------
  |  Branch (3163:5): [True: 0, False: 4.67k]
  ------------------
 3164|      0|    case CAIRO_STATUS_INVALID_MESH_CONSTRUCTION:
  ------------------
  |  Branch (3164:5): [True: 0, False: 4.67k]
  ------------------
 3165|      0|    case CAIRO_STATUS_DEVICE_FINISHED:
  ------------------
  |  Branch (3165:5): [True: 0, False: 4.67k]
  ------------------
 3166|      0|    case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
  ------------------
  |  Branch (3166:5): [True: 0, False: 4.67k]
  ------------------
 3167|      0|    case CAIRO_STATUS_FREETYPE_ERROR:
  ------------------
  |  Branch (3167:5): [True: 0, False: 4.67k]
  ------------------
 3168|      0|    case CAIRO_STATUS_WIN32_GDI_ERROR:
  ------------------
  |  Branch (3168:5): [True: 0, False: 4.67k]
  ------------------
 3169|      0|    case CAIRO_INT_STATUS_DWRITE_ERROR:
  ------------------
  |  Branch (3169:5): [True: 0, False: 4.67k]
  ------------------
 3170|      0|    case CAIRO_STATUS_TAG_ERROR:
  ------------------
  |  Branch (3170:5): [True: 0, False: 4.67k]
  ------------------
 3171|      0|    case CAIRO_STATUS_SVG_FONT_ERROR:
  ------------------
  |  Branch (3171:5): [True: 0, False: 4.67k]
  ------------------
 3172|      0|    default:
  ------------------
  |  Branch (3172:5): [True: 0, False: 4.67k]
  ------------------
 3173|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3174|      0|	return (cairo_surface_t *) &_cairo_surface_nil;
 3175|  4.67k|    }
 3176|  4.67k|}
cairo-surface.c:_cairo_surface_allocate_unique_id:
  272|     69|{
  273|     69|    static cairo_atomic_int_t unique_id;
  274|       |
  275|       |#if CAIRO_NO_MUTEX
  276|       |    if (++unique_id == 0)
  277|       |	unique_id = 1;
  278|       |    return unique_id;
  279|       |#else
  280|     69|    int old, id;
  281|       |
  282|     69|    do {
  283|     69|	old = _cairo_atomic_uint_get (&unique_id);
  ------------------
  |  |  473|     69|#define _cairo_atomic_uint_get(x) _cairo_atomic_int_get(x)
  ------------------
  284|     69|	id = old + 1;
  285|     69|	if (id == 0)
  ------------------
  |  Branch (285:6): [True: 0, False: 69]
  ------------------
  286|      0|	    id = 1;
  287|     69|    } while (! _cairo_atomic_uint_cmpxchg (&unique_id, old, id));
  ------------------
  |  |  475|     69|    _cairo_atomic_int_cmpxchg((cairo_atomic_int_t *)x, oldv, newv)
  |  |  ------------------
  |  |  |  |   98|     69|  _cairo_atomic_int_cmpxchg_impl(x, oldv, newv)
  |  |  ------------------
  ------------------
  |  Branch (287:14): [True: 0, False: 69]
  ------------------
  288|       |
  289|     69|    return id;
  290|     69|#endif
  291|     69|}
cairo-surface.c:_cairo_surface_has_snapshots:
  316|    207|{
  317|    207|    return ! cairo_list_is_empty (&surface->snapshots);
  318|    207|}
cairo-surface.c:_cairo_surface_finish_snapshots:
 1027|     69|{
 1028|     69|    cairo_status_t status;
 1029|       |
 1030|       |    /* update the snapshots *before* we declare the surface as finished */
 1031|     69|    surface->_finishing = TRUE;
  ------------------
  |  |  109|     69|#define TRUE 1
  ------------------
 1032|     69|    status = _cairo_surface_flush (surface, 0);
 1033|     69|    (void) status;
 1034|     69|}
cairo-surface.c:_cairo_surface_finish:
 1038|     69|{
 1039|     69|    cairo_status_t status;
 1040|       |
 1041|       |    /* call finish even if in error mode */
 1042|     69|    if (surface->backend->finish) {
  ------------------
  |  Branch (1042:9): [True: 69, False: 0]
  ------------------
 1043|     69|	status = surface->backend->finish (surface);
 1044|     69|	if (unlikely (status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1045|      0|	    _cairo_surface_set_error (surface, status);
 1046|     69|    }
 1047|       |
 1048|     69|    surface->finished = TRUE;
  ------------------
  |  |  109|     69|#define TRUE 1
  ------------------
 1049|       |
 1050|     69|    assert (surface->snapshot_of == NULL);
 1051|     69|    assert (!_cairo_surface_has_snapshots (surface));
 1052|     69|}
cairo-surface.c:_cairo_mime_data_destroy:
 1226|     69|{
 1227|     69|    cairo_mime_data_t *mime_data = ptr;
 1228|       |
 1229|     69|    if (! _cairo_reference_count_dec_and_test (&mime_data->ref_count))
  ------------------
  |  |   49|     69|#define _cairo_reference_count_dec_and_test(RC) _cairo_atomic_int_dec_and_test (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   85|     69|# define _cairo_atomic_int_dec_and_test(x) (atomic_fetch_sub_explicit(x, 1, memory_order_seq_cst) == 1)
  |  |  ------------------
  ------------------
  |  Branch (1229:9): [True: 0, False: 69]
  ------------------
 1230|      0|	return;
 1231|       |
 1232|     69|    if (mime_data->destroy && mime_data->closure)
  ------------------
  |  Branch (1232:9): [True: 69, False: 0]
  |  Branch (1232:31): [True: 69, False: 0]
  ------------------
 1233|     69|	mime_data->destroy (mime_data->closure);
 1234|       |
 1235|     69|    free (mime_data);
 1236|     69|}
cairo-surface.c:_cairo_surface_detach_snapshots:
  338|     69|{
  339|     69|    while (_cairo_surface_has_snapshots (surface)) {
  ------------------
  |  Branch (339:12): [True: 0, False: 69]
  ------------------
  340|      0|	_cairo_surface_detach_snapshot (cairo_list_first_entry (&surface->snapshots,
  ------------------
  |  |   54|      0|	cairo_list_entry((ptr)->next, type, member)
  |  |  ------------------
  |  |  |  |   51|      0|	cairo_container_of(ptr, type, member)
  |  |  |  |  ------------------
  |  |  |  |  |  |  133|      0|#define cairo_container_of(ptr, type, member) ({ \
  |  |  |  |  |  |  134|      0|    const __typeof__ (((type *) 0)->member) *mptr__ = (ptr); \
  |  |  |  |  |  |  135|      0|    (type *) ((char *) mptr__ - offsetof (type, member)); \
  |  |  |  |  |  |  136|      0|})
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  341|      0|								cairo_surface_t,
  342|      0|								snapshot));
  343|      0|    }
  344|     69|}
cairo-surface.c:_cairo_surface_detach_mime_data:
  328|     69|{
  329|     69|    if (! _cairo_surface_has_mime_data (surface))
  ------------------
  |  Branch (329:9): [True: 0, False: 69]
  ------------------
  330|      0|	return;
  331|       |
  332|     69|    _cairo_user_data_array_fini (&surface->mime_data);
  333|     69|    _cairo_user_data_array_init (&surface->mime_data);
  334|     69|}
cairo-surface.c:_cairo_surface_has_mime_data:
  322|     69|{
  323|     69|    return surface->mime_data.num_elements != 0;
  324|     69|}

_cairo_traps_compositor_init:
 2343|      1|{
 2344|      1|    compositor->base.delegate = delegate;
 2345|       |
 2346|      1|    compositor->base.paint = _cairo_traps_compositor_paint;
 2347|      1|    compositor->base.mask = _cairo_traps_compositor_mask;
 2348|      1|    compositor->base.fill = _cairo_traps_compositor_fill;
 2349|      1|    compositor->base.stroke = _cairo_traps_compositor_stroke;
 2350|      1|    compositor->base.glyphs = _cairo_traps_compositor_glyphs;
 2351|      1|}

cairo_create:
  447|     69|{
  448|     69|    if (unlikely (target == NULL))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  449|      0|	return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NULL_POINTER));
  450|     69|    if (unlikely (target->status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  451|      0|	return _cairo_create_in_error (target->status);
  452|     69|    if (unlikely (target->finished))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  453|      0|	return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
  454|       |
  455|     69|    if (target->backend->create_context == NULL)
  ------------------
  |  Branch (455:9): [True: 0, False: 69]
  ------------------
  456|      0|	return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_WRITE_ERROR));
  457|       |
  458|     69|    return target->backend->create_context (target);
  459|       |
  460|     69|}
_cairo_init:
  465|     69|{
  466|     69|    CAIRO_REFERENCE_COUNT_INIT (&cr->ref_count, 1);
  ------------------
  |  |   51|     69|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
  467|     69|    cr->status = CAIRO_STATUS_SUCCESS;
  468|     69|    _cairo_user_data_array_init (&cr->user_data);
  469|       |
  470|     69|    cr->backend = backend;
  471|     69|}
_cairo_fini:
  503|     69|{
  504|     69|    _cairo_user_data_array_fini (&cr->user_data);
  505|     69|}
cairo_destroy:
  519|     69|{
  520|     69|    if (cr == NULL || CAIRO_REFERENCE_COUNT_IS_INVALID (&cr->ref_count))
  ------------------
  |  |   58|     69|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|     69|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|     69|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  |  Branch (520:9): [True: 0, False: 69]
  ------------------
  521|      0|	return;
  522|       |
  523|     69|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&cr->ref_count));
  524|       |
  525|     69|    if (! _cairo_reference_count_dec_and_test (&cr->ref_count))
  ------------------
  |  |   49|     69|#define _cairo_reference_count_dec_and_test(RC) _cairo_atomic_int_dec_and_test (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   85|     69|# define _cairo_atomic_int_dec_and_test(x) (atomic_fetch_sub_explicit(x, 1, memory_order_seq_cst) == 1)
  |  |  ------------------
  ------------------
  |  Branch (525:9): [True: 0, False: 69]
  ------------------
  526|      0|	return;
  527|       |
  528|     69|    cr->backend->destroy (cr);
  529|     69|}
cairo_set_source:
 1005|     69|{
 1006|     69|    cairo_status_t status;
 1007|       |
 1008|     69|    if (unlikely (cr->status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1009|      0|	return;
 1010|       |
 1011|     69|    if (unlikely (source == NULL)) {
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1012|      0|	_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
 1013|      0|	return;
 1014|      0|    }
 1015|       |
 1016|     69|    if (unlikely (source->status)) {
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1017|      0|	_cairo_set_error (cr, source->status);
 1018|      0|	return;
 1019|      0|    }
 1020|       |
 1021|     69|    status = cr->backend->set_source (cr, source);
 1022|     69|    if (unlikely (status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 1023|      0|	_cairo_set_error (cr, status);
 1024|     69|}
cairo_paint:
 2224|     69|{
 2225|     69|    cairo_status_t status;
 2226|       |
 2227|     69|    if (unlikely (cr->status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 0, False: 69]
  |  |  ------------------
  ------------------
 2228|      0|	return;
 2229|       |
 2230|     69|    status = cr->backend->paint (cr);
 2231|     69|    if (unlikely (status))
  ------------------
  |  |  141|     69|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (141:24): [True: 69, False: 0]
  |  |  ------------------
  ------------------
 2232|     69|	_cairo_set_error (cr, status);
 2233|     69|}
cairo.c:_cairo_set_error:
  398|     69|{
  399|       |    /* Don't overwrite an existing error. This preserves the first
  400|       |     * error, which is the most significant. */
  401|     69|    _cairo_status_set_error (&cr->status, _cairo_error (status));
  ------------------
  |  |  477|     69|#define _cairo_status_set_error(status, err) do { \
  |  |  478|     69|    int ret__; \
  |  |  479|     69|    assert (err < CAIRO_STATUS_LAST_STATUS); \
  |  |  480|     69|    assert (sizeof(*status) == sizeof(cairo_atomic_int_t)); \
  |  |  481|     69|    /* hide compiler warnings about cairo_status_t != int (gcc treats its as \
  |  |  482|     69|     * an unsigned integer instead, and about ignoring the return value. */  \
  |  |  483|     69|    ret__ = _cairo_atomic_int_cmpxchg ((cairo_atomic_int_t *) status, CAIRO_STATUS_SUCCESS, err); \
  |  |  ------------------
  |  |  |  |   98|     69|  _cairo_atomic_int_cmpxchg_impl(x, oldv, newv)
  |  |  ------------------
  |  |  484|     69|    (void) ret__; \
  |  |  485|     69|} while (0)
  |  |  ------------------
  |  |  |  Branch (485:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  402|     69|}

cairo-surface.c:_cairo_matrix_is_identity:
 1809|     69|{
 1810|     69|    return (matrix->xx == 1.0 && matrix->yx == 0.0 &&
  ------------------
  |  Branch (1810:13): [True: 69, False: 0]
  |  Branch (1810:34): [True: 69, False: 0]
  ------------------
 1811|     69|	    matrix->xy == 0.0 && matrix->yy == 1.0 &&
  ------------------
  |  Branch (1811:6): [True: 69, False: 0]
  |  Branch (1811:27): [True: 69, False: 0]
  ------------------
 1812|     69|	    matrix->x0 == 0.0 && matrix->y0 == 0.0);
  ------------------
  |  Branch (1812:6): [True: 69, False: 0]
  |  Branch (1812:27): [True: 69, False: 0]
  ------------------
 1813|     69|}
cairo-gstate.c:_cairo_matrix_is_identity:
 1809|    138|{
 1810|    138|    return (matrix->xx == 1.0 && matrix->yx == 0.0 &&
  ------------------
  |  Branch (1810:13): [True: 138, False: 0]
  |  Branch (1810:34): [True: 138, False: 0]
  ------------------
 1811|    138|	    matrix->xy == 0.0 && matrix->yy == 1.0 &&
  ------------------
  |  Branch (1811:6): [True: 138, False: 0]
  |  Branch (1811:27): [True: 138, False: 0]
  ------------------
 1812|    138|	    matrix->x0 == 0.0 && matrix->y0 == 0.0);
  ------------------
  |  Branch (1812:6): [True: 138, False: 0]
  |  Branch (1812:27): [True: 138, False: 0]
  ------------------
 1813|    138|}

png_read_filter_row_sub3_sse2:
   54|  1.31k|{
   55|       |   /* The Sub filter predicts each pixel as the previous pixel, a.
   56|       |    * There is no pixel to the left of the first pixel.  It's encoded directly.
   57|       |    * That works with our main loop if we just say that left pixel was zero.
   58|       |    */
   59|  1.31k|   size_t rb;
   60|       |
   61|  1.31k|   __m128i a, d = _mm_setzero_si128();
   62|       |
   63|  1.31k|   png_debug(1, "in png_read_filter_row_sub3_sse2");
  ------------------
  |  |  145|  1.31k|#  define png_debug(l, m) ((void)0)
  ------------------
   64|       |
   65|  1.31k|   rb = row_info->rowbytes;
   66|   819k|   while (rb >= 4) {
  ------------------
  |  Branch (66:11): [True: 818k, False: 1.31k]
  ------------------
   67|   818k|      a = d; d = load4(row);
   68|   818k|      d = _mm_add_epi8(d, a);
   69|   818k|      store3(row, d);
   70|       |
   71|   818k|      row += 3;
   72|   818k|      rb  -= 3;
   73|   818k|   }
   74|  1.31k|   if (rb > 0) {
  ------------------
  |  Branch (74:8): [True: 1.31k, False: 0]
  ------------------
   75|  1.31k|      a = d; d = load3(row);
   76|  1.31k|      d = _mm_add_epi8(d, a);
   77|  1.31k|      store3(row, d);
   78|       |
   79|  1.31k|      row += 3;
   80|  1.31k|      rb  -= 3;
   81|  1.31k|   }
   82|  1.31k|   PNG_UNUSED(prev)
  ------------------
  |  |  488|  1.31k|#  define PNG_UNUSED(param) (void)param;
  ------------------
   83|  1.31k|}
png_read_filter_row_sub4_sse2:
   87|    420|{
   88|       |   /* The Sub filter predicts each pixel as the previous pixel, a.
   89|       |    * There is no pixel to the left of the first pixel.  It's encoded directly.
   90|       |    * That works with our main loop if we just say that left pixel was zero.
   91|       |    */
   92|    420|   size_t rb;
   93|       |
   94|    420|   __m128i a, d = _mm_setzero_si128();
   95|       |
   96|    420|   png_debug(1, "in png_read_filter_row_sub4_sse2");
  ------------------
  |  |  145|    420|#  define png_debug(l, m) ((void)0)
  ------------------
   97|       |
   98|    420|   rb = row_info->rowbytes+4;
   99|  45.6k|   while (rb > 4) {
  ------------------
  |  Branch (99:11): [True: 45.2k, False: 420]
  ------------------
  100|  45.2k|      a = d; d = load4(row);
  101|  45.2k|      d = _mm_add_epi8(d, a);
  102|  45.2k|      store4(row, d);
  103|       |
  104|  45.2k|      row += 4;
  105|  45.2k|      rb  -= 4;
  106|  45.2k|   }
  107|    420|   PNG_UNUSED(prev)
  ------------------
  |  |  488|    420|#  define PNG_UNUSED(param) (void)param;
  ------------------
  108|    420|}
png_read_filter_row_avg3_sse2:
  112|  2.08k|{
  113|       |   /* The Avg filter predicts each pixel as the (truncated) average of a and b.
  114|       |    * There's no pixel to the left of the first pixel.  Luckily, it's
  115|       |    * predicted to be half of the pixel above it.  So again, this works
  116|       |    * perfectly with our loop if we make sure a starts at zero.
  117|       |    */
  118|       |
  119|  2.08k|   size_t rb;
  120|       |
  121|  2.08k|   const __m128i zero = _mm_setzero_si128();
  122|       |
  123|  2.08k|   __m128i    b;
  124|  2.08k|   __m128i a, d = zero;
  125|       |
  126|  2.08k|   png_debug(1, "in png_read_filter_row_avg3_sse2");
  ------------------
  |  |  145|  2.08k|#  define png_debug(l, m) ((void)0)
  ------------------
  127|  2.08k|   rb = row_info->rowbytes;
  128|  1.04M|   while (rb >= 4) {
  ------------------
  |  Branch (128:11): [True: 1.03M, False: 2.08k]
  ------------------
  129|  1.03M|      __m128i avg;
  130|  1.03M|             b = load4(prev);
  131|  1.03M|      a = d; d = load4(row );
  132|       |
  133|       |      /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
  134|  1.03M|      avg = _mm_avg_epu8(a,b);
  135|       |      /* ...but we can fix it up by subtracting off 1 if it rounded up. */
  136|  1.03M|      avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a,b),
  137|  1.03M|                                            _mm_set1_epi8(1)));
  138|  1.03M|      d = _mm_add_epi8(d, avg);
  139|  1.03M|      store3(row, d);
  140|       |
  141|  1.03M|      prev += 3;
  142|  1.03M|      row  += 3;
  143|  1.03M|      rb   -= 3;
  144|  1.03M|   }
  145|  2.08k|   if (rb > 0) {
  ------------------
  |  Branch (145:8): [True: 2.08k, False: 0]
  ------------------
  146|  2.08k|      __m128i avg;
  147|  2.08k|             b = load3(prev);
  148|  2.08k|      a = d; d = load3(row );
  149|       |
  150|       |      /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
  151|  2.08k|      avg = _mm_avg_epu8(a,b);
  152|       |      /* ...but we can fix it up by subtracting off 1 if it rounded up. */
  153|  2.08k|      avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a,b),
  154|  2.08k|                                            _mm_set1_epi8(1)));
  155|       |
  156|  2.08k|      d = _mm_add_epi8(d, avg);
  157|  2.08k|      store3(row, d);
  158|       |
  159|  2.08k|      prev += 3;
  160|  2.08k|      row  += 3;
  161|  2.08k|      rb   -= 3;
  162|  2.08k|   }
  163|  2.08k|}
png_read_filter_row_avg4_sse2:
  167|    357|{
  168|       |   /* The Avg filter predicts each pixel as the (truncated) average of a and b.
  169|       |    * There's no pixel to the left of the first pixel.  Luckily, it's
  170|       |    * predicted to be half of the pixel above it.  So again, this works
  171|       |    * perfectly with our loop if we make sure a starts at zero.
  172|       |    */
  173|    357|   size_t rb;
  174|    357|   const __m128i zero = _mm_setzero_si128();
  175|    357|   __m128i    b;
  176|    357|   __m128i a, d = zero;
  177|       |
  178|    357|   png_debug(1, "in png_read_filter_row_avg4_sse2");
  ------------------
  |  |  145|    357|#  define png_debug(l, m) ((void)0)
  ------------------
  179|       |
  180|    357|   rb = row_info->rowbytes+4;
  181|  13.8k|   while (rb > 4) {
  ------------------
  |  Branch (181:11): [True: 13.4k, False: 357]
  ------------------
  182|  13.4k|      __m128i avg;
  183|  13.4k|             b = load4(prev);
  184|  13.4k|      a = d; d = load4(row );
  185|       |
  186|       |      /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
  187|  13.4k|      avg = _mm_avg_epu8(a,b);
  188|       |      /* ...but we can fix it up by subtracting off 1 if it rounded up. */
  189|  13.4k|      avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a,b),
  190|  13.4k|                                            _mm_set1_epi8(1)));
  191|       |
  192|  13.4k|      d = _mm_add_epi8(d, avg);
  193|  13.4k|      store4(row, d);
  194|       |
  195|  13.4k|      prev += 4;
  196|  13.4k|      row  += 4;
  197|  13.4k|      rb   -= 4;
  198|  13.4k|   }
  199|    357|}
png_read_filter_row_paeth3_sse2:
  231|  2.60k|{
  232|       |   /* Paeth tries to predict pixel d using the pixel to the left of it, a,
  233|       |    * and two pixels from the previous row, b and c:
  234|       |    *   prev: c b
  235|       |    *   row:  a d
  236|       |    * The Paeth function predicts d to be whichever of a, b, or c is nearest to
  237|       |    * p=a+b-c.
  238|       |    *
  239|       |    * The first pixel has no left context, and so uses an Up filter, p = b.
  240|       |    * This works naturally with our main loop's p = a+b-c if we force a and c
  241|       |    * to zero.
  242|       |    * Here we zero b and d, which become c and a respectively at the start of
  243|       |    * the loop.
  244|       |    */
  245|  2.60k|   size_t rb;
  246|  2.60k|   const __m128i zero = _mm_setzero_si128();
  247|  2.60k|   __m128i c, b = zero,
  248|  2.60k|           a, d = zero;
  249|       |
  250|  2.60k|   png_debug(1, "in png_read_filter_row_paeth3_sse2");
  ------------------
  |  |  145|  2.60k|#  define png_debug(l, m) ((void)0)
  ------------------
  251|       |
  252|  2.60k|   rb = row_info->rowbytes;
  253|  2.29M|   while (rb >= 4) {
  ------------------
  |  Branch (253:11): [True: 2.29M, False: 2.60k]
  ------------------
  254|       |      /* It's easiest to do this math (particularly, deal with pc) with 16-bit
  255|       |       * intermediates.
  256|       |       */
  257|  2.29M|      __m128i pa,pb,pc,smallest,nearest;
  258|  2.29M|      c = b; b = _mm_unpacklo_epi8(load4(prev), zero);
  259|  2.29M|      a = d; d = _mm_unpacklo_epi8(load4(row ), zero);
  260|       |
  261|       |      /* (p-a) == (a+b-c - a) == (b-c) */
  262|       |
  263|  2.29M|      pa = _mm_sub_epi16(b,c);
  264|       |
  265|       |      /* (p-b) == (a+b-c - b) == (a-c) */
  266|  2.29M|      pb = _mm_sub_epi16(a,c);
  267|       |
  268|       |      /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
  269|  2.29M|      pc = _mm_add_epi16(pa,pb);
  270|       |
  271|  2.29M|      pa = abs_i16(pa);  /* |p-a| */
  272|  2.29M|      pb = abs_i16(pb);  /* |p-b| */
  273|  2.29M|      pc = abs_i16(pc);  /* |p-c| */
  274|       |
  275|  2.29M|      smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
  276|       |
  277|       |      /* Paeth breaks ties favoring a over b over c. */
  278|  2.29M|      nearest  = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
  279|  2.29M|                 if_then_else(_mm_cmpeq_epi16(smallest, pb), b,
  280|  2.29M|                                                             c));
  281|       |
  282|       |      /* Note `_epi8`: we need addition to wrap modulo 255. */
  283|  2.29M|      d = _mm_add_epi8(d, nearest);
  284|  2.29M|      store3(row, _mm_packus_epi16(d,d));
  285|       |
  286|  2.29M|      prev += 3;
  287|  2.29M|      row  += 3;
  288|  2.29M|      rb   -= 3;
  289|  2.29M|   }
  290|  2.60k|   if (rb > 0) {
  ------------------
  |  Branch (290:8): [True: 2.60k, False: 0]
  ------------------
  291|       |      /* It's easiest to do this math (particularly, deal with pc) with 16-bit
  292|       |       * intermediates.
  293|       |       */
  294|  2.60k|      __m128i pa,pb,pc,smallest,nearest;
  295|  2.60k|      c = b; b = _mm_unpacklo_epi8(load3(prev), zero);
  296|  2.60k|      a = d; d = _mm_unpacklo_epi8(load3(row ), zero);
  297|       |
  298|       |      /* (p-a) == (a+b-c - a) == (b-c) */
  299|  2.60k|      pa = _mm_sub_epi16(b,c);
  300|       |
  301|       |      /* (p-b) == (a+b-c - b) == (a-c) */
  302|  2.60k|      pb = _mm_sub_epi16(a,c);
  303|       |
  304|       |      /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
  305|  2.60k|      pc = _mm_add_epi16(pa,pb);
  306|       |
  307|  2.60k|      pa = abs_i16(pa);  /* |p-a| */
  308|  2.60k|      pb = abs_i16(pb);  /* |p-b| */
  309|  2.60k|      pc = abs_i16(pc);  /* |p-c| */
  310|       |
  311|  2.60k|      smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
  312|       |
  313|       |      /* Paeth breaks ties favoring a over b over c. */
  314|  2.60k|      nearest  = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
  315|  2.60k|                         if_then_else(_mm_cmpeq_epi16(smallest, pb), b,
  316|  2.60k|                                                                     c));
  317|       |
  318|       |      /* Note `_epi8`: we need addition to wrap modulo 255. */
  319|  2.60k|      d = _mm_add_epi8(d, nearest);
  320|  2.60k|      store3(row, _mm_packus_epi16(d,d));
  321|       |
  322|  2.60k|      prev += 3;
  323|  2.60k|      row  += 3;
  324|  2.60k|      rb   -= 3;
  325|  2.60k|   }
  326|  2.60k|}
png_read_filter_row_paeth4_sse2:
  330|    802|{
  331|       |   /* Paeth tries to predict pixel d using the pixel to the left of it, a,
  332|       |    * and two pixels from the previous row, b and c:
  333|       |    *   prev: c b
  334|       |    *   row:  a d
  335|       |    * The Paeth function predicts d to be whichever of a, b, or c is nearest to
  336|       |    * p=a+b-c.
  337|       |    *
  338|       |    * The first pixel has no left context, and so uses an Up filter, p = b.
  339|       |    * This works naturally with our main loop's p = a+b-c if we force a and c
  340|       |    * to zero.
  341|       |    * Here we zero b and d, which become c and a respectively at the start of
  342|       |    * the loop.
  343|       |    */
  344|    802|   size_t rb;
  345|    802|   const __m128i zero = _mm_setzero_si128();
  346|    802|   __m128i pa,pb,pc,smallest,nearest;
  347|    802|   __m128i c, b = zero,
  348|    802|           a, d = zero;
  349|       |
  350|    802|   png_debug(1, "in png_read_filter_row_paeth4_sse2");
  ------------------
  |  |  145|    802|#  define png_debug(l, m) ((void)0)
  ------------------
  351|       |
  352|    802|   rb = row_info->rowbytes+4;
  353|   352k|   while (rb > 4) {
  ------------------
  |  Branch (353:11): [True: 351k, False: 802]
  ------------------
  354|       |      /* It's easiest to do this math (particularly, deal with pc) with 16-bit
  355|       |       * intermediates.
  356|       |       */
  357|   351k|      c = b; b = _mm_unpacklo_epi8(load4(prev), zero);
  358|   351k|      a = d; d = _mm_unpacklo_epi8(load4(row ), zero);
  359|       |
  360|       |      /* (p-a) == (a+b-c - a) == (b-c) */
  361|   351k|      pa = _mm_sub_epi16(b,c);
  362|       |
  363|       |      /* (p-b) == (a+b-c - b) == (a-c) */
  364|   351k|      pb = _mm_sub_epi16(a,c);
  365|       |
  366|       |      /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
  367|   351k|      pc = _mm_add_epi16(pa,pb);
  368|       |
  369|   351k|      pa = abs_i16(pa);  /* |p-a| */
  370|   351k|      pb = abs_i16(pb);  /* |p-b| */
  371|   351k|      pc = abs_i16(pc);  /* |p-c| */
  372|       |
  373|   351k|      smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
  374|       |
  375|       |      /* Paeth breaks ties favoring a over b over c. */
  376|   351k|      nearest  = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
  377|   351k|                         if_then_else(_mm_cmpeq_epi16(smallest, pb), b,
  378|   351k|                                                                     c));
  379|       |
  380|       |      /* Note `_epi8`: we need addition to wrap modulo 255. */
  381|   351k|      d = _mm_add_epi8(d, nearest);
  382|   351k|      store4(row, _mm_packus_epi16(d,d));
  383|       |
  384|   351k|      prev += 4;
  385|   351k|      row  += 4;
  386|   351k|      rb   -= 4;
  387|   351k|   }
  388|    802|}
filter_sse2_intrinsics.c:load4:
   30|  8.25M|static __m128i load4(const void* p) {
   31|  8.25M|   int tmp;
   32|  8.25M|   memcpy(&tmp, p, sizeof(tmp));
   33|  8.25M|   return _mm_cvtsi32_si128(tmp);
   34|  8.25M|}
filter_sse2_intrinsics.c:store3:
   47|  4.15M|static void store3(void* p, __m128i v) {
   48|  4.15M|   int tmp = _mm_cvtsi128_si32(v);
   49|  4.15M|   memcpy(p, &tmp, 3);
   50|  4.15M|}
filter_sse2_intrinsics.c:load3:
   41|  10.6k|static __m128i load3(const void* p) {
   42|  10.6k|   png_uint_32 tmp = 0;
   43|  10.6k|   memcpy(&tmp, p, 3);
   44|  10.6k|   return _mm_cvtsi32_si128(tmp);
   45|  10.6k|}
filter_sse2_intrinsics.c:store4:
   36|   410k|static void store4(void* p, __m128i v) {
   37|   410k|   int tmp = _mm_cvtsi128_si32(v);
   38|   410k|   memcpy(p, &tmp, sizeof(int));
   39|   410k|}
filter_sse2_intrinsics.c:abs_i16:
  202|  7.94M|static __m128i abs_i16(__m128i x) {
  203|       |#if PNG_INTEL_SSE_IMPLEMENTATION >= 2
  204|       |   return _mm_abs_epi16(x);
  205|       |#else
  206|       |   /* Read this all as, return x<0 ? -x : x.
  207|       |   * To negate two's complement, you flip all the bits then add 1.
  208|       |    */
  209|  7.94M|   __m128i is_negative = _mm_cmplt_epi16(x, _mm_setzero_si128());
  210|       |
  211|       |   /* Flip negative lanes. */
  212|  7.94M|   x = _mm_xor_si128(x, is_negative);
  213|       |
  214|       |   /* +1 to negative lanes, else +0. */
  215|  7.94M|   x = _mm_sub_epi16(x, is_negative);
  216|  7.94M|   return x;
  217|  7.94M|#endif
  218|  7.94M|}
filter_sse2_intrinsics.c:if_then_else:
  221|  5.29M|static __m128i if_then_else(__m128i c, __m128i t, __m128i e) {
  222|       |#if PNG_INTEL_SSE_IMPLEMENTATION >= 3
  223|       |   return _mm_blendv_epi8(e,t,c);
  224|       |#else
  225|  5.29M|   return _mm_or_si128(_mm_and_si128(c, t), _mm_andnot_si128(c, e));
  226|  5.29M|#endif
  227|  5.29M|}

png_init_filter_functions_sse2:
   21|    315|{
   22|       |   /* The techniques used to implement each of these filters in SSE operate on
   23|       |    * one pixel at a time.
   24|       |    * So they generally speed up 3bpp images about 3x, 4bpp images about 4x.
   25|       |    * They can scale up to 6 and 8 bpp images and down to 2 bpp images,
   26|       |    * but they'd not likely have any benefit for 1bpp images.
   27|       |    * Most of these can be implemented using only MMX and 64-bit registers,
   28|       |    * but they end up a bit slower than using the equally-ubiquitous SSE2.
   29|       |   */
   30|    315|   png_debug(1, "in png_init_filter_functions_sse2");
  ------------------
  |  |  145|    315|#  define png_debug(l, m) ((void)0)
  ------------------
   31|    315|   if (bpp == 3)
  ------------------
  |  Branch (31:8): [True: 69, False: 246]
  ------------------
   32|     69|   {
   33|     69|      pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_sse2;
  ------------------
  |  | 1476|     69|#define PNG_FILTER_VALUE_SUB   1
  ------------------
   34|     69|      pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_sse2;
  ------------------
  |  | 1478|     69|#define PNG_FILTER_VALUE_AVG   3
  ------------------
   35|     69|      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
  ------------------
  |  | 1479|     69|#define PNG_FILTER_VALUE_PAETH 4
  ------------------
   36|     69|         png_read_filter_row_paeth3_sse2;
   37|     69|   }
   38|    246|   else if (bpp == 4)
  ------------------
  |  Branch (38:13): [True: 21, False: 225]
  ------------------
   39|     21|   {
   40|     21|      pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_sse2;
  ------------------
  |  | 1476|     21|#define PNG_FILTER_VALUE_SUB   1
  ------------------
   41|     21|      pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_sse2;
  ------------------
  |  | 1478|     21|#define PNG_FILTER_VALUE_AVG   3
  ------------------
   42|     21|      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
  ------------------
  |  | 1479|     21|#define PNG_FILTER_VALUE_PAETH 4
  ------------------
   43|     21|          png_read_filter_row_paeth4_sse2;
   44|     21|   }
   45|       |
   46|       |   /* No need optimize PNG_FILTER_VALUE_UP.  The compiler should
   47|       |    * autovectorize.
   48|       |    */
   49|    315|}

png_sig_cmp:
   55|  4.74k|{
   56|  4.74k|   static const png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
   57|       |
   58|  4.74k|   if (num_to_check > 8)
  ------------------
  |  Branch (58:8): [True: 0, False: 4.74k]
  ------------------
   59|      0|      num_to_check = 8;
   60|       |
   61|  4.74k|   else if (num_to_check < 1)
  ------------------
  |  Branch (61:13): [True: 0, False: 4.74k]
  ------------------
   62|      0|      return -1;
   63|       |
   64|  4.74k|   if (start > 7)
  ------------------
  |  Branch (64:8): [True: 0, False: 4.74k]
  ------------------
   65|      0|      return -1;
   66|       |
   67|  4.74k|   if (start + num_to_check > 8)
  ------------------
  |  Branch (67:8): [True: 0, False: 4.74k]
  ------------------
   68|      0|      num_to_check = 8 - start;
   69|       |
   70|  4.74k|   return memcmp(&sig[start], &png_signature[start], num_to_check);
   71|  4.74k|}
png_zalloc:
   79|  9.54k|{
   80|  9.54k|   png_alloc_size_t num_bytes = size;
   81|       |
   82|  9.54k|   if (png_ptr == NULL)
  ------------------
  |  Branch (82:8): [True: 0, False: 9.54k]
  ------------------
   83|      0|      return NULL;
   84|       |
   85|  9.54k|   if (items >= (~(png_alloc_size_t)0)/size)
  ------------------
  |  Branch (85:8): [True: 0, False: 9.54k]
  ------------------
   86|      0|   {
   87|      0|      png_warning (png_voidcast(png_structrp, png_ptr),
  ------------------
  |  |  544|      0|#  define png_voidcast(type, value) (value)
  ------------------
   88|      0|          "Potential overflow in png_zalloc()");
   89|      0|      return NULL;
   90|      0|   }
   91|       |
   92|  9.54k|   num_bytes *= items;
   93|  9.54k|   return png_malloc_warn(png_voidcast(png_structrp, png_ptr), num_bytes);
  ------------------
  |  |  544|  9.54k|#  define png_voidcast(type, value) (value)
  ------------------
   94|  9.54k|}
png_zfree:
   99|  9.54k|{
  100|  9.54k|   png_free(png_voidcast(png_const_structrp,png_ptr), ptr);
  ------------------
  |  |  544|  9.54k|#  define png_voidcast(type, value) (value)
  ------------------
  101|  9.54k|}
png_reset_crc:
  108|   102k|{
  109|       |   /* The cast is safe because the crc is a 32-bit value. */
  110|   102k|   png_ptr->crc = (png_uint_32)crc32(0, Z_NULL, 0);
  111|   102k|}
png_calculate_crc:
  120|  1.23M|{
  121|  1.23M|   int need_crc = 1;
  122|       |
  123|  1.23M|   if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0)
  ------------------
  |  |  922|  1.23M|#define PNG_CHUNK_ANCILLARY(c)   (1 & ((c) >> 29))
  ------------------
  |  Branch (123:8): [True: 1.21M, False: 20.2k]
  ------------------
  124|  1.21M|   {
  125|  1.21M|      if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
  ------------------
  |  |  736|  1.21M|#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
  |  |  ------------------
  |  |  |  |  712|  1.21M|#define PNG_FLAG_CRC_ANCILLARY_USE        0x0100U
  |  |  ------------------
  |  |  737|  1.21M|                                     PNG_FLAG_CRC_ANCILLARY_NOWARN)
  |  |  ------------------
  |  |  |  |  713|  1.21M|#define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200U
  |  |  ------------------
  ------------------
  |  Branch (125:11): [True: 0, False: 1.21M]
  ------------------
  126|  1.21M|          (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
  ------------------
  |  |  712|  1.21M|#define PNG_FLAG_CRC_ANCILLARY_USE        0x0100U
  ------------------
                        (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
  ------------------
  |  |  713|  1.21M|#define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200U
  ------------------
  127|      0|         need_crc = 0;
  128|  1.21M|   }
  129|       |
  130|  20.2k|   else /* critical */
  131|  20.2k|   {
  132|  20.2k|      if ((png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) != 0)
  ------------------
  |  |  715|  20.2k|#define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800U
  ------------------
  |  Branch (132:11): [True: 0, False: 20.2k]
  ------------------
  133|      0|         need_crc = 0;
  134|  20.2k|   }
  135|       |
  136|       |   /* 'uLong' is defined in zlib.h as unsigned long; this means that on some
  137|       |    * systems it is a 64-bit value.  crc32, however, returns 32 bits so the
  138|       |    * following cast is safe.  'uInt' may be no more than 16 bits, so it is
  139|       |    * necessary to perform a loop here.
  140|       |    */
  141|  1.23M|   if (need_crc != 0 && length > 0)
  ------------------
  |  Branch (141:8): [True: 1.23M, False: 0]
  |  Branch (141:25): [True: 1.19M, False: 43.7k]
  ------------------
  142|  1.19M|   {
  143|  1.19M|      uLong crc = png_ptr->crc; /* Should never issue a warning */
  144|       |
  145|  1.19M|      do
  146|  1.19M|      {
  147|  1.19M|         uInt safe_length = (uInt)length;
  148|  1.19M|#ifndef __COVERITY__
  149|  1.19M|         if (safe_length == 0)
  ------------------
  |  Branch (149:14): [True: 0, False: 1.19M]
  ------------------
  150|      0|            safe_length = (uInt)-1; /* evil, but safe */
  151|  1.19M|#endif
  152|       |
  153|  1.19M|         crc = crc32(crc, ptr, safe_length);
  154|       |
  155|       |         /* The following should never issue compiler warnings; if they do the
  156|       |          * target system has characteristics that will probably violate other
  157|       |          * assumptions within the libpng code.
  158|       |          */
  159|  1.19M|         ptr += safe_length;
  160|  1.19M|         length -= safe_length;
  161|  1.19M|      }
  162|  1.19M|      while (length > 0);
  ------------------
  |  Branch (162:14): [True: 0, False: 1.19M]
  ------------------
  163|       |
  164|       |      /* And the following is always safe because the crc is only 32 bits. */
  165|  1.19M|      png_ptr->crc = (png_uint_32)crc;
  166|  1.19M|   }
  167|  1.23M|}
png_user_version_check:
  174|  4.74k|{
  175|       |   /* Libpng versions 1.0.0 and later are binary compatible if the version
  176|       |    * string matches through the second '.'; we must recompile any
  177|       |    * applications that use any older library version.
  178|       |    */
  179|       |
  180|  4.74k|   if (user_png_ver != NULL)
  ------------------
  |  Branch (180:8): [True: 4.74k, False: 0]
  ------------------
  181|  4.74k|   {
  182|  4.74k|      int i = -1;
  183|  4.74k|      int found_dots = 0;
  184|       |
  185|  4.74k|      do
  186|  18.9k|      {
  187|  18.9k|         i++;
  188|  18.9k|         if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
  ------------------
  |  |  278|  18.9k|#define PNG_LIBPNG_VER_STRING "1.6.43"
  ------------------
  |  Branch (188:14): [True: 0, False: 18.9k]
  ------------------
  189|      0|            png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
  ------------------
  |  |  721|      0|#define PNG_FLAG_LIBRARY_MISMATCH        0x20000U
  ------------------
  190|  18.9k|         if (user_png_ver[i] == '.')
  ------------------
  |  Branch (190:14): [True: 9.49k, False: 9.49k]
  ------------------
  191|  9.49k|            found_dots++;
  192|  18.9k|      } while (found_dots < 2 && user_png_ver[i] != 0 &&
  ------------------
  |  Branch (192:16): [True: 14.2k, False: 4.74k]
  |  Branch (192:34): [True: 14.2k, False: 0]
  ------------------
  193|  18.9k|            PNG_LIBPNG_VER_STRING[i] != 0);
  ------------------
  |  |  278|  14.2k|#define PNG_LIBPNG_VER_STRING "1.6.43"
  ------------------
  |  Branch (193:13): [True: 14.2k, False: 0]
  ------------------
  194|  4.74k|   }
  195|       |
  196|      0|   else
  197|      0|      png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
  ------------------
  |  |  721|      0|#define PNG_FLAG_LIBRARY_MISMATCH        0x20000U
  ------------------
  198|       |
  199|  4.74k|   if ((png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) != 0)
  ------------------
  |  |  721|  4.74k|#define PNG_FLAG_LIBRARY_MISMATCH        0x20000U
  ------------------
  |  Branch (199:8): [True: 0, False: 4.74k]
  ------------------
  200|      0|   {
  201|      0|#ifdef PNG_WARNINGS_SUPPORTED
  202|      0|      size_t pos = 0;
  203|      0|      char m[128];
  204|       |
  205|      0|      pos = png_safecat(m, (sizeof m), pos,
  206|      0|          "Application built with libpng-");
  207|      0|      pos = png_safecat(m, (sizeof m), pos, user_png_ver);
  208|      0|      pos = png_safecat(m, (sizeof m), pos, " but running with ");
  209|      0|      pos = png_safecat(m, (sizeof m), pos, PNG_LIBPNG_VER_STRING);
  ------------------
  |  |  278|      0|#define PNG_LIBPNG_VER_STRING "1.6.43"
  ------------------
  210|      0|      PNG_UNUSED(pos)
  ------------------
  |  |  488|      0|#  define PNG_UNUSED(param) (void)param;
  ------------------
  211|       |
  212|      0|      png_warning(png_ptr, m);
  213|      0|#endif
  214|       |
  215|       |#ifdef PNG_ERROR_NUMBERS_SUPPORTED
  216|       |      png_ptr->flags = 0;
  217|       |#endif
  218|       |
  219|      0|      return 0;
  220|      0|   }
  221|       |
  222|       |   /* Success return. */
  223|  4.74k|   return 1;
  224|  4.74k|}
png_create_png_struct:
  233|  4.74k|{
  234|  4.74k|   png_struct create_struct;
  235|  4.74k|#  ifdef PNG_SETJMP_SUPPORTED
  236|  4.74k|      jmp_buf create_jmp_buf;
  237|  4.74k|#  endif
  238|       |
  239|       |   /* This temporary stack-allocated structure is used to provide a place to
  240|       |    * build enough context to allow the user provided memory allocator (if any)
  241|       |    * to be called.
  242|       |    */
  243|  4.74k|   memset(&create_struct, 0, (sizeof create_struct));
  244|       |
  245|       |   /* Added at libpng-1.2.6 */
  246|  4.74k|#  ifdef PNG_USER_LIMITS_SUPPORTED
  247|  4.74k|      create_struct.user_width_max = PNG_USER_WIDTH_MAX;
  ------------------
  |  |  215|  4.74k|#define PNG_USER_WIDTH_MAX 1000000
  ------------------
  248|  4.74k|      create_struct.user_height_max = PNG_USER_HEIGHT_MAX;
  ------------------
  |  |  214|  4.74k|#define PNG_USER_HEIGHT_MAX 1000000
  ------------------
  249|       |
  250|  4.74k|#     ifdef PNG_USER_CHUNK_CACHE_MAX
  251|       |      /* Added at libpng-1.2.43 and 1.4.0 */
  252|  4.74k|      create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
  ------------------
  |  |  212|  4.74k|#define PNG_USER_CHUNK_CACHE_MAX 1000
  ------------------
  253|  4.74k|#     endif
  254|       |
  255|  4.74k|#     ifdef PNG_USER_CHUNK_MALLOC_MAX
  256|       |      /* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
  257|       |       * in png_struct regardless.
  258|       |       */
  259|  4.74k|      create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
  ------------------
  |  |  213|  4.74k|#define PNG_USER_CHUNK_MALLOC_MAX 8000000
  ------------------
  260|  4.74k|#     endif
  261|  4.74k|#  endif
  262|       |
  263|       |   /* The following two API calls simply set fields in png_struct, so it is safe
  264|       |    * to do them now even though error handling is not yet set up.
  265|       |    */
  266|  4.74k|#  ifdef PNG_USER_MEM_SUPPORTED
  267|  4.74k|      png_set_mem_fn(&create_struct, mem_ptr, malloc_fn, free_fn);
  268|       |#  else
  269|       |      PNG_UNUSED(mem_ptr)
  270|       |      PNG_UNUSED(malloc_fn)
  271|       |      PNG_UNUSED(free_fn)
  272|       |#  endif
  273|       |
  274|       |   /* (*error_fn) can return control to the caller after the error_ptr is set,
  275|       |    * this will result in a memory leak unless the error_fn does something
  276|       |    * extremely sophisticated.  The design lacks merit but is implicit in the
  277|       |    * API.
  278|       |    */
  279|  4.74k|   png_set_error_fn(&create_struct, error_ptr, error_fn, warn_fn);
  280|       |
  281|  4.74k|#  ifdef PNG_SETJMP_SUPPORTED
  282|  4.74k|      if (!setjmp(create_jmp_buf))
  ------------------
  |  Branch (282:11): [True: 4.74k, False: 0]
  ------------------
  283|  4.74k|#  endif
  284|  4.74k|      {
  285|  4.74k|#  ifdef PNG_SETJMP_SUPPORTED
  286|       |         /* Temporarily fake out the longjmp information until we have
  287|       |          * successfully completed this function.  This only works if we have
  288|       |          * setjmp() support compiled in, but it is safe - this stuff should
  289|       |          * never happen.
  290|       |          */
  291|  4.74k|         create_struct.jmp_buf_ptr = &create_jmp_buf;
  292|  4.74k|         create_struct.jmp_buf_size = 0; /*stack allocation*/
  293|  4.74k|         create_struct.longjmp_fn = longjmp;
  294|  4.74k|#  endif
  295|       |         /* Call the general version checker (shared with read and write code):
  296|       |          */
  297|  4.74k|         if (png_user_version_check(&create_struct, user_png_ver) != 0)
  ------------------
  |  Branch (297:14): [True: 4.74k, False: 0]
  ------------------
  298|  4.74k|         {
  299|  4.74k|            png_structrp png_ptr = png_voidcast(png_structrp,
  ------------------
  |  |  544|  4.74k|#  define png_voidcast(type, value) (value)
  ------------------
  300|  4.74k|                png_malloc_warn(&create_struct, (sizeof *png_ptr)));
  301|       |
  302|  4.74k|            if (png_ptr != NULL)
  ------------------
  |  Branch (302:17): [True: 4.74k, False: 0]
  ------------------
  303|  4.74k|            {
  304|       |               /* png_ptr->zstream holds a back-pointer to the png_struct, so
  305|       |                * this can only be done now:
  306|       |                */
  307|  4.74k|               create_struct.zstream.zalloc = png_zalloc;
  308|  4.74k|               create_struct.zstream.zfree = png_zfree;
  309|  4.74k|               create_struct.zstream.opaque = png_ptr;
  310|       |
  311|  4.74k|#              ifdef PNG_SETJMP_SUPPORTED
  312|       |               /* Eliminate the local error handling: */
  313|  4.74k|               create_struct.jmp_buf_ptr = NULL;
  314|  4.74k|               create_struct.jmp_buf_size = 0;
  315|  4.74k|               create_struct.longjmp_fn = 0;
  316|  4.74k|#              endif
  317|       |
  318|  4.74k|               *png_ptr = create_struct;
  319|       |
  320|       |               /* This is the successful return point */
  321|  4.74k|               return png_ptr;
  322|  4.74k|            }
  323|  4.74k|         }
  324|  4.74k|      }
  325|       |
  326|       |   /* A longjmp because of a bug in the application storage allocator or a
  327|       |    * simple failure to allocate the png_struct.
  328|       |    */
  329|      0|   return NULL;
  330|  4.74k|}
png_create_info_struct:
  335|  4.74k|{
  336|  4.74k|   png_inforp info_ptr;
  337|       |
  338|  4.74k|   png_debug(1, "in png_create_info_struct");
  ------------------
  |  |  145|  4.74k|#  define png_debug(l, m) ((void)0)
  ------------------
  339|       |
  340|  4.74k|   if (png_ptr == NULL)
  ------------------
  |  Branch (340:8): [True: 0, False: 4.74k]
  ------------------
  341|      0|      return NULL;
  342|       |
  343|       |   /* Use the internal API that does not (or at least should not) error out, so
  344|       |    * that this call always returns ok.  The application typically sets up the
  345|       |    * error handling *after* creating the info_struct because this is the way it
  346|       |    * has always been done in 'example.c'.
  347|       |    */
  348|  4.74k|   info_ptr = png_voidcast(png_inforp, png_malloc_base(png_ptr,
  ------------------
  |  |  544|  4.74k|#  define png_voidcast(type, value) (value)
  ------------------
  349|  4.74k|       (sizeof *info_ptr)));
  350|       |
  351|  4.74k|   if (info_ptr != NULL)
  ------------------
  |  Branch (351:8): [True: 4.74k, False: 0]
  ------------------
  352|  4.74k|      memset(info_ptr, 0, (sizeof *info_ptr));
  353|       |
  354|  4.74k|   return info_ptr;
  355|  4.74k|}
png_destroy_info_struct:
  367|  9.49k|{
  368|  9.49k|   png_inforp info_ptr = NULL;
  369|       |
  370|  9.49k|   png_debug(1, "in png_destroy_info_struct");
  ------------------
  |  |  145|  9.49k|#  define png_debug(l, m) ((void)0)
  ------------------
  371|       |
  372|  9.49k|   if (png_ptr == NULL)
  ------------------
  |  Branch (372:8): [True: 0, False: 9.49k]
  ------------------
  373|      0|      return;
  374|       |
  375|  9.49k|   if (info_ptr_ptr != NULL)
  ------------------
  |  Branch (375:8): [True: 4.74k, False: 4.74k]
  ------------------
  376|  4.74k|      info_ptr = *info_ptr_ptr;
  377|       |
  378|  9.49k|   if (info_ptr != NULL)
  ------------------
  |  Branch (378:8): [True: 4.74k, False: 4.74k]
  ------------------
  379|  4.74k|   {
  380|       |      /* Do this first in case of an error below; if the app implements its own
  381|       |       * memory management this can lead to png_free calling png_error, which
  382|       |       * will abort this routine and return control to the app error handler.
  383|       |       * An infinite loop may result if it then tries to free the same info
  384|       |       * ptr.
  385|       |       */
  386|  4.74k|      *info_ptr_ptr = NULL;
  387|       |
  388|  4.74k|      png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
  ------------------
  |  | 1758|  4.74k|#define PNG_FREE_ALL  0xffffU
  ------------------
  389|  4.74k|      memset(info_ptr, 0, (sizeof *info_ptr));
  390|  4.74k|      png_free(png_ptr, info_ptr);
  391|  4.74k|   }
  392|  9.49k|}
png_free_data:
  452|  11.2k|{
  453|  11.2k|   png_debug(1, "in png_free_data");
  ------------------
  |  |  145|  11.2k|#  define png_debug(l, m) ((void)0)
  ------------------
  454|       |
  455|  11.2k|   if (png_ptr == NULL || info_ptr == NULL)
  ------------------
  |  Branch (455:8): [True: 0, False: 11.2k]
  |  Branch (455:27): [True: 0, False: 11.2k]
  ------------------
  456|      0|      return;
  457|       |
  458|  11.2k|#ifdef PNG_TEXT_SUPPORTED
  459|       |   /* Free text item num or (if num == -1) all text items */
  460|  11.2k|   if (info_ptr->text != NULL &&
  ------------------
  |  Branch (460:8): [True: 822, False: 10.4k]
  ------------------
  461|  11.2k|       ((mask & PNG_FREE_TEXT) & info_ptr->free_me) != 0)
  ------------------
  |  | 1756|    822|#define PNG_FREE_TEXT 0x4000U
  ------------------
  |  Branch (461:8): [True: 235, False: 587]
  ------------------
  462|    235|   {
  463|    235|      if (num != -1)
  ------------------
  |  Branch (463:11): [True: 0, False: 235]
  ------------------
  464|      0|      {
  465|      0|         png_free(png_ptr, info_ptr->text[num].key);
  466|      0|         info_ptr->text[num].key = NULL;
  467|      0|      }
  468|       |
  469|    235|      else
  470|    235|      {
  471|    235|         int i;
  472|       |
  473|  14.9k|         for (i = 0; i < info_ptr->num_text; i++)
  ------------------
  |  Branch (473:22): [True: 14.6k, False: 235]
  ------------------
  474|  14.6k|            png_free(png_ptr, info_ptr->text[i].key);
  475|       |
  476|    235|         png_free(png_ptr, info_ptr->text);
  477|    235|         info_ptr->text = NULL;
  478|    235|         info_ptr->num_text = 0;
  479|    235|         info_ptr->max_text = 0;
  480|    235|      }
  481|    235|   }
  482|  11.2k|#endif
  483|       |
  484|  11.2k|#ifdef PNG_tRNS_SUPPORTED
  485|       |   /* Free any tRNS entry */
  486|  11.2k|   if (((mask & PNG_FREE_TRNS) & info_ptr->free_me) != 0)
  ------------------
  |  | 1755|  11.2k|#define PNG_FREE_TRNS 0x2000U
  ------------------
  |  Branch (486:8): [True: 234, False: 11.0k]
  ------------------
  487|    234|   {
  488|    234|      info_ptr->valid &= ~PNG_INFO_tRNS;
  ------------------
  |  |  735|    234|#define PNG_INFO_tRNS 0x0010U
  ------------------
  489|    234|      png_free(png_ptr, info_ptr->trans_alpha);
  490|    234|      info_ptr->trans_alpha = NULL;
  491|    234|      info_ptr->num_trans = 0;
  492|    234|   }
  493|  11.2k|#endif
  494|       |
  495|  11.2k|#ifdef PNG_sCAL_SUPPORTED
  496|       |   /* Free any sCAL entry */
  497|  11.2k|   if (((mask & PNG_FREE_SCAL) & info_ptr->free_me) != 0)
  ------------------
  |  | 1749|  11.2k|#define PNG_FREE_SCAL 0x0100U
  ------------------
  |  Branch (497:8): [True: 14, False: 11.2k]
  ------------------
  498|     14|   {
  499|     14|      png_free(png_ptr, info_ptr->scal_s_width);
  500|     14|      png_free(png_ptr, info_ptr->scal_s_height);
  501|     14|      info_ptr->scal_s_width = NULL;
  502|     14|      info_ptr->scal_s_height = NULL;
  503|     14|      info_ptr->valid &= ~PNG_INFO_sCAL;
  ------------------
  |  |  745|     14|#define PNG_INFO_sCAL 0x4000U  /* ESR, 1.0.6 */
  ------------------
  504|     14|   }
  505|  11.2k|#endif
  506|       |
  507|  11.2k|#ifdef PNG_pCAL_SUPPORTED
  508|       |   /* Free any pCAL entry */
  509|  11.2k|   if (((mask & PNG_FREE_PCAL) & info_ptr->free_me) != 0)
  ------------------
  |  | 1748|  11.2k|#define PNG_FREE_PCAL 0x0080U
  ------------------
  |  Branch (509:8): [True: 14, False: 11.2k]
  ------------------
  510|     14|   {
  511|     14|      png_free(png_ptr, info_ptr->pcal_purpose);
  512|     14|      png_free(png_ptr, info_ptr->pcal_units);
  513|     14|      info_ptr->pcal_purpose = NULL;
  514|     14|      info_ptr->pcal_units = NULL;
  515|       |
  516|     14|      if (info_ptr->pcal_params != NULL)
  ------------------
  |  Branch (516:11): [True: 14, False: 0]
  ------------------
  517|     14|         {
  518|     14|            int i;
  519|       |
  520|     56|            for (i = 0; i < info_ptr->pcal_nparams; i++)
  ------------------
  |  Branch (520:25): [True: 42, False: 14]
  ------------------
  521|     42|               png_free(png_ptr, info_ptr->pcal_params[i]);
  522|       |
  523|     14|            png_free(png_ptr, info_ptr->pcal_params);
  524|     14|            info_ptr->pcal_params = NULL;
  525|     14|         }
  526|     14|      info_ptr->valid &= ~PNG_INFO_pCAL;
  ------------------
  |  |  741|     14|#define PNG_INFO_pCAL 0x0400U
  ------------------
  527|     14|   }
  528|  11.2k|#endif
  529|       |
  530|  11.2k|#ifdef PNG_iCCP_SUPPORTED
  531|       |   /* Free any profile entry */
  532|  11.2k|   if (((mask & PNG_FREE_ICCP) & info_ptr->free_me) != 0)
  ------------------
  |  | 1745|  11.2k|#define PNG_FREE_ICCP 0x0010U
  ------------------
  |  Branch (532:8): [True: 4.66k, False: 6.62k]
  ------------------
  533|  4.66k|   {
  534|  4.66k|      png_free(png_ptr, info_ptr->iccp_name);
  535|  4.66k|      png_free(png_ptr, info_ptr->iccp_profile);
  536|  4.66k|      info_ptr->iccp_name = NULL;
  537|  4.66k|      info_ptr->iccp_profile = NULL;
  538|  4.66k|      info_ptr->valid &= ~PNG_INFO_iCCP;
  ------------------
  |  |  743|  4.66k|#define PNG_INFO_iCCP 0x1000U  /* ESR, 1.0.6 */
  ------------------
  539|  4.66k|   }
  540|  11.2k|#endif
  541|       |
  542|  11.2k|#ifdef PNG_sPLT_SUPPORTED
  543|       |   /* Free a given sPLT entry, or (if num == -1) all sPLT entries */
  544|  11.2k|   if (info_ptr->splt_palettes != NULL &&
  ------------------
  |  Branch (544:8): [True: 690, False: 10.6k]
  ------------------
  545|  11.2k|       ((mask & PNG_FREE_SPLT) & info_ptr->free_me) != 0)
  ------------------
  |  | 1746|    690|#define PNG_FREE_SPLT 0x0020U
  ------------------
  |  Branch (545:8): [True: 60, False: 630]
  ------------------
  546|     60|   {
  547|     60|      if (num != -1)
  ------------------
  |  Branch (547:11): [True: 0, False: 60]
  ------------------
  548|      0|      {
  549|      0|         png_free(png_ptr, info_ptr->splt_palettes[num].name);
  550|      0|         png_free(png_ptr, info_ptr->splt_palettes[num].entries);
  551|      0|         info_ptr->splt_palettes[num].name = NULL;
  552|      0|         info_ptr->splt_palettes[num].entries = NULL;
  553|      0|      }
  554|       |
  555|     60|      else
  556|     60|      {
  557|     60|         int i;
  558|       |
  559|  1.59k|         for (i = 0; i < info_ptr->splt_palettes_num; i++)
  ------------------
  |  Branch (559:22): [True: 1.53k, False: 60]
  ------------------
  560|  1.53k|         {
  561|  1.53k|            png_free(png_ptr, info_ptr->splt_palettes[i].name);
  562|  1.53k|            png_free(png_ptr, info_ptr->splt_palettes[i].entries);
  563|  1.53k|         }
  564|       |
  565|     60|         png_free(png_ptr, info_ptr->splt_palettes);
  566|     60|         info_ptr->splt_palettes = NULL;
  567|     60|         info_ptr->splt_palettes_num = 0;
  568|     60|         info_ptr->valid &= ~PNG_INFO_sPLT;
  ------------------
  |  |  744|     60|#define PNG_INFO_sPLT 0x2000U  /* ESR, 1.0.6 */
  ------------------
  569|     60|      }
  570|     60|   }
  571|  11.2k|#endif
  572|       |
  573|  11.2k|#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
  574|  11.2k|   if (info_ptr->unknown_chunks != NULL &&
  ------------------
  |  Branch (574:8): [True: 0, False: 11.2k]
  ------------------
  575|  11.2k|       ((mask & PNG_FREE_UNKN) & info_ptr->free_me) != 0)
  ------------------
  |  | 1751|      0|#  define PNG_FREE_UNKN 0x0200U
  ------------------
  |  Branch (575:8): [True: 0, False: 0]
  ------------------
  576|      0|   {
  577|      0|      if (num != -1)
  ------------------
  |  Branch (577:11): [True: 0, False: 0]
  ------------------
  578|      0|      {
  579|      0|          png_free(png_ptr, info_ptr->unknown_chunks[num].data);
  580|      0|          info_ptr->unknown_chunks[num].data = NULL;
  581|      0|      }
  582|       |
  583|      0|      else
  584|      0|      {
  585|      0|         int i;
  586|       |
  587|      0|         for (i = 0; i < info_ptr->unknown_chunks_num; i++)
  ------------------
  |  Branch (587:22): [True: 0, False: 0]
  ------------------
  588|      0|            png_free(png_ptr, info_ptr->unknown_chunks[i].data);
  589|       |
  590|      0|         png_free(png_ptr, info_ptr->unknown_chunks);
  591|      0|         info_ptr->unknown_chunks = NULL;
  592|      0|         info_ptr->unknown_chunks_num = 0;
  593|      0|      }
  594|      0|   }
  595|  11.2k|#endif
  596|       |
  597|  11.2k|#ifdef PNG_eXIf_SUPPORTED
  598|       |   /* Free any eXIf entry */
  599|  11.2k|   if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0)
  ------------------
  |  | 1757|  11.2k|#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */
  ------------------
  |  Branch (599:8): [True: 86, False: 11.2k]
  ------------------
  600|     86|   {
  601|     86|# ifdef PNG_READ_eXIf_SUPPORTED
  602|     86|      if (info_ptr->eXIf_buf)
  ------------------
  |  Branch (602:11): [True: 61, False: 25]
  ------------------
  603|     61|      {
  604|     61|         png_free(png_ptr, info_ptr->eXIf_buf);
  605|     61|         info_ptr->eXIf_buf = NULL;
  606|     61|      }
  607|     86|# endif
  608|     86|      if (info_ptr->exif)
  ------------------
  |  Branch (608:11): [True: 8, False: 78]
  ------------------
  609|      8|      {
  610|      8|         png_free(png_ptr, info_ptr->exif);
  611|      8|         info_ptr->exif = NULL;
  612|      8|      }
  613|     86|      info_ptr->valid &= ~PNG_INFO_eXIf;
  ------------------
  |  |  747|     86|#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
  ------------------
  614|     86|   }
  615|  11.2k|#endif
  616|       |
  617|  11.2k|#ifdef PNG_hIST_SUPPORTED
  618|       |   /* Free any hIST entry */
  619|  11.2k|   if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0)
  ------------------
  |  | 1744|  11.2k|#define PNG_FREE_HIST 0x0008U
  ------------------
  |  Branch (619:8): [True: 12, False: 11.2k]
  ------------------
  620|     12|   {
  621|     12|      png_free(png_ptr, info_ptr->hist);
  622|     12|      info_ptr->hist = NULL;
  623|     12|      info_ptr->valid &= ~PNG_INFO_hIST;
  ------------------
  |  |  737|     12|#define PNG_INFO_hIST 0x0040U
  ------------------
  624|     12|   }
  625|  11.2k|#endif
  626|       |
  627|       |   /* Free any PLTE entry that was internally allocated */
  628|  11.2k|   if (((mask & PNG_FREE_PLTE) & info_ptr->free_me) != 0)
  ------------------
  |  | 1754|  11.2k|#define PNG_FREE_PLTE 0x1000U
  ------------------
  |  Branch (628:8): [True: 234, False: 11.0k]
  ------------------
  629|    234|   {
  630|    234|      png_free(png_ptr, info_ptr->palette);
  631|    234|      info_ptr->palette = NULL;
  632|    234|      info_ptr->valid &= ~PNG_INFO_PLTE;
  ------------------
  |  |  734|    234|#define PNG_INFO_PLTE 0x0008U
  ------------------
  633|    234|      info_ptr->num_palette = 0;
  634|    234|   }
  635|       |
  636|  11.2k|#ifdef PNG_INFO_IMAGE_SUPPORTED
  637|       |   /* Free any image bits attached to the info structure */
  638|  11.2k|   if (((mask & PNG_FREE_ROWS) & info_ptr->free_me) != 0)
  ------------------
  |  | 1747|  11.2k|#define PNG_FREE_ROWS 0x0040U
  ------------------
  |  Branch (638:8): [True: 0, False: 11.2k]
  ------------------
  639|      0|   {
  640|      0|      if (info_ptr->row_pointers != NULL)
  ------------------
  |  Branch (640:11): [True: 0, False: 0]
  ------------------
  641|      0|      {
  642|      0|         png_uint_32 row;
  643|      0|         for (row = 0; row < info_ptr->height; row++)
  ------------------
  |  Branch (643:24): [True: 0, False: 0]
  ------------------
  644|      0|            png_free(png_ptr, info_ptr->row_pointers[row]);
  645|       |
  646|      0|         png_free(png_ptr, info_ptr->row_pointers);
  647|      0|         info_ptr->row_pointers = NULL;
  648|      0|      }
  649|      0|      info_ptr->valid &= ~PNG_INFO_IDAT;
  ------------------
  |  |  746|      0|#define PNG_INFO_IDAT 0x8000U  /* ESR, 1.0.6 */
  ------------------
  650|      0|   }
  651|  11.2k|#endif
  652|       |
  653|  11.2k|   if (num != -1)
  ------------------
  |  Branch (653:8): [True: 5.15k, False: 6.14k]
  ------------------
  654|  5.15k|      mask &= ~PNG_FREE_MUL;
  ------------------
  |  | 1759|  5.15k|#define PNG_FREE_MUL  0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
  ------------------
  655|       |
  656|  11.2k|   info_ptr->free_me &= ~mask;
  657|  11.2k|}
png_get_io_ptr:
  666|  1.34M|{
  667|  1.34M|   if (png_ptr == NULL)
  ------------------
  |  Branch (667:8): [True: 0, False: 1.34M]
  ------------------
  668|      0|      return NULL;
  669|       |
  670|  1.34M|   return png_ptr->io_ptr;
  671|  1.34M|}
png_handle_as_unknown:
  906|  96.4k|{
  907|       |   /* Check chunk_name and return "keep" value if it's on the list, else 0 */
  908|  96.4k|   png_const_bytep p, p_end;
  909|       |
  910|  96.4k|   if (png_ptr == NULL || chunk_name == NULL || png_ptr->num_chunk_list == 0)
  ------------------
  |  Branch (910:8): [True: 0, False: 96.4k]
  |  Branch (910:27): [True: 0, False: 96.4k]
  |  Branch (910:49): [True: 96.4k, False: 0]
  ------------------
  911|  96.4k|      return PNG_HANDLE_CHUNK_AS_DEFAULT;
  ------------------
  |  | 2341|  96.4k|#define PNG_HANDLE_CHUNK_AS_DEFAULT   0
  ------------------
  912|       |
  913|      0|   p_end = png_ptr->chunk_list;
  914|      0|   p = p_end + png_ptr->num_chunk_list*5; /* beyond end */
  915|       |
  916|       |   /* The code is the fifth byte after each four byte string.  Historically this
  917|       |    * code was always searched from the end of the list, this is no longer
  918|       |    * necessary because the 'set' routine handles duplicate entries correctly.
  919|       |    */
  920|      0|   do /* num_chunk_list > 0, so at least one */
  921|      0|   {
  922|      0|      p -= 5;
  923|       |
  924|      0|      if (memcmp(chunk_name, p, 4) == 0)
  ------------------
  |  Branch (924:11): [True: 0, False: 0]
  ------------------
  925|      0|         return p[4];
  926|      0|   }
  927|      0|   while (p > p_end);
  ------------------
  |  Branch (927:11): [True: 0, False: 0]
  ------------------
  928|       |
  929|       |   /* This means that known chunks should be processed and unknown chunks should
  930|       |    * be handled according to the value of png_ptr->unknown_default; this can be
  931|       |    * confusing because, as a result, there are two levels of defaulting for
  932|       |    * unknown chunks.
  933|       |    */
  934|      0|   return PNG_HANDLE_CHUNK_AS_DEFAULT;
  ------------------
  |  | 2341|      0|#define PNG_HANDLE_CHUNK_AS_DEFAULT   0
  ------------------
  935|      0|}
png_chunk_unknown_handling:
  941|  96.4k|{
  942|  96.4k|   png_byte chunk_string[5];
  943|       |
  944|  96.4k|   PNG_CSTRING_FROM_CHUNK(chunk_string, chunk_name);
  ------------------
  |  |  919|  96.4k|   (void)(PNG_STRING_FROM_CHUNK(s,c), ((char*)(s))[4] = 0)
  |  |  ------------------
  |  |  |  |  912|  96.4k|   (void)(((char*)(s))[0]=(char)(((c)>>24) & 0xff), \
  |  |  |  |  913|  96.4k|   ((char*)(s))[1]=(char)(((c)>>16) & 0xff),\
  |  |  |  |  914|  96.4k|   ((char*)(s))[2]=(char)(((c)>>8) & 0xff), \
  |  |  |  |  915|  96.4k|   ((char*)(s))[3]=(char)((c & 0xff)))
  |  |  ------------------
  ------------------
  945|  96.4k|   return png_handle_as_unknown(png_ptr, chunk_string);
  946|  96.4k|}
png_zstream_error:
  978|  21.3k|{
  979|       |   /* Translate 'ret' into an appropriate error string, priority is given to the
  980|       |    * one in zstream if set.  This always returns a string, even in cases like
  981|       |    * Z_OK or Z_STREAM_END where the error code is a success code.
  982|       |    */
  983|  21.3k|   if (png_ptr->zstream.msg == NULL) switch (ret)
  ------------------
  |  Branch (983:8): [True: 10.0k, False: 11.3k]
  ------------------
  984|  10.0k|   {
  985|      0|      default:
  ------------------
  |  Branch (985:7): [True: 0, False: 10.0k]
  ------------------
  986|  5.01k|      case Z_OK:
  ------------------
  |  Branch (986:7): [True: 5.01k, False: 5.04k]
  ------------------
  987|  5.01k|         png_ptr->zstream.msg = PNGZ_MSG_CAST("unexpected zlib return code");
  ------------------
  |  |   43|  5.01k|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
  988|  5.01k|         break;
  989|       |
  990|  4.11k|      case Z_STREAM_END:
  ------------------
  |  Branch (990:7): [True: 4.11k, False: 5.93k]
  ------------------
  991|       |         /* Normal exit */
  992|  4.11k|         png_ptr->zstream.msg = PNGZ_MSG_CAST("unexpected end of LZ stream");
  ------------------
  |  |   43|  4.11k|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
  993|  4.11k|         break;
  994|       |
  995|      3|      case Z_NEED_DICT:
  ------------------
  |  Branch (995:7): [True: 3, False: 10.0k]
  ------------------
  996|       |         /* This means the deflate stream did not have a dictionary; this
  997|       |          * indicates a bogus PNG.
  998|       |          */
  999|      3|         png_ptr->zstream.msg = PNGZ_MSG_CAST("missing LZ dictionary");
  ------------------
  |  |   43|      3|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
 1000|      3|         break;
 1001|       |
 1002|      0|      case Z_ERRNO:
  ------------------
  |  Branch (1002:7): [True: 0, False: 10.0k]
  ------------------
 1003|       |         /* gz APIs only: should not happen */
 1004|      0|         png_ptr->zstream.msg = PNGZ_MSG_CAST("zlib IO error");
  ------------------
  |  |   43|      0|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
 1005|      0|         break;
 1006|       |
 1007|      0|      case Z_STREAM_ERROR:
  ------------------
  |  Branch (1007:7): [True: 0, False: 10.0k]
  ------------------
 1008|       |         /* internal libpng error */
 1009|      0|         png_ptr->zstream.msg = PNGZ_MSG_CAST("bad parameters to zlib");
  ------------------
  |  |   43|      0|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
 1010|      0|         break;
 1011|       |
 1012|      0|      case Z_DATA_ERROR:
  ------------------
  |  Branch (1012:7): [True: 0, False: 10.0k]
  ------------------
 1013|      0|         png_ptr->zstream.msg = PNGZ_MSG_CAST("damaged LZ stream");
  ------------------
  |  |   43|      0|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
 1014|      0|         break;
 1015|       |
 1016|      0|      case Z_MEM_ERROR:
  ------------------
  |  Branch (1016:7): [True: 0, False: 10.0k]
  ------------------
 1017|      0|         png_ptr->zstream.msg = PNGZ_MSG_CAST("insufficient memory");
  ------------------
  |  |   43|      0|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
 1018|      0|         break;
 1019|       |
 1020|    922|      case Z_BUF_ERROR:
  ------------------
  |  Branch (1020:7): [True: 922, False: 9.12k]
  ------------------
 1021|       |         /* End of input or output; not a problem if the caller is doing
 1022|       |          * incremental read or write.
 1023|       |          */
 1024|    922|         png_ptr->zstream.msg = PNGZ_MSG_CAST("truncated");
  ------------------
  |  |   43|    922|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
 1025|    922|         break;
 1026|       |
 1027|      0|      case Z_VERSION_ERROR:
  ------------------
  |  Branch (1027:7): [True: 0, False: 10.0k]
  ------------------
 1028|      0|         png_ptr->zstream.msg = PNGZ_MSG_CAST("unsupported zlib version");
  ------------------
  |  |   43|      0|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
 1029|      0|         break;
 1030|       |
 1031|      0|      case PNG_UNEXPECTED_ZLIB_RETURN:
  ------------------
  |  |  998|      0|#define PNG_UNEXPECTED_ZLIB_RETURN (-7)
  ------------------
  |  Branch (1031:7): [True: 0, False: 10.0k]
  ------------------
 1032|       |         /* Compile errors here mean that zlib now uses the value co-opted in
 1033|       |          * pngpriv.h for PNG_UNEXPECTED_ZLIB_RETURN; update the switch above
 1034|       |          * and change pngpriv.h.  Note that this message is "... return",
 1035|       |          * whereas the default/Z_OK one is "... return code".
 1036|       |          */
 1037|      0|         png_ptr->zstream.msg = PNGZ_MSG_CAST("unexpected zlib return");
  ------------------
  |  |   43|      0|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
 1038|      0|         break;
 1039|  10.0k|   }
 1040|  21.3k|}
png_colorspace_set_gamma:
 1095|  1.58k|{
 1096|       |   /* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
 1097|       |    * occur.  Since the fixed point representation is asymmetrical it is
 1098|       |    * possible for 1/gamma to overflow the limit of 21474 and this means the
 1099|       |    * gamma value must be at least 5/100000 and hence at most 20000.0.  For
 1100|       |    * safety the limits here are a little narrower.  The values are 0.00016 to
 1101|       |    * 6250.0, which are truly ridiculous gamma values (and will produce
 1102|       |    * displays that are all black or all white.)
 1103|       |    *
 1104|       |    * In 1.6.0 this test replaces the ones in pngrutil.c, in the gAMA chunk
 1105|       |    * handling code, which only required the value to be >0.
 1106|       |    */
 1107|  1.58k|   png_const_charp errmsg;
 1108|       |
 1109|  1.58k|   if (gAMA < 16 || gAMA > 625000000)
  ------------------
  |  Branch (1109:8): [True: 349, False: 1.23k]
  |  Branch (1109:21): [True: 193, False: 1.04k]
  ------------------
 1110|    542|      errmsg = "gamma value out of range";
 1111|       |
 1112|  1.04k|#  ifdef PNG_READ_gAMA_SUPPORTED
 1113|       |   /* Allow the application to set the gamma value more than once */
 1114|  1.04k|   else if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
  ------------------
  |  |  664|  1.04k|#define PNG_IS_READ_STRUCT        0x8000U /* Else is a write struct */
  ------------------
  |  Branch (1114:13): [True: 1.04k, False: 0]
  ------------------
 1115|  1.04k|      (colorspace->flags & PNG_COLORSPACE_FROM_gAMA) != 0)
  ------------------
  |  |  134|  1.04k|#define PNG_COLORSPACE_FROM_gAMA            0x0008
  ------------------
  |  Branch (1115:7): [True: 245, False: 796]
  ------------------
 1116|    245|      errmsg = "duplicate";
 1117|    796|#  endif
 1118|       |
 1119|       |   /* Do nothing if the colorspace is already invalid */
 1120|    796|   else if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
  ------------------
  |  |  139|    796|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
  |  Branch (1120:13): [True: 139, False: 657]
  ------------------
 1121|    139|      return;
 1122|       |
 1123|    657|   else
 1124|    657|   {
 1125|    657|      if (png_colorspace_check_gamma(png_ptr, colorspace, gAMA,
  ------------------
  |  Branch (1125:11): [True: 74, False: 583]
  ------------------
 1126|    657|          1/*from gAMA*/) != 0)
 1127|     74|      {
 1128|       |         /* Store this gamma value. */
 1129|     74|         colorspace->gamma = gAMA;
 1130|     74|         colorspace->flags |=
 1131|     74|            (PNG_COLORSPACE_HAVE_GAMMA | PNG_COLORSPACE_FROM_gAMA);
  ------------------
  |  |  131|     74|#define PNG_COLORSPACE_HAVE_GAMMA           0x0001
  ------------------
                          (PNG_COLORSPACE_HAVE_GAMMA | PNG_COLORSPACE_FROM_gAMA);
  ------------------
  |  |  134|     74|#define PNG_COLORSPACE_FROM_gAMA            0x0008
  ------------------
 1132|     74|      }
 1133|       |
 1134|       |      /* At present if the check_gamma test fails the gamma of the colorspace is
 1135|       |       * not updated however the colorspace is not invalidated.  This
 1136|       |       * corresponds to the case where the existing gamma comes from an sRGB
 1137|       |       * chunk or profile.  An error message has already been output.
 1138|       |       */
 1139|    657|      return;
 1140|    657|   }
 1141|       |
 1142|       |   /* Error exit - errmsg has been set. */
 1143|    787|   colorspace->flags |= PNG_COLORSPACE_INVALID;
  ------------------
  |  |  139|    787|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
 1144|    787|   png_chunk_report(png_ptr, errmsg, PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|    787|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
 1145|    787|}
png_colorspace_sync_info:
 1149|  6.88k|{
 1150|  6.88k|   if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
  ------------------
  |  |  139|  6.88k|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
  |  Branch (1150:8): [True: 1.39k, False: 5.49k]
  ------------------
 1151|  1.39k|   {
 1152|       |      /* Everything is invalid */
 1153|  1.39k|      info_ptr->valid &= ~(PNG_INFO_gAMA|PNG_INFO_cHRM|PNG_INFO_sRGB|
  ------------------
  |  |  731|  1.39k|#define PNG_INFO_gAMA 0x0001U
  ------------------
                    info_ptr->valid &= ~(PNG_INFO_gAMA|PNG_INFO_cHRM|PNG_INFO_sRGB|
  ------------------
  |  |  733|  1.39k|#define PNG_INFO_cHRM 0x0004U
  ------------------
                    info_ptr->valid &= ~(PNG_INFO_gAMA|PNG_INFO_cHRM|PNG_INFO_sRGB|
  ------------------
  |  |  742|  1.39k|#define PNG_INFO_sRGB 0x0800U  /* GR-P, 0.96a */
  ------------------
 1154|  1.39k|         PNG_INFO_iCCP);
  ------------------
  |  |  743|  1.39k|#define PNG_INFO_iCCP 0x1000U  /* ESR, 1.0.6 */
  ------------------
 1155|       |
 1156|  1.39k|#     ifdef PNG_COLORSPACE_SUPPORTED
 1157|       |      /* Clean up the iCCP profile now if it won't be used. */
 1158|  1.39k|      png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, -1/*not used*/);
  ------------------
  |  | 1745|  1.39k|#define PNG_FREE_ICCP 0x0010U
  ------------------
 1159|       |#     else
 1160|       |      PNG_UNUSED(png_ptr)
 1161|       |#     endif
 1162|  1.39k|   }
 1163|       |
 1164|  5.49k|   else
 1165|  5.49k|   {
 1166|  5.49k|#     ifdef PNG_COLORSPACE_SUPPORTED
 1167|       |      /* Leave the INFO_iCCP flag set if the pngset.c code has already set
 1168|       |       * it; this allows a PNG to contain a profile which matches sRGB and
 1169|       |       * yet still have that profile retrievable by the application.
 1170|       |       */
 1171|  5.49k|      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_MATCHES_sRGB) != 0)
  ------------------
  |  |  138|  5.49k|#define PNG_COLORSPACE_MATCHES_sRGB         0x0080 /* exact match on profile */
  ------------------
  |  Branch (1171:11): [True: 674, False: 4.81k]
  ------------------
 1172|    674|         info_ptr->valid |= PNG_INFO_sRGB;
  ------------------
  |  |  742|    674|#define PNG_INFO_sRGB 0x0800U  /* GR-P, 0.96a */
  ------------------
 1173|       |
 1174|  4.81k|      else
 1175|  4.81k|         info_ptr->valid &= ~PNG_INFO_sRGB;
  ------------------
  |  |  742|  4.81k|#define PNG_INFO_sRGB 0x0800U  /* GR-P, 0.96a */
  ------------------
 1176|       |
 1177|  5.49k|      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
  ------------------
  |  |  132|  5.49k|#define PNG_COLORSPACE_HAVE_ENDPOINTS       0x0002
  ------------------
  |  Branch (1177:11): [True: 793, False: 4.69k]
  ------------------
 1178|    793|         info_ptr->valid |= PNG_INFO_cHRM;
  ------------------
  |  |  733|    793|#define PNG_INFO_cHRM 0x0004U
  ------------------
 1179|       |
 1180|  4.69k|      else
 1181|  4.69k|         info_ptr->valid &= ~PNG_INFO_cHRM;
  ------------------
  |  |  733|  4.69k|#define PNG_INFO_cHRM 0x0004U
  ------------------
 1182|  5.49k|#     endif
 1183|       |
 1184|  5.49k|      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0)
  ------------------
  |  |  131|  5.49k|#define PNG_COLORSPACE_HAVE_GAMMA           0x0001
  ------------------
  |  Branch (1184:11): [True: 753, False: 4.73k]
  ------------------
 1185|    753|         info_ptr->valid |= PNG_INFO_gAMA;
  ------------------
  |  |  731|    753|#define PNG_INFO_gAMA 0x0001U
  ------------------
 1186|       |
 1187|  4.73k|      else
 1188|  4.73k|         info_ptr->valid &= ~PNG_INFO_gAMA;
  ------------------
  |  |  731|  4.73k|#define PNG_INFO_gAMA 0x0001U
  ------------------
 1189|  5.49k|   }
 1190|  6.88k|}
png_colorspace_sync:
 1195|  6.88k|{
 1196|  6.88k|   if (info_ptr == NULL) /* reduce code size; check here not in the caller */
  ------------------
  |  Branch (1196:8): [True: 0, False: 6.88k]
  ------------------
 1197|      0|      return;
 1198|       |
 1199|  6.88k|   info_ptr->colorspace = png_ptr->colorspace;
 1200|  6.88k|   png_colorspace_sync_info(png_ptr, info_ptr);
 1201|  6.88k|}
png_colorspace_set_chromaticities:
 1701|    362|{
 1702|       |   /* We must check the end points to ensure they are reasonable - in the past
 1703|       |    * color management systems have crashed as a result of getting bogus
 1704|       |    * colorant values, while this isn't the fault of libpng it is the
 1705|       |    * responsibility of libpng because PNG carries the bomb and libpng is in a
 1706|       |    * position to protect against it.
 1707|       |    */
 1708|    362|   png_XYZ XYZ;
 1709|       |
 1710|    362|   switch (png_colorspace_check_xy(&XYZ, xy))
 1711|    362|   {
 1712|     88|      case 0: /* success */
  ------------------
  |  Branch (1712:7): [True: 88, False: 274]
  ------------------
 1713|     88|         return png_colorspace_set_xy_and_XYZ(png_ptr, colorspace, xy, &XYZ,
 1714|     88|             preferred);
 1715|       |
 1716|    274|      case 1:
  ------------------
  |  Branch (1716:7): [True: 274, False: 88]
  ------------------
 1717|       |         /* We can't invert the chromaticities so we can't produce value XYZ
 1718|       |          * values.  Likely as not a color management system will fail too.
 1719|       |          */
 1720|    274|         colorspace->flags |= PNG_COLORSPACE_INVALID;
  ------------------
  |  |  139|    274|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
 1721|    274|         png_benign_error(png_ptr, "invalid chromaticities");
 1722|    274|         break;
 1723|       |
 1724|      0|      default:
  ------------------
  |  Branch (1724:7): [True: 0, False: 362]
  ------------------
 1725|       |         /* libpng is broken; this should be a warning but if it happens we
 1726|       |          * want error reports so for the moment it is an error.
 1727|       |          */
 1728|      0|         colorspace->flags |= PNG_COLORSPACE_INVALID;
  ------------------
  |  |  139|      0|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
 1729|      0|         png_error(png_ptr, "internal error checking chromaticities");
 1730|    362|   }
 1731|       |
 1732|    274|   return 0; /* failed */
 1733|    362|}
png_colorspace_set_sRGB:
 1853|    111|{
 1854|       |   /* sRGB sets known gamma, end points and (from the chunk) intent. */
 1855|       |   /* IMPORTANT: these are not necessarily the values found in an ICC profile
 1856|       |    * because ICC profiles store values adapted to a D50 environment; it is
 1857|       |    * expected that the ICC profile mediaWhitePointTag will be D50; see the
 1858|       |    * checks and code elsewhere to understand this better.
 1859|       |    *
 1860|       |    * These XYZ values, which are accurate to 5dp, produce rgb to gray
 1861|       |    * coefficients of (6968,23435,2366), which are reduced (because they add up
 1862|       |    * to 32769 not 32768) to (6968,23434,2366).  These are the values that
 1863|       |    * libpng has traditionally used (and are the best values given the 15bit
 1864|       |    * algorithm used by the rgb to gray code.)
 1865|       |    */
 1866|    111|   static const png_XYZ sRGB_XYZ = /* D65 XYZ (*not* the D50 adapted values!) */
 1867|    111|   {
 1868|       |      /* color      X      Y      Z */
 1869|    111|      /* red   */ 41239, 21264,  1933,
 1870|    111|      /* green */ 35758, 71517, 11919,
 1871|    111|      /* blue  */ 18048,  7219, 95053
 1872|    111|   };
 1873|       |
 1874|       |   /* Do nothing if the colorspace is already invalidated. */
 1875|    111|   if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
  ------------------
  |  |  139|    111|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
  |  Branch (1875:8): [True: 0, False: 111]
  ------------------
 1876|      0|      return 0;
 1877|       |
 1878|       |   /* Check the intent, then check for existing settings.  It is valid for the
 1879|       |    * PNG file to have cHRM or gAMA chunks along with sRGB, but the values must
 1880|       |    * be consistent with the correct values.  If, however, this function is
 1881|       |    * called below because an iCCP chunk matches sRGB then it is quite
 1882|       |    * conceivable that an older app recorded incorrect gAMA and cHRM because of
 1883|       |    * an incorrect calculation based on the values in the profile - this does
 1884|       |    * *not* invalidate the profile (though it still produces an error, which can
 1885|       |    * be ignored.)
 1886|       |    */
 1887|    111|   if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST)
  ------------------
  |  |  718|    111|#define PNG_sRGB_INTENT_LAST       4 /* Not a valid value */
  ------------------
  |  Branch (1887:8): [True: 0, False: 111]
  |  Branch (1887:22): [True: 26, False: 85]
  ------------------
 1888|     26|      return png_icc_profile_error(png_ptr, colorspace, "sRGB",
 1889|     26|          (png_alloc_size_t)intent, "invalid sRGB rendering intent");
 1890|       |
 1891|     85|   if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 &&
  ------------------
  |  |  133|     85|#define PNG_COLORSPACE_HAVE_INTENT          0x0004
  ------------------
  |  Branch (1891:8): [True: 0, False: 85]
  ------------------
 1892|     85|       colorspace->rendering_intent != intent)
  ------------------
  |  Branch (1892:8): [True: 0, False: 0]
  ------------------
 1893|      0|      return png_icc_profile_error(png_ptr, colorspace, "sRGB",
 1894|      0|         (png_alloc_size_t)intent, "inconsistent rendering intents");
 1895|       |
 1896|     85|   if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0)
  ------------------
  |  |  136|     85|#define PNG_COLORSPACE_FROM_sRGB            0x0020
  ------------------
  |  Branch (1896:8): [True: 0, False: 85]
  ------------------
 1897|      0|   {
 1898|      0|      png_benign_error(png_ptr, "duplicate sRGB information ignored");
 1899|      0|      return 0;
 1900|      0|   }
 1901|       |
 1902|       |   /* If the standard sRGB cHRM chunk does not match the one from the PNG file
 1903|       |    * warn but overwrite the value with the correct one.
 1904|       |    */
 1905|     85|   if ((colorspace->flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0 &&
  ------------------
  |  |  132|     85|#define PNG_COLORSPACE_HAVE_ENDPOINTS       0x0002
  ------------------
  |  Branch (1905:8): [True: 13, False: 72]
  ------------------
 1906|     85|       !png_colorspace_endpoints_match(&sRGB_xy, &colorspace->end_points_xy,
  ------------------
  |  Branch (1906:8): [True: 9, False: 4]
  ------------------
 1907|     13|       100))
 1908|      9|      png_chunk_report(png_ptr, "cHRM chunk does not match sRGB",
 1909|      9|         PNG_CHUNK_ERROR);
  ------------------
  |  | 1903|      9|#define PNG_CHUNK_ERROR       2 /* always an error */
  ------------------
 1910|       |
 1911|       |   /* This check is just done for the error reporting - the routine always
 1912|       |    * returns true when the 'from' argument corresponds to sRGB (2).
 1913|       |    */
 1914|     85|   (void)png_colorspace_check_gamma(png_ptr, colorspace, PNG_GAMMA_sRGB_INVERSE,
  ------------------
  |  |  931|     85|#define PNG_GAMMA_sRGB_INVERSE 45455
  ------------------
 1915|     85|       2/*from sRGB*/);
 1916|       |
 1917|       |   /* intent: bugs in GCC force 'int' to be used as the parameter type. */
 1918|     85|   colorspace->rendering_intent = (png_uint_16)intent;
 1919|     85|   colorspace->flags |= PNG_COLORSPACE_HAVE_INTENT;
  ------------------
  |  |  133|     85|#define PNG_COLORSPACE_HAVE_INTENT          0x0004
  ------------------
 1920|       |
 1921|       |   /* endpoints */
 1922|     85|   colorspace->end_points_xy = sRGB_xy;
 1923|     85|   colorspace->end_points_XYZ = sRGB_XYZ;
 1924|     85|   colorspace->flags |=
 1925|     85|      (PNG_COLORSPACE_HAVE_ENDPOINTS|PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB);
  ------------------
  |  |  132|     85|#define PNG_COLORSPACE_HAVE_ENDPOINTS       0x0002
  ------------------
                    (PNG_COLORSPACE_HAVE_ENDPOINTS|PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB);
  ------------------
  |  |  137|     85|#define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0040
  ------------------
 1926|       |
 1927|       |   /* gamma */
 1928|     85|   colorspace->gamma = PNG_GAMMA_sRGB_INVERSE;
  ------------------
  |  |  931|     85|#define PNG_GAMMA_sRGB_INVERSE 45455
  ------------------
 1929|     85|   colorspace->flags |= PNG_COLORSPACE_HAVE_GAMMA;
  ------------------
  |  |  131|     85|#define PNG_COLORSPACE_HAVE_GAMMA           0x0001
  ------------------
 1930|       |
 1931|       |   /* Finally record that we have an sRGB profile */
 1932|     85|   colorspace->flags |=
 1933|     85|      (PNG_COLORSPACE_MATCHES_sRGB|PNG_COLORSPACE_FROM_sRGB);
  ------------------
  |  |  138|     85|#define PNG_COLORSPACE_MATCHES_sRGB         0x0080 /* exact match on profile */
  ------------------
                    (PNG_COLORSPACE_MATCHES_sRGB|PNG_COLORSPACE_FROM_sRGB);
  ------------------
  |  |  136|     85|#define PNG_COLORSPACE_FROM_sRGB            0x0020
  ------------------
 1934|       |
 1935|     85|   return 1; /* set */
 1936|     85|}
png_icc_check_length:
 1962|  5.74k|{
 1963|  5.74k|   if (!icc_check_length(png_ptr, colorspace, name, profile_length))
  ------------------
  |  Branch (1963:8): [True: 7, False: 5.73k]
  ------------------
 1964|      7|      return 0;
 1965|       |
 1966|       |   /* This needs to be here because the 'normal' check is in
 1967|       |    * png_decompress_chunk, yet this happens after the attempt to
 1968|       |    * png_malloc_base the required data.  We only need this on read; on write
 1969|       |    * the caller supplies the profile buffer so libpng doesn't allocate it.  See
 1970|       |    * the call to icc_check_length below (the write case).
 1971|       |    */
 1972|  5.73k|#  ifdef PNG_SET_USER_LIMITS_SUPPORTED
 1973|  5.73k|      else if (png_ptr->user_chunk_malloc_max > 0 &&
  ------------------
  |  Branch (1973:16): [True: 5.73k, False: 0]
  ------------------
 1974|  5.73k|               png_ptr->user_chunk_malloc_max < profile_length)
  ------------------
  |  Branch (1974:16): [True: 26, False: 5.71k]
  ------------------
 1975|     26|         return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
 1976|     26|             "exceeds application limits");
 1977|       |#  elif PNG_USER_CHUNK_MALLOC_MAX > 0
 1978|       |      else if (PNG_USER_CHUNK_MALLOC_MAX < profile_length)
 1979|       |         return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
 1980|       |             "exceeds libpng limits");
 1981|       |#  else /* !SET_USER_LIMITS */
 1982|       |      /* This will get compiled out on all 32-bit and better systems. */
 1983|       |      else if (PNG_SIZE_MAX < profile_length)
 1984|       |         return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
 1985|       |             "exceeds system limits");
 1986|       |#  endif /* !SET_USER_LIMITS */
 1987|       |
 1988|  5.71k|   return 1;
 1989|  5.74k|}
png_icc_check_header:
 1996|  5.71k|{
 1997|  5.71k|   png_uint_32 temp;
 1998|       |
 1999|       |   /* Length check; this cannot be ignored in this code because profile_length
 2000|       |    * is used later to check the tag table, so even if the profile seems over
 2001|       |    * long profile_length from the caller must be correct.  The caller can fix
 2002|       |    * this up on read or write by just passing in the profile header length.
 2003|       |    */
 2004|  5.71k|   temp = png_get_uint_32(profile);
  ------------------
  |  | 2594|  5.71k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  5.71k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  5.71k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  5.71k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  5.71k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2005|  5.71k|   if (temp != profile_length)
  ------------------
  |  Branch (2005:8): [True: 0, False: 5.71k]
  ------------------
 2006|      0|      return png_icc_profile_error(png_ptr, colorspace, name, temp,
 2007|      0|          "length does not match profile");
 2008|       |
 2009|  5.71k|   temp = (png_uint_32) (*(profile+8));
 2010|  5.71k|   if (temp > 3 && (profile_length & 3))
  ------------------
  |  Branch (2010:8): [True: 3.13k, False: 2.57k]
  |  Branch (2010:20): [True: 5, False: 3.12k]
  ------------------
 2011|      5|      return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
 2012|      5|          "invalid length");
 2013|       |
 2014|  5.70k|   temp = png_get_uint_32(profile+128); /* tag count: 12 bytes/tag */
  ------------------
  |  | 2594|  5.70k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  5.70k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  5.70k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  5.70k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  5.70k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2015|  5.70k|   if (temp > 357913930 || /* (2^32-4-132)/12: maximum possible tag count */
  ------------------
  |  Branch (2015:8): [True: 107, False: 5.59k]
  ------------------
 2016|  5.70k|      profile_length < 132+12*temp) /* truncated tag table */
  ------------------
  |  Branch (2016:7): [True: 64, False: 5.53k]
  ------------------
 2017|    171|      return png_icc_profile_error(png_ptr, colorspace, name, temp,
 2018|    171|          "tag count too large");
 2019|       |
 2020|       |   /* The 'intent' must be valid or we can't store it, ICC limits the intent to
 2021|       |    * 16 bits.
 2022|       |    */
 2023|  5.53k|   temp = png_get_uint_32(profile+64);
  ------------------
  |  | 2594|  5.53k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  5.53k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  5.53k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  5.53k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  5.53k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2024|  5.53k|   if (temp >= 0xffff) /* The ICC limit */
  ------------------
  |  Branch (2024:8): [True: 28, False: 5.50k]
  ------------------
 2025|     28|      return png_icc_profile_error(png_ptr, colorspace, name, temp,
 2026|     28|          "invalid rendering intent");
 2027|       |
 2028|       |   /* This is just a warning because the profile may be valid in future
 2029|       |    * versions.
 2030|       |    */
 2031|  5.50k|   if (temp >= PNG_sRGB_INTENT_LAST)
  ------------------
  |  |  718|  5.50k|#define PNG_sRGB_INTENT_LAST       4 /* Not a valid value */
  ------------------
  |  Branch (2031:8): [True: 2.08k, False: 3.41k]
  ------------------
 2032|  2.08k|      (void)png_icc_profile_error(png_ptr, NULL, name, temp,
 2033|  2.08k|          "intent outside defined range");
 2034|       |
 2035|       |   /* At this point the tag table can't be checked because it hasn't necessarily
 2036|       |    * been loaded; however, various header fields can be checked.  These checks
 2037|       |    * are for values permitted by the PNG spec in an ICC profile; the PNG spec
 2038|       |    * restricts the profiles that can be passed in an iCCP chunk (they must be
 2039|       |    * appropriate to processing PNG data!)
 2040|       |    */
 2041|       |
 2042|       |   /* Data checks (could be skipped).  These checks must be independent of the
 2043|       |    * version number; however, the version number doesn't accommodate changes in
 2044|       |    * the header fields (just the known tags and the interpretation of the
 2045|       |    * data.)
 2046|       |    */
 2047|  5.50k|   temp = png_get_uint_32(profile+36); /* signature 'ascp' */
  ------------------
  |  | 2594|  5.50k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  5.50k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  5.50k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  5.50k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  5.50k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2048|  5.50k|   if (temp != 0x61637370)
  ------------------
  |  Branch (2048:8): [True: 34, False: 5.47k]
  ------------------
 2049|     34|      return png_icc_profile_error(png_ptr, colorspace, name, temp,
 2050|     34|          "invalid signature");
 2051|       |
 2052|       |   /* Currently the PCS illuminant/adopted white point (the computational
 2053|       |    * white point) are required to be D50,
 2054|       |    * however the profile contains a record of the illuminant so perhaps ICC
 2055|       |    * expects to be able to change this in the future (despite the rationale in
 2056|       |    * the introduction for using a fixed PCS adopted white.)  Consequently the
 2057|       |    * following is just a warning.
 2058|       |    */
 2059|  5.47k|   if (memcmp(profile+68, D50_nCIEXYZ, 12) != 0)
  ------------------
  |  Branch (2059:8): [True: 4.64k, False: 827]
  ------------------
 2060|  4.64k|      (void)png_icc_profile_error(png_ptr, NULL, name, 0/*no tag value*/,
 2061|  4.64k|          "PCS illuminant is not D50");
 2062|       |
 2063|       |   /* The PNG spec requires this:
 2064|       |    * "If the iCCP chunk is present, the image samples conform to the colour
 2065|       |    * space represented by the embedded ICC profile as defined by the
 2066|       |    * International Color Consortium [ICC]. The colour space of the ICC profile
 2067|       |    * shall be an RGB colour space for colour images (PNG colour types 2, 3, and
 2068|       |    * 6), or a greyscale colour space for greyscale images (PNG colour types 0
 2069|       |    * and 4)."
 2070|       |    *
 2071|       |    * This checking code ensures the embedded profile (on either read or write)
 2072|       |    * conforms to the specification requirements.  Notice that an ICC 'gray'
 2073|       |    * color-space profile contains the information to transform the monochrome
 2074|       |    * data to XYZ or L*a*b (according to which PCS the profile uses) and this
 2075|       |    * should be used in preference to the standard libpng K channel replication
 2076|       |    * into R, G and B channels.
 2077|       |    *
 2078|       |    * Previously it was suggested that an RGB profile on grayscale data could be
 2079|       |    * handled.  However it it is clear that using an RGB profile in this context
 2080|       |    * must be an error - there is no specification of what it means.  Thus it is
 2081|       |    * almost certainly more correct to ignore the profile.
 2082|       |    */
 2083|  5.47k|   temp = png_get_uint_32(profile+16); /* data colour space field */
  ------------------
  |  | 2594|  5.47k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  5.47k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  5.47k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  5.47k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  5.47k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2084|  5.47k|   switch (temp)
 2085|  5.47k|   {
 2086|  3.14k|      case 0x52474220: /* 'RGB ' */
  ------------------
  |  Branch (2086:7): [True: 3.14k, False: 2.32k]
  ------------------
 2087|  3.14k|         if ((color_type & PNG_COLOR_MASK_COLOR) == 0)
  ------------------
  |  |  663|  3.14k|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (2087:14): [True: 1, False: 3.14k]
  ------------------
 2088|      1|            return png_icc_profile_error(png_ptr, colorspace, name, temp,
 2089|      1|                "RGB color space not permitted on grayscale PNG");
 2090|  3.14k|         break;
 2091|       |
 2092|  3.14k|      case 0x47524159: /* 'GRAY' */
  ------------------
  |  Branch (2092:7): [True: 2.18k, False: 3.29k]
  ------------------
 2093|  2.18k|         if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
  ------------------
  |  |  663|  2.18k|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (2093:14): [True: 1, False: 2.18k]
  ------------------
 2094|      1|            return png_icc_profile_error(png_ptr, colorspace, name, temp,
 2095|      1|                "Gray color space not permitted on RGB PNG");
 2096|  2.18k|         break;
 2097|       |
 2098|  2.18k|      default:
  ------------------
  |  Branch (2098:7): [True: 145, False: 5.32k]
  ------------------
 2099|    145|         return png_icc_profile_error(png_ptr, colorspace, name, temp,
 2100|    145|             "invalid ICC profile color space");
 2101|  5.47k|   }
 2102|       |
 2103|       |   /* It is up to the application to check that the profile class matches the
 2104|       |    * application requirements; the spec provides no guidance, but it's pretty
 2105|       |    * weird if the profile is not scanner ('scnr'), monitor ('mntr'), printer
 2106|       |    * ('prtr') or 'spac' (for generic color spaces).  Issue a warning in these
 2107|       |    * cases.  Issue an error for device link or abstract profiles - these don't
 2108|       |    * contain the records necessary to transform the color-space to anything
 2109|       |    * other than the target device (and not even that for an abstract profile).
 2110|       |    * Profiles of these classes may not be embedded in images.
 2111|       |    */
 2112|  5.32k|   temp = png_get_uint_32(profile+12); /* profile/device class */
  ------------------
  |  | 2594|  5.32k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  5.32k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  5.32k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  5.32k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  5.32k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2113|  5.32k|   switch (temp)
 2114|  5.32k|   {
 2115|    251|      case 0x73636e72: /* 'scnr' */
  ------------------
  |  Branch (2115:7): [True: 251, False: 5.07k]
  ------------------
 2116|    447|      case 0x6d6e7472: /* 'mntr' */
  ------------------
  |  Branch (2116:7): [True: 196, False: 5.12k]
  ------------------
 2117|    565|      case 0x70727472: /* 'prtr' */
  ------------------
  |  Branch (2117:7): [True: 118, False: 5.20k]
  ------------------
 2118|    667|      case 0x73706163: /* 'spac' */
  ------------------
  |  Branch (2118:7): [True: 102, False: 5.22k]
  ------------------
 2119|       |         /* All supported */
 2120|    667|         break;
 2121|       |
 2122|      1|      case 0x61627374: /* 'abst' */
  ------------------
  |  Branch (2122:7): [True: 1, False: 5.32k]
  ------------------
 2123|       |         /* May not be embedded in an image */
 2124|      1|         return png_icc_profile_error(png_ptr, colorspace, name, temp,
 2125|      1|             "invalid embedded Abstract ICC profile");
 2126|       |
 2127|      1|      case 0x6c696e6b: /* 'link' */
  ------------------
  |  Branch (2127:7): [True: 1, False: 5.32k]
  ------------------
 2128|       |         /* DeviceLink profiles cannot be interpreted in a non-device specific
 2129|       |          * fashion, if an app uses the AToB0Tag in the profile the results are
 2130|       |          * undefined unless the result is sent to the intended device,
 2131|       |          * therefore a DeviceLink profile should not be found embedded in a
 2132|       |          * PNG.
 2133|       |          */
 2134|      1|         return png_icc_profile_error(png_ptr, colorspace, name, temp,
 2135|      1|             "unexpected DeviceLink ICC profile class");
 2136|       |
 2137|    758|      case 0x6e6d636c: /* 'nmcl' */
  ------------------
  |  Branch (2137:7): [True: 758, False: 4.56k]
  ------------------
 2138|       |         /* A NamedColor profile is also device specific, however it doesn't
 2139|       |          * contain an AToB0 tag that is open to misinterpretation.  Almost
 2140|       |          * certainly it will fail the tests below.
 2141|       |          */
 2142|    758|         (void)png_icc_profile_error(png_ptr, NULL, name, temp,
 2143|    758|             "unexpected NamedColor ICC profile class");
 2144|    758|         break;
 2145|       |
 2146|  3.89k|      default:
  ------------------
  |  Branch (2146:7): [True: 3.89k, False: 1.42k]
  ------------------
 2147|       |         /* To allow for future enhancements to the profile accept unrecognized
 2148|       |          * profile classes with a warning, these then hit the test below on the
 2149|       |          * tag content to ensure they are backward compatible with one of the
 2150|       |          * understood profiles.
 2151|       |          */
 2152|  3.89k|         (void)png_icc_profile_error(png_ptr, NULL, name, temp,
 2153|  3.89k|             "unrecognized ICC profile class");
 2154|  3.89k|         break;
 2155|  5.32k|   }
 2156|       |
 2157|       |   /* For any profile other than a device link one the PCS must be encoded
 2158|       |    * either in XYZ or Lab.
 2159|       |    */
 2160|  5.32k|   temp = png_get_uint_32(profile+20);
  ------------------
  |  | 2594|  5.32k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  5.32k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  5.32k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  5.32k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  5.32k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2161|  5.32k|   switch (temp)
 2162|  5.32k|   {
 2163|  3.39k|      case 0x58595a20: /* 'XYZ ' */
  ------------------
  |  Branch (2163:7): [True: 3.39k, False: 1.92k]
  ------------------
 2164|  5.09k|      case 0x4c616220: /* 'Lab ' */
  ------------------
  |  Branch (2164:7): [True: 1.70k, False: 3.62k]
  ------------------
 2165|  5.09k|         break;
 2166|       |
 2167|    226|      default:
  ------------------
  |  Branch (2167:7): [True: 226, False: 5.09k]
  ------------------
 2168|    226|         return png_icc_profile_error(png_ptr, colorspace, name, temp,
 2169|    226|             "unexpected ICC PCS encoding");
 2170|  5.32k|   }
 2171|       |
 2172|  5.09k|   return 1;
 2173|  5.32k|}
png_icc_check_tag_table:
 2179|  5.04k|{
 2180|  5.04k|   png_uint_32 tag_count = png_get_uint_32(profile+128);
  ------------------
  |  | 2594|  5.04k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  5.04k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  5.04k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  5.04k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  5.04k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2181|  5.04k|   png_uint_32 itag;
 2182|  5.04k|   png_const_bytep tag = profile+132; /* The first tag */
 2183|       |
 2184|       |   /* First scan all the tags in the table and add bits to the icc_info value
 2185|       |    * (temporarily in 'tags').
 2186|       |    */
 2187|  17.8k|   for (itag=0; itag < tag_count; ++itag, tag += 12)
  ------------------
  |  Branch (2187:17): [True: 12.9k, False: 4.90k]
  ------------------
 2188|  12.9k|   {
 2189|  12.9k|      png_uint_32 tag_id = png_get_uint_32(tag+0);
  ------------------
  |  | 2594|  12.9k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  12.9k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  12.9k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  12.9k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  12.9k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2190|  12.9k|      png_uint_32 tag_start = png_get_uint_32(tag+4); /* must be aligned */
  ------------------
  |  | 2594|  12.9k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  12.9k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  12.9k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  12.9k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  12.9k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2191|  12.9k|      png_uint_32 tag_length = png_get_uint_32(tag+8);/* not padded */
  ------------------
  |  | 2594|  12.9k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  12.9k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  12.9k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  12.9k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  12.9k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2192|       |
 2193|       |      /* The ICC specification does not exclude zero length tags, therefore the
 2194|       |       * start might actually be anywhere if there is no data, but this would be
 2195|       |       * a clear abuse of the intent of the standard so the start is checked for
 2196|       |       * being in range.  All defined tag types have an 8 byte header - a 4 byte
 2197|       |       * type signature then 0.
 2198|       |       */
 2199|       |
 2200|       |      /* This is a hard error; potentially it can cause read outside the
 2201|       |       * profile.
 2202|       |       */
 2203|  12.9k|      if (tag_start > profile_length || tag_length > profile_length - tag_start)
  ------------------
  |  Branch (2203:11): [True: 83, False: 12.8k]
  |  Branch (2203:41): [True: 61, False: 12.7k]
  ------------------
 2204|    144|         return png_icc_profile_error(png_ptr, colorspace, name, tag_id,
 2205|    144|             "ICC profile tag outside profile");
 2206|       |
 2207|  12.7k|      if ((tag_start & 3) != 0)
  ------------------
  |  Branch (2207:11): [True: 7.49k, False: 5.27k]
  ------------------
 2208|  7.49k|      {
 2209|       |         /* CNHP730S.icc shipped with Microsoft Windows 64 violates this; it is
 2210|       |          * only a warning here because libpng does not care about the
 2211|       |          * alignment.
 2212|       |          */
 2213|  7.49k|         (void)png_icc_profile_error(png_ptr, NULL, name, tag_id,
 2214|  7.49k|             "ICC profile tag start not a multiple of 4");
 2215|  7.49k|      }
 2216|  12.7k|   }
 2217|       |
 2218|  4.90k|   return 1; /* success, maybe with warnings */
 2219|  5.04k|}
png_icc_set_sRGB:
 2409|  4.66k|{
 2410|       |   /* Is this profile one of the known ICC sRGB profiles?  If it is, just set
 2411|       |    * the sRGB information.
 2412|       |    */
 2413|  4.66k|   if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler) != 0)
  ------------------
  |  Branch (2413:8): [True: 1, False: 4.66k]
  ------------------
 2414|      1|      (void)png_colorspace_set_sRGB(png_ptr, colorspace,
 2415|      1|         (int)/*already checked*/png_get_uint_32(profile+64));
  ------------------
  |  | 2594|      1|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|      1|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|      1|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|      1|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|      1|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2416|  4.66k|}
png_check_IHDR:
 2519|  6.73k|{
 2520|  6.73k|   int error = 0;
 2521|       |
 2522|       |   /* Check for width and height valid values */
 2523|  6.73k|   if (width == 0)
  ------------------
  |  Branch (2523:8): [True: 0, False: 6.73k]
  ------------------
 2524|      0|   {
 2525|      0|      png_warning(png_ptr, "Image width is zero in IHDR");
 2526|      0|      error = 1;
 2527|      0|   }
 2528|       |
 2529|  6.73k|   if (width > PNG_UINT_31_MAX)
  ------------------
  |  |  648|  6.73k|#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  ------------------
  |  Branch (2529:8): [True: 0, False: 6.73k]
  ------------------
 2530|      0|   {
 2531|      0|      png_warning(png_ptr, "Invalid image width in IHDR");
 2532|      0|      error = 1;
 2533|      0|   }
 2534|       |
 2535|       |   /* The bit mask on the first line below must be at least as big as a
 2536|       |    * png_uint_32.  "~7U" is not adequate on 16-bit systems because it will
 2537|       |    * be an unsigned 16-bit value.  Casting to (png_alloc_size_t) makes the
 2538|       |    * type of the result at least as bit (in bits) as the RHS of the > operator
 2539|       |    * which also avoids a common warning on 64-bit systems that the comparison
 2540|       |    * of (png_uint_32) against the constant value on the RHS will always be
 2541|       |    * false.
 2542|       |    */
 2543|  6.73k|   if (((width + 7) & ~(png_alloc_size_t)7) >
  ------------------
  |  Branch (2543:8): [True: 0, False: 6.73k]
  ------------------
 2544|  6.73k|       (((PNG_SIZE_MAX
  ------------------
  |  |  650|  6.73k|#define PNG_SIZE_MAX ((size_t)(-1))
  ------------------
 2545|  6.73k|           - 48        /* big_row_buf hack */
 2546|  6.73k|           - 1)        /* filter byte */
 2547|  6.73k|           / 8)        /* 8-byte RGBA pixels */
 2548|  6.73k|           - 1))       /* extra max_pixel_depth pad */
 2549|      0|   {
 2550|       |      /* The size of the row must be within the limits of this architecture.
 2551|       |       * Because the read code can perform arbitrary transformations the
 2552|       |       * maximum size is checked here.  Because the code in png_read_start_row
 2553|       |       * adds extra space "for safety's sake" in several places a conservative
 2554|       |       * limit is used here.
 2555|       |       *
 2556|       |       * NOTE: it would be far better to check the size that is actually used,
 2557|       |       * but the effect in the real world is minor and the changes are more
 2558|       |       * extensive, therefore much more dangerous and much more difficult to
 2559|       |       * write in a way that avoids compiler warnings.
 2560|       |       */
 2561|      0|      png_warning(png_ptr, "Image width is too large for this architecture");
 2562|      0|      error = 1;
 2563|      0|   }
 2564|       |
 2565|  6.73k|#ifdef PNG_SET_USER_LIMITS_SUPPORTED
 2566|  6.73k|   if (width > png_ptr->user_width_max)
  ------------------
  |  Branch (2566:8): [True: 0, False: 6.73k]
  ------------------
 2567|       |#else
 2568|       |   if (width > PNG_USER_WIDTH_MAX)
 2569|       |#endif
 2570|      0|   {
 2571|      0|      png_warning(png_ptr, "Image width exceeds user limit in IHDR");
 2572|      0|      error = 1;
 2573|      0|   }
 2574|       |
 2575|  6.73k|   if (height == 0)
  ------------------
  |  Branch (2575:8): [True: 0, False: 6.73k]
  ------------------
 2576|      0|   {
 2577|      0|      png_warning(png_ptr, "Image height is zero in IHDR");
 2578|      0|      error = 1;
 2579|      0|   }
 2580|       |
 2581|  6.73k|   if (height > PNG_UINT_31_MAX)
  ------------------
  |  |  648|  6.73k|#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  ------------------
  |  Branch (2581:8): [True: 0, False: 6.73k]
  ------------------
 2582|      0|   {
 2583|      0|      png_warning(png_ptr, "Invalid image height in IHDR");
 2584|      0|      error = 1;
 2585|      0|   }
 2586|       |
 2587|  6.73k|#ifdef PNG_SET_USER_LIMITS_SUPPORTED
 2588|  6.73k|   if (height > png_ptr->user_height_max)
  ------------------
  |  Branch (2588:8): [True: 0, False: 6.73k]
  ------------------
 2589|       |#else
 2590|       |   if (height > PNG_USER_HEIGHT_MAX)
 2591|       |#endif
 2592|      0|   {
 2593|      0|      png_warning(png_ptr, "Image height exceeds user limit in IHDR");
 2594|      0|      error = 1;
 2595|      0|   }
 2596|       |
 2597|       |   /* Check other values */
 2598|  6.73k|   if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
  ------------------
  |  Branch (2598:8): [True: 5.83k, False: 901]
  |  Branch (2598:26): [True: 5.19k, False: 639]
  |  Branch (2598:44): [True: 4.87k, False: 321]
  ------------------
 2599|  6.73k|       bit_depth != 8 && bit_depth != 16)
  ------------------
  |  Branch (2599:8): [True: 2.83k, False: 2.03k]
  |  Branch (2599:26): [True: 0, False: 2.83k]
  ------------------
 2600|      0|   {
 2601|      0|      png_warning(png_ptr, "Invalid bit depth in IHDR");
 2602|      0|      error = 1;
 2603|      0|   }
 2604|       |
 2605|  6.73k|   if (color_type < 0 || color_type == 1 ||
  ------------------
  |  Branch (2605:8): [True: 0, False: 6.73k]
  |  Branch (2605:26): [True: 0, False: 6.73k]
  ------------------
 2606|  6.73k|       color_type == 5 || color_type > 6)
  ------------------
  |  Branch (2606:8): [True: 0, False: 6.73k]
  |  Branch (2606:27): [True: 0, False: 6.73k]
  ------------------
 2607|      0|   {
 2608|      0|      png_warning(png_ptr, "Invalid color type in IHDR");
 2609|      0|      error = 1;
 2610|      0|   }
 2611|       |
 2612|  6.73k|   if (((color_type == PNG_COLOR_TYPE_PALETTE) && bit_depth > 8) ||
  ------------------
  |  |  668|  6.73k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  6.73k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  6.73k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (2612:9): [True: 1.32k, False: 5.40k]
  |  Branch (2612:51): [True: 0, False: 1.32k]
  ------------------
 2613|  6.73k|       ((color_type == PNG_COLOR_TYPE_RGB ||
  ------------------
  |  |  669|  13.4k|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|  6.73k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (2613:10): [True: 3.07k, False: 3.65k]
  ------------------
 2614|  6.73k|         color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
  ------------------
  |  |  671|  10.3k|#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|  3.65k|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (2614:10): [True: 107, False: 3.54k]
  ------------------
 2615|  6.73k|         color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8))
  ------------------
  |  |  670|  3.54k|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|  3.54k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|  3.54k|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (2615:10): [True: 704, False: 2.84k]
  |  Branch (2615:53): [True: 0, False: 3.88k]
  ------------------
 2616|      0|   {
 2617|      0|      png_warning(png_ptr, "Invalid color type/bit depth combination in IHDR");
 2618|      0|      error = 1;
 2619|      0|   }
 2620|       |
 2621|  6.73k|   if (interlace_type >= PNG_INTERLACE_LAST)
  ------------------
  |  |  688|  6.73k|#define PNG_INTERLACE_LAST        2 /* Not a valid value */
  ------------------
  |  Branch (2621:8): [True: 0, False: 6.73k]
  ------------------
 2622|      0|   {
 2623|      0|      png_warning(png_ptr, "Unknown interlace method in IHDR");
 2624|      0|      error = 1;
 2625|      0|   }
 2626|       |
 2627|  6.73k|   if (compression_type != PNG_COMPRESSION_TYPE_BASE)
  ------------------
  |  |  677|  6.73k|#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
  ------------------
  |  Branch (2627:8): [True: 0, False: 6.73k]
  ------------------
 2628|      0|   {
 2629|      0|      png_warning(png_ptr, "Unknown compression method in IHDR");
 2630|      0|      error = 1;
 2631|      0|   }
 2632|       |
 2633|  6.73k|#ifdef PNG_MNG_FEATURES_SUPPORTED
 2634|       |   /* Accept filter_method 64 (intrapixel differencing) only if
 2635|       |    * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
 2636|       |    * 2. Libpng did not read a PNG signature (this filter_method is only
 2637|       |    *    used in PNG datastreams that are embedded in MNG datastreams) and
 2638|       |    * 3. The application called png_permit_mng_features with a mask that
 2639|       |    *    included PNG_FLAG_MNG_FILTER_64 and
 2640|       |    * 4. The filter_method is 64 and
 2641|       |    * 5. The color_type is RGB or RGBA
 2642|       |    */
 2643|  6.73k|   if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0 &&
  ------------------
  |  |  661|  6.73k|#define PNG_HAVE_PNG_SIGNATURE    0x1000U
  ------------------
  |  Branch (2643:8): [True: 6.73k, False: 0]
  ------------------
 2644|  6.73k|       png_ptr->mng_features_permitted != 0)
  ------------------
  |  Branch (2644:8): [True: 0, False: 6.73k]
  ------------------
 2645|      0|      png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
 2646|       |
 2647|  6.73k|   if (filter_type != PNG_FILTER_TYPE_BASE)
  ------------------
  |  |  681|  6.73k|#define PNG_FILTER_TYPE_BASE      0 /* Single row per-byte filtering */
  ------------------
  |  Branch (2647:8): [True: 0, False: 6.73k]
  ------------------
 2648|      0|   {
 2649|      0|      if (!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
  ------------------
  |  |  857|      0|#define PNG_FLAG_MNG_FILTER_64      0x04
  ------------------
  |  Branch (2649:13): [True: 0, False: 0]
  ------------------
 2650|      0|          (filter_type == PNG_INTRAPIXEL_DIFFERENCING) &&
  ------------------
  |  |  682|      0|#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
  ------------------
  |  Branch (2650:11): [True: 0, False: 0]
  ------------------
 2651|      0|          ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) == 0) &&
  ------------------
  |  |  661|      0|#define PNG_HAVE_PNG_SIGNATURE    0x1000U
  ------------------
  |  Branch (2651:11): [True: 0, False: 0]
  ------------------
 2652|      0|          (color_type == PNG_COLOR_TYPE_RGB ||
  ------------------
  |  |  669|      0|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (2652:12): [True: 0, False: 0]
  ------------------
 2653|      0|          color_type == PNG_COLOR_TYPE_RGB_ALPHA)))
  ------------------
  |  |  670|      0|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (2653:11): [True: 0, False: 0]
  ------------------
 2654|      0|      {
 2655|      0|         png_warning(png_ptr, "Unknown filter method in IHDR");
 2656|      0|         error = 1;
 2657|      0|      }
 2658|       |
 2659|      0|      if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0)
  ------------------
  |  |  661|      0|#define PNG_HAVE_PNG_SIGNATURE    0x1000U
  ------------------
  |  Branch (2659:11): [True: 0, False: 0]
  ------------------
 2660|      0|      {
 2661|      0|         png_warning(png_ptr, "Invalid filter method in IHDR");
 2662|      0|         error = 1;
 2663|      0|      }
 2664|      0|   }
 2665|       |
 2666|       |#else
 2667|       |   if (filter_type != PNG_FILTER_TYPE_BASE)
 2668|       |   {
 2669|       |      png_warning(png_ptr, "Unknown filter method in IHDR");
 2670|       |      error = 1;
 2671|       |   }
 2672|       |#endif
 2673|       |
 2674|  6.73k|   if (error == 1)
  ------------------
  |  Branch (2674:8): [True: 0, False: 6.73k]
  ------------------
 2675|      0|      png_error(png_ptr, "Invalid IHDR data");
 2676|  6.73k|}
png_check_fp_number:
 2690|  6.78k|{
 2691|  6.78k|   int state = *statep;
 2692|  6.78k|   size_t i = *whereami;
 2693|       |
 2694|  22.0k|   while (i < size)
  ------------------
  |  Branch (2694:11): [True: 19.7k, False: 2.32k]
  ------------------
 2695|  19.7k|   {
 2696|  19.7k|      int type;
 2697|       |      /* First find the type of the next character */
 2698|  19.7k|      switch (string[i])
 2699|  19.7k|      {
 2700|    786|      case 43:  type = PNG_FP_SAW_SIGN;                   break;
  ------------------
  |  | 1963|    786|#define PNG_FP_SAW_SIGN   4  /* Saw +/- in current state */
  ------------------
  |  Branch (2700:7): [True: 786, False: 18.9k]
  ------------------
 2701|    668|      case 45:  type = PNG_FP_SAW_SIGN + PNG_FP_NEGATIVE; break;
  ------------------
  |  | 1963|    668|#define PNG_FP_SAW_SIGN   4  /* Saw +/- in current state */
  ------------------
                    case 45:  type = PNG_FP_SAW_SIGN + PNG_FP_NEGATIVE; break;
  ------------------
  |  | 1972|    668|#define PNG_FP_NEGATIVE 128  /* A negative number, including "-0" */
  ------------------
  |  Branch (2701:7): [True: 668, False: 19.0k]
  ------------------
 2702|  2.44k|      case 46:  type = PNG_FP_SAW_DOT;                    break;
  ------------------
  |  | 1965|  2.44k|#define PNG_FP_SAW_DOT   16  /* Saw a dot in current state */
  ------------------
  |  Branch (2702:7): [True: 2.44k, False: 17.2k]
  ------------------
 2703|  2.53k|      case 48:  type = PNG_FP_SAW_DIGIT;                  break;
  ------------------
  |  | 1964|  2.53k|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  ------------------
  |  Branch (2703:7): [True: 2.53k, False: 17.2k]
  ------------------
 2704|  3.78k|      case 49: case 50: case 51: case 52:
  ------------------
  |  Branch (2704:7): [True: 428, False: 19.3k]
  |  Branch (2704:16): [True: 649, False: 19.0k]
  |  Branch (2704:25): [True: 1.33k, False: 18.3k]
  |  Branch (2704:34): [True: 1.36k, False: 18.3k]
  ------------------
 2705|  7.62k|      case 53: case 54: case 55: case 56:
  ------------------
  |  Branch (2705:7): [True: 932, False: 18.8k]
  |  Branch (2705:16): [True: 1.14k, False: 18.5k]
  |  Branch (2705:25): [True: 1.27k, False: 18.4k]
  |  Branch (2705:34): [True: 500, False: 19.2k]
  ------------------
 2706|  8.74k|      case 57:  type = PNG_FP_SAW_DIGIT + PNG_FP_NONZERO; break;
  ------------------
  |  | 1964|  8.74k|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  ------------------
                    case 57:  type = PNG_FP_SAW_DIGIT + PNG_FP_NONZERO; break;
  ------------------
  |  | 1973|  8.74k|#define PNG_FP_NONZERO  256  /* A non-zero value */
  ------------------
  |  Branch (2706:7): [True: 1.12k, False: 18.6k]
  ------------------
 2707|  1.29k|      case 69:
  ------------------
  |  Branch (2707:7): [True: 1.29k, False: 18.4k]
  ------------------
 2708|  2.41k|      case 101: type = PNG_FP_SAW_E;                      break;
  ------------------
  |  | 1966|  2.41k|#define PNG_FP_SAW_E     32  /* Saw an E (or e) in current state */
  ------------------
  |  Branch (2708:7): [True: 1.12k, False: 18.6k]
  ------------------
 2709|  2.13k|      default:  goto PNG_FP_End;
  ------------------
  |  Branch (2709:7): [True: 2.13k, False: 17.6k]
  ------------------
 2710|  19.7k|      }
 2711|       |
 2712|       |      /* Now deal with this type according to the current
 2713|       |       * state, the type is arranged to not overlap the
 2714|       |       * bits of the PNG_FP_STATE.
 2715|       |       */
 2716|  17.6k|      switch ((state & PNG_FP_STATE) + (type & PNG_FP_SAW_ANY))
  ------------------
  |  | 1962|  17.6k|#define PNG_FP_STATE      3  /* mask for the above */
  ------------------
                    switch ((state & PNG_FP_STATE) + (type & PNG_FP_SAW_ANY))
  ------------------
  |  | 1967|  17.6k|#define PNG_FP_SAW_ANY   60  /* Saw any of the above 4 */
  ------------------
 2717|  17.6k|      {
 2718|    827|      case PNG_FP_INTEGER + PNG_FP_SAW_SIGN:
  ------------------
  |  | 1959|    827|#define PNG_FP_INTEGER    0  /* before or in integer */
  ------------------
                    case PNG_FP_INTEGER + PNG_FP_SAW_SIGN:
  ------------------
  |  | 1963|    827|#define PNG_FP_SAW_SIGN   4  /* Saw +/- in current state */
  ------------------
  |  Branch (2718:7): [True: 827, False: 16.7k]
  ------------------
 2719|    827|         if ((state & PNG_FP_SAW_ANY) != 0)
  ------------------
  |  | 1967|    827|#define PNG_FP_SAW_ANY   60  /* Saw any of the above 4 */
  ------------------
  |  Branch (2719:14): [True: 198, False: 629]
  ------------------
 2720|    198|            goto PNG_FP_End; /* not a part of the number */
 2721|       |
 2722|    629|         png_fp_add(state, type);
  ------------------
  |  | 2684|    629|#define png_fp_add(state, flags) ((state) |= (flags))
  ------------------
 2723|    629|         break;
 2724|       |
 2725|  2.44k|      case PNG_FP_INTEGER + PNG_FP_SAW_DOT:
  ------------------
  |  | 1959|  2.44k|#define PNG_FP_INTEGER    0  /* before or in integer */
  ------------------
                    case PNG_FP_INTEGER + PNG_FP_SAW_DOT:
  ------------------
  |  | 1965|  2.44k|#define PNG_FP_SAW_DOT   16  /* Saw a dot in current state */
  ------------------
  |  Branch (2725:7): [True: 2.44k, False: 15.1k]
  ------------------
 2726|       |         /* Ok as trailer, ok as lead of fraction. */
 2727|  2.44k|         if ((state & PNG_FP_SAW_DOT) != 0) /* two dots */
  ------------------
  |  | 1965|  2.44k|#define PNG_FP_SAW_DOT   16  /* Saw a dot in current state */
  ------------------
  |  Branch (2727:14): [True: 536, False: 1.91k]
  ------------------
 2728|    536|            goto PNG_FP_End;
 2729|       |
 2730|  1.91k|         else if ((state & PNG_FP_SAW_DIGIT) != 0) /* trailing dot? */
  ------------------
  |  | 1964|  1.91k|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  ------------------
  |  Branch (2730:19): [True: 989, False: 923]
  ------------------
 2731|    989|            png_fp_add(state, type);
  ------------------
  |  | 2684|    989|#define png_fp_add(state, flags) ((state) |= (flags))
  ------------------
 2732|       |
 2733|    923|         else
 2734|    923|            png_fp_set(state, PNG_FP_FRACTION | type);
  ------------------
  |  | 2685|    923|#define png_fp_set(state, value) ((state) = (value) | ((state) & PNG_FP_STICKY))
  |  |  ------------------
  |  |  |  | 1974|    923|#define PNG_FP_STICKY   448  /* The above three flags */
  |  |  ------------------
  ------------------
 2735|       |
 2736|  1.91k|         break;
 2737|       |
 2738|  6.56k|      case PNG_FP_INTEGER + PNG_FP_SAW_DIGIT:
  ------------------
  |  | 1959|  6.56k|#define PNG_FP_INTEGER    0  /* before or in integer */
  ------------------
                    case PNG_FP_INTEGER + PNG_FP_SAW_DIGIT:
  ------------------
  |  | 1964|  6.56k|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  ------------------
  |  Branch (2738:7): [True: 6.56k, False: 11.0k]
  ------------------
 2739|  6.56k|         if ((state & PNG_FP_SAW_DOT) != 0) /* delayed fraction */
  ------------------
  |  | 1965|  6.56k|#define PNG_FP_SAW_DOT   16  /* Saw a dot in current state */
  ------------------
  |  Branch (2739:14): [True: 450, False: 6.11k]
  ------------------
 2740|    450|            png_fp_set(state, PNG_FP_FRACTION | PNG_FP_SAW_DOT);
  ------------------
  |  | 2685|    450|#define png_fp_set(state, value) ((state) = (value) | ((state) & PNG_FP_STICKY))
  |  |  ------------------
  |  |  |  | 1974|    450|#define PNG_FP_STICKY   448  /* The above three flags */
  |  |  ------------------
  ------------------
 2741|       |
 2742|  6.56k|         png_fp_add(state, type | PNG_FP_WAS_VALID);
  ------------------
  |  | 2684|  6.56k|#define png_fp_add(state, flags) ((state) |= (flags))
  ------------------
 2743|       |
 2744|  6.56k|         break;
 2745|       |
 2746|  1.19k|      case PNG_FP_INTEGER + PNG_FP_SAW_E:
  ------------------
  |  | 1959|  1.19k|#define PNG_FP_INTEGER    0  /* before or in integer */
  ------------------
                    case PNG_FP_INTEGER + PNG_FP_SAW_E:
  ------------------
  |  | 1966|  1.19k|#define PNG_FP_SAW_E     32  /* Saw an E (or e) in current state */
  ------------------
  |  Branch (2746:7): [True: 1.19k, False: 16.4k]
  ------------------
 2747|  1.19k|         if ((state & PNG_FP_SAW_DIGIT) == 0)
  ------------------
  |  | 1964|  1.19k|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  ------------------
  |  Branch (2747:14): [True: 193, False: 999]
  ------------------
 2748|    193|            goto PNG_FP_End;
 2749|       |
 2750|    999|         png_fp_set(state, PNG_FP_EXPONENT);
  ------------------
  |  | 2685|    999|#define png_fp_set(state, value) ((state) = (value) | ((state) & PNG_FP_STICKY))
  |  |  ------------------
  |  |  |  | 1974|    999|#define PNG_FP_STICKY   448  /* The above three flags */
  |  |  ------------------
  ------------------
 2751|       |
 2752|    999|         break;
 2753|       |
 2754|       |   /* case PNG_FP_FRACTION + PNG_FP_SAW_SIGN:
 2755|       |         goto PNG_FP_End; ** no sign in fraction */
 2756|       |
 2757|       |   /* case PNG_FP_FRACTION + PNG_FP_SAW_DOT:
 2758|       |         goto PNG_FP_End; ** Because SAW_DOT is always set */
 2759|       |
 2760|  3.94k|      case PNG_FP_FRACTION + PNG_FP_SAW_DIGIT:
  ------------------
  |  | 1960|  3.94k|#define PNG_FP_FRACTION   1  /* before or in fraction */
  ------------------
                    case PNG_FP_FRACTION + PNG_FP_SAW_DIGIT:
  ------------------
  |  | 1964|  3.94k|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  ------------------
  |  Branch (2760:7): [True: 3.94k, False: 13.6k]
  ------------------
 2761|  3.94k|         png_fp_add(state, type | PNG_FP_WAS_VALID);
  ------------------
  |  | 2684|  3.94k|#define png_fp_add(state, flags) ((state) |= (flags))
  ------------------
 2762|  3.94k|         break;
 2763|       |
 2764|    763|      case PNG_FP_FRACTION + PNG_FP_SAW_E:
  ------------------
  |  | 1960|    763|#define PNG_FP_FRACTION   1  /* before or in fraction */
  ------------------
                    case PNG_FP_FRACTION + PNG_FP_SAW_E:
  ------------------
  |  | 1966|    763|#define PNG_FP_SAW_E     32  /* Saw an E (or e) in current state */
  ------------------
  |  Branch (2764:7): [True: 763, False: 16.8k]
  ------------------
 2765|       |         /* This is correct because the trailing '.' on an
 2766|       |          * integer is handled above - so we can only get here
 2767|       |          * with the sequence ".E" (with no preceding digits).
 2768|       |          */
 2769|    763|         if ((state & PNG_FP_SAW_DIGIT) == 0)
  ------------------
  |  | 1964|    763|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  ------------------
  |  Branch (2769:14): [True: 568, False: 195]
  ------------------
 2770|    568|            goto PNG_FP_End;
 2771|       |
 2772|    195|         png_fp_set(state, PNG_FP_EXPONENT);
  ------------------
  |  | 2685|    195|#define png_fp_set(state, value) ((state) = (value) | ((state) & PNG_FP_STICKY))
  |  |  ------------------
  |  |  |  | 1974|    195|#define PNG_FP_STICKY   448  /* The above three flags */
  |  |  ------------------
  ------------------
 2773|       |
 2774|    195|         break;
 2775|       |
 2776|    627|      case PNG_FP_EXPONENT + PNG_FP_SAW_SIGN:
  ------------------
  |  | 1961|    627|#define PNG_FP_EXPONENT   2  /* before or in exponent */
  ------------------
                    case PNG_FP_EXPONENT + PNG_FP_SAW_SIGN:
  ------------------
  |  | 1963|    627|#define PNG_FP_SAW_SIGN   4  /* Saw +/- in current state */
  ------------------
  |  Branch (2776:7): [True: 627, False: 16.9k]
  ------------------
 2777|    627|         if ((state & PNG_FP_SAW_ANY) != 0)
  ------------------
  |  | 1967|    627|#define PNG_FP_SAW_ANY   60  /* Saw any of the above 4 */
  ------------------
  |  Branch (2777:14): [True: 364, False: 263]
  ------------------
 2778|    364|            goto PNG_FP_End; /* not a part of the number */
 2779|       |
 2780|    263|         png_fp_add(state, PNG_FP_SAW_SIGN);
  ------------------
  |  | 2684|    263|#define png_fp_add(state, flags) ((state) |= (flags))
  ------------------
 2781|       |
 2782|    263|         break;
 2783|       |
 2784|       |   /* case PNG_FP_EXPONENT + PNG_FP_SAW_DOT:
 2785|       |         goto PNG_FP_End; */
 2786|       |
 2787|    770|      case PNG_FP_EXPONENT + PNG_FP_SAW_DIGIT:
  ------------------
  |  | 1961|    770|#define PNG_FP_EXPONENT   2  /* before or in exponent */
  ------------------
                    case PNG_FP_EXPONENT + PNG_FP_SAW_DIGIT:
  ------------------
  |  | 1964|    770|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  ------------------
  |  Branch (2787:7): [True: 770, False: 16.8k]
  ------------------
 2788|    770|         png_fp_add(state, PNG_FP_SAW_DIGIT | PNG_FP_WAS_VALID);
  ------------------
  |  | 2684|    770|#define png_fp_add(state, flags) ((state) |= (flags))
  ------------------
 2789|       |
 2790|    770|         break;
 2791|       |
 2792|       |   /* case PNG_FP_EXPONEXT + PNG_FP_SAW_E:
 2793|       |         goto PNG_FP_End; */
 2794|       |
 2795|    465|      default: goto PNG_FP_End; /* I.e. break 2 */
  ------------------
  |  Branch (2795:7): [True: 465, False: 17.1k]
  ------------------
 2796|  17.6k|      }
 2797|       |
 2798|       |      /* The character seems ok, continue. */
 2799|  15.2k|      ++i;
 2800|  15.2k|   }
 2801|       |
 2802|  6.78k|PNG_FP_End:
 2803|       |   /* Here at the end, update the state and return the correct
 2804|       |    * return code.
 2805|       |    */
 2806|  6.78k|   *statep = state;
 2807|  6.78k|   *whereami = i;
 2808|       |
 2809|  6.78k|   return (state & PNG_FP_SAW_DIGIT) != 0;
  ------------------
  |  | 1964|  6.78k|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  ------------------
 2810|  6.78k|}
png_check_fp_string:
 2816|  1.30k|{
 2817|  1.30k|   int        state=0;
 2818|  1.30k|   size_t char_index=0;
 2819|       |
 2820|  1.30k|   if (png_check_fp_number(string, size, &state, &char_index) != 0 &&
  ------------------
  |  Branch (2820:8): [True: 862, False: 441]
  ------------------
 2821|  1.30k|      (char_index == size || string[char_index] == 0))
  ------------------
  |  Branch (2821:8): [True: 793, False: 69]
  |  Branch (2821:30): [True: 0, False: 69]
  ------------------
 2822|    793|      return state /* must be non-zero - see above */;
 2823|       |
 2824|    510|   return 0; /* i.e. fail */
 2825|  1.30k|}
png_muldiv:
 3306|  5.85k|{
 3307|       |   /* Return a * times / divisor, rounded. */
 3308|  5.85k|   if (divisor != 0)
  ------------------
  |  Branch (3308:8): [True: 5.85k, False: 2]
  ------------------
 3309|  5.85k|   {
 3310|  5.85k|      if (a == 0 || times == 0)
  ------------------
  |  Branch (3310:11): [True: 585, False: 5.26k]
  |  Branch (3310:21): [True: 37, False: 5.23k]
  ------------------
 3311|    622|      {
 3312|    622|         *res = 0;
 3313|    622|         return 1;
 3314|    622|      }
 3315|  5.23k|      else
 3316|  5.23k|      {
 3317|  5.23k|#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
 3318|  5.23k|         double r = a;
 3319|  5.23k|         r *= times;
 3320|  5.23k|         r /= divisor;
 3321|  5.23k|         r = floor(r+.5);
 3322|       |
 3323|       |         /* A png_fixed_point is a 32-bit integer. */
 3324|  5.23k|         if (r <= 2147483647. && r >= -2147483648.)
  ------------------
  |  Branch (3324:14): [True: 5.23k, False: 1]
  |  Branch (3324:34): [True: 5.23k, False: 1]
  ------------------
 3325|  5.23k|         {
 3326|  5.23k|            *res = (png_fixed_point)r;
 3327|  5.23k|            return 1;
 3328|  5.23k|         }
 3329|       |#else
 3330|       |         int negative = 0;
 3331|       |         png_uint_32 A, T, D;
 3332|       |         png_uint_32 s16, s32, s00;
 3333|       |
 3334|       |         if (a < 0)
 3335|       |            negative = 1, A = -a;
 3336|       |         else
 3337|       |            A = a;
 3338|       |
 3339|       |         if (times < 0)
 3340|       |            negative = !negative, T = -times;
 3341|       |         else
 3342|       |            T = times;
 3343|       |
 3344|       |         if (divisor < 0)
 3345|       |            negative = !negative, D = -divisor;
 3346|       |         else
 3347|       |            D = divisor;
 3348|       |
 3349|       |         /* Following can't overflow because the arguments only
 3350|       |          * have 31 bits each, however the result may be 32 bits.
 3351|       |          */
 3352|       |         s16 = (A >> 16) * (T & 0xffff) +
 3353|       |                           (A & 0xffff) * (T >> 16);
 3354|       |         /* Can't overflow because the a*times bit is only 30
 3355|       |          * bits at most.
 3356|       |          */
 3357|       |         s32 = (A >> 16) * (T >> 16) + (s16 >> 16);
 3358|       |         s00 = (A & 0xffff) * (T & 0xffff);
 3359|       |
 3360|       |         s16 = (s16 & 0xffff) << 16;
 3361|       |         s00 += s16;
 3362|       |
 3363|       |         if (s00 < s16)
 3364|       |            ++s32; /* carry */
 3365|       |
 3366|       |         if (s32 < D) /* else overflow */
 3367|       |         {
 3368|       |            /* s32.s00 is now the 64-bit product, do a standard
 3369|       |             * division, we know that s32 < D, so the maximum
 3370|       |             * required shift is 31.
 3371|       |             */
 3372|       |            int bitshift = 32;
 3373|       |            png_fixed_point result = 0; /* NOTE: signed */
 3374|       |
 3375|       |            while (--bitshift >= 0)
 3376|       |            {
 3377|       |               png_uint_32 d32, d00;
 3378|       |
 3379|       |               if (bitshift > 0)
 3380|       |                  d32 = D >> (32-bitshift), d00 = D << bitshift;
 3381|       |
 3382|       |               else
 3383|       |                  d32 = 0, d00 = D;
 3384|       |
 3385|       |               if (s32 > d32)
 3386|       |               {
 3387|       |                  if (s00 < d00) --s32; /* carry */
 3388|       |                  s32 -= d32, s00 -= d00, result += 1<<bitshift;
 3389|       |               }
 3390|       |
 3391|       |               else
 3392|       |                  if (s32 == d32 && s00 >= d00)
 3393|       |                     s32 = 0, s00 -= d00, result += 1<<bitshift;
 3394|       |            }
 3395|       |
 3396|       |            /* Handle the rounding. */
 3397|       |            if (s00 >= (D >> 1))
 3398|       |               ++result;
 3399|       |
 3400|       |            if (negative != 0)
 3401|       |               result = -result;
 3402|       |
 3403|       |            /* Check for overflow. */
 3404|       |            if ((negative != 0 && result <= 0) ||
 3405|       |                (negative == 0 && result >= 0))
 3406|       |            {
 3407|       |               *res = result;
 3408|       |               return 1;
 3409|       |            }
 3410|       |         }
 3411|       |#endif
 3412|  5.23k|      }
 3413|  5.85k|   }
 3414|       |
 3415|      4|   return 0;
 3416|  5.85k|}
png_reciprocal:
 3441|    687|{
 3442|    687|#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
 3443|    687|   double r = floor(1E10/a+.5);
 3444|       |
 3445|    687|   if (r <= 2147483647. && r >= -2147483648.)
  ------------------
  |  Branch (3445:8): [True: 687, False: 0]
  |  Branch (3445:28): [True: 687, False: 0]
  ------------------
 3446|    687|      return (png_fixed_point)r;
 3447|       |#else
 3448|       |   png_fixed_point res;
 3449|       |
 3450|       |   if (png_muldiv(&res, 100000, 100000, a) != 0)
 3451|       |      return res;
 3452|       |#endif
 3453|       |
 3454|      0|   return 0; /* error/overflow */
 3455|    687|}
png_gamma_significant:
 3462|  1.62k|{
 3463|  1.62k|   return gamma_val < PNG_FP_1 - PNG_GAMMA_THRESHOLD_FIXED ||
  ------------------
  |  |  655|  1.62k|#define PNG_FP_1    100000
  ------------------
                 return gamma_val < PNG_FP_1 - PNG_GAMMA_THRESHOLD_FIXED ||
  ------------------
  |  |  199|  3.25k|#define PNG_GAMMA_THRESHOLD_FIXED 5000
  ------------------
  |  Branch (3463:11): [True: 348, False: 1.27k]
  ------------------
 3464|  1.62k|       gamma_val > PNG_FP_1 + PNG_GAMMA_THRESHOLD_FIXED;
  ------------------
  |  |  655|  1.27k|#define PNG_FP_1    100000
  ------------------
                     gamma_val > PNG_FP_1 + PNG_GAMMA_THRESHOLD_FIXED;
  ------------------
  |  |  199|  1.27k|#define PNG_GAMMA_THRESHOLD_FIXED 5000
  ------------------
  |  Branch (3464:8): [True: 273, False: 1.00k]
  ------------------
 3465|  1.62k|}
png_destroy_gamma_table:
 4089|  4.74k|{
 4090|  4.74k|   png_free(png_ptr, png_ptr->gamma_table);
 4091|  4.74k|   png_ptr->gamma_table = NULL;
 4092|       |
 4093|  4.74k|#ifdef PNG_16BIT_SUPPORTED
 4094|  4.74k|   if (png_ptr->gamma_16_table != NULL)
  ------------------
  |  Branch (4094:8): [True: 0, False: 4.74k]
  ------------------
 4095|      0|   {
 4096|      0|      int i;
 4097|      0|      int istop = (1 << (8 - png_ptr->gamma_shift));
 4098|      0|      for (i = 0; i < istop; i++)
  ------------------
  |  Branch (4098:19): [True: 0, False: 0]
  ------------------
 4099|      0|      {
 4100|      0|         png_free(png_ptr, png_ptr->gamma_16_table[i]);
 4101|      0|      }
 4102|      0|   png_free(png_ptr, png_ptr->gamma_16_table);
 4103|      0|   png_ptr->gamma_16_table = NULL;
 4104|      0|   }
 4105|  4.74k|#endif /* 16BIT */
 4106|       |
 4107|  4.74k|#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
 4108|  4.74k|   defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
 4109|  4.74k|   defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
 4110|  4.74k|   png_free(png_ptr, png_ptr->gamma_from_1);
 4111|  4.74k|   png_ptr->gamma_from_1 = NULL;
 4112|  4.74k|   png_free(png_ptr, png_ptr->gamma_to_1);
 4113|  4.74k|   png_ptr->gamma_to_1 = NULL;
 4114|       |
 4115|  4.74k|#ifdef PNG_16BIT_SUPPORTED
 4116|  4.74k|   if (png_ptr->gamma_16_from_1 != NULL)
  ------------------
  |  Branch (4116:8): [True: 0, False: 4.74k]
  ------------------
 4117|      0|   {
 4118|      0|      int i;
 4119|      0|      int istop = (1 << (8 - png_ptr->gamma_shift));
 4120|      0|      for (i = 0; i < istop; i++)
  ------------------
  |  Branch (4120:19): [True: 0, False: 0]
  ------------------
 4121|      0|      {
 4122|      0|         png_free(png_ptr, png_ptr->gamma_16_from_1[i]);
 4123|      0|      }
 4124|      0|   png_free(png_ptr, png_ptr->gamma_16_from_1);
 4125|      0|   png_ptr->gamma_16_from_1 = NULL;
 4126|      0|   }
 4127|  4.74k|   if (png_ptr->gamma_16_to_1 != NULL)
  ------------------
  |  Branch (4127:8): [True: 0, False: 4.74k]
  ------------------
 4128|      0|   {
 4129|      0|      int i;
 4130|      0|      int istop = (1 << (8 - png_ptr->gamma_shift));
 4131|      0|      for (i = 0; i < istop; i++)
  ------------------
  |  Branch (4131:19): [True: 0, False: 0]
  ------------------
 4132|      0|      {
 4133|      0|         png_free(png_ptr, png_ptr->gamma_16_to_1[i]);
 4134|      0|      }
 4135|      0|   png_free(png_ptr, png_ptr->gamma_16_to_1);
 4136|      0|   png_ptr->gamma_16_to_1 = NULL;
 4137|      0|   }
 4138|  4.74k|#endif /* 16BIT */
 4139|  4.74k|#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
 4140|  4.74k|}
png.c:png_colorspace_check_gamma:
 1060|    742|{
 1061|    742|   png_fixed_point gtest;
 1062|       |
 1063|    742|   if ((colorspace->flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
  ------------------
  |  |  131|    742|#define PNG_COLORSPACE_HAVE_GAMMA           0x0001
  ------------------
  |  Branch (1063:8): [True: 616, False: 126]
  ------------------
 1064|    742|       (png_muldiv(&gtest, colorspace->gamma, PNG_FP_1, gAMA) == 0  ||
  ------------------
  |  |  655|    616|#define PNG_FP_1    100000
  ------------------
  |  Branch (1064:9): [True: 0, False: 616]
  ------------------
 1065|    616|      png_gamma_significant(gtest) != 0))
  ------------------
  |  Branch (1065:7): [True: 604, False: 12]
  ------------------
 1066|    604|   {
 1067|       |      /* Either this is an sRGB image, in which case the calculated gamma
 1068|       |       * approximation should match, or this is an image with a profile and the
 1069|       |       * value libpng calculates for the gamma of the profile does not match the
 1070|       |       * value recorded in the file.  The former, sRGB, case is an error, the
 1071|       |       * latter is just a warning.
 1072|       |       */
 1073|    604|      if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0 || from == 2)
  ------------------
  |  |  136|    604|#define PNG_COLORSPACE_FROM_sRGB            0x0020
  ------------------
  |  Branch (1073:11): [True: 583, False: 21]
  |  Branch (1073:66): [True: 21, False: 0]
  ------------------
 1074|    604|      {
 1075|    604|         png_chunk_report(png_ptr, "gamma value does not match sRGB",
 1076|    604|             PNG_CHUNK_ERROR);
  ------------------
  |  | 1903|    604|#define PNG_CHUNK_ERROR       2 /* always an error */
  ------------------
 1077|       |         /* Do not overwrite an sRGB value */
 1078|    604|         return from == 2;
 1079|    604|      }
 1080|       |
 1081|      0|      else /* sRGB tag not involved */
 1082|      0|      {
 1083|      0|         png_chunk_report(png_ptr, "gamma value does not match libpng estimate",
 1084|      0|             PNG_CHUNK_WARNING);
  ------------------
  |  | 1901|      0|#define PNG_CHUNK_WARNING     0 /* never an error */
  ------------------
 1085|      0|         return from == 1;
 1086|      0|      }
 1087|    604|   }
 1088|       |
 1089|    138|   return 1;
 1090|    742|}
png.c:png_colorspace_check_xy:
 1598|    362|{
 1599|    362|   int result;
 1600|    362|   png_xy xy_test;
 1601|       |
 1602|       |   /* As a side-effect this routine also returns the XYZ endpoints. */
 1603|    362|   result = png_XYZ_from_xy(XYZ, xy);
 1604|    362|   if (result != 0)
  ------------------
  |  Branch (1604:8): [True: 163, False: 199]
  ------------------
 1605|    163|      return result;
 1606|       |
 1607|    199|   result = png_xy_from_XYZ(&xy_test, XYZ);
 1608|    199|   if (result != 0)
  ------------------
  |  Branch (1608:8): [True: 1, False: 198]
  ------------------
 1609|      1|      return result;
 1610|       |
 1611|    198|   if (png_colorspace_endpoints_match(xy, &xy_test,
  ------------------
  |  Branch (1611:8): [True: 88, False: 110]
  ------------------
 1612|    198|       5/*actually, the math is pretty accurate*/) != 0)
 1613|     88|      return 0;
 1614|       |
 1615|       |   /* Too much slip */
 1616|    110|   return 1;
 1617|    198|}
png.c:png_XYZ_from_xy:
 1256|    362|{
 1257|    362|   png_fixed_point red_inverse, green_inverse, blue_scale;
 1258|    362|   png_fixed_point left, right, denominator;
 1259|       |
 1260|       |   /* Check xy and, implicitly, z.  Note that wide gamut color spaces typically
 1261|       |    * have end points with 0 tristimulus values (these are impossible end
 1262|       |    * points, but they are used to cover the possible colors).  We check
 1263|       |    * xy->whitey against 5, not 0, to avoid a possible integer overflow.
 1264|       |    */
 1265|    362|   if (xy->redx   < 0 || xy->redx > PNG_FP_1) return 1;
  ------------------
  |  |  655|    362|#define PNG_FP_1    100000
  ------------------
  |  Branch (1265:8): [True: 0, False: 362]
  |  Branch (1265:26): [True: 8, False: 354]
  ------------------
 1266|    354|   if (xy->redy   < 0 || xy->redy > PNG_FP_1-xy->redx) return 1;
  ------------------
  |  |  655|    354|#define PNG_FP_1    100000
  ------------------
  |  Branch (1266:8): [True: 0, False: 354]
  |  Branch (1266:26): [True: 24, False: 330]
  ------------------
 1267|    330|   if (xy->greenx < 0 || xy->greenx > PNG_FP_1) return 1;
  ------------------
  |  |  655|    330|#define PNG_FP_1    100000
  ------------------
  |  Branch (1267:8): [True: 0, False: 330]
  |  Branch (1267:26): [True: 15, False: 315]
  ------------------
 1268|    315|   if (xy->greeny < 0 || xy->greeny > PNG_FP_1-xy->greenx) return 1;
  ------------------
  |  |  655|    315|#define PNG_FP_1    100000
  ------------------
  |  Branch (1268:8): [True: 0, False: 315]
  |  Branch (1268:26): [True: 18, False: 297]
  ------------------
 1269|    297|   if (xy->bluex  < 0 || xy->bluex > PNG_FP_1) return 1;
  ------------------
  |  |  655|    297|#define PNG_FP_1    100000
  ------------------
  |  Branch (1269:8): [True: 0, False: 297]
  |  Branch (1269:26): [True: 11, False: 286]
  ------------------
 1270|    286|   if (xy->bluey  < 0 || xy->bluey > PNG_FP_1-xy->bluex) return 1;
  ------------------
  |  |  655|    286|#define PNG_FP_1    100000
  ------------------
  |  Branch (1270:8): [True: 0, False: 286]
  |  Branch (1270:26): [True: 16, False: 270]
  ------------------
 1271|    270|   if (xy->whitex < 0 || xy->whitex > PNG_FP_1) return 1;
  ------------------
  |  |  655|    270|#define PNG_FP_1    100000
  ------------------
  |  Branch (1271:8): [True: 0, False: 270]
  |  Branch (1271:26): [True: 12, False: 258]
  ------------------
 1272|    258|   if (xy->whitey < 5 || xy->whitey > PNG_FP_1-xy->whitex) return 1;
  ------------------
  |  |  655|    257|#define PNG_FP_1    100000
  ------------------
  |  Branch (1272:8): [True: 1, False: 257]
  |  Branch (1272:26): [True: 23, False: 234]
  ------------------
 1273|       |
 1274|       |   /* The reverse calculation is more difficult because the original tristimulus
 1275|       |    * value had 9 independent values (red,green,blue)x(X,Y,Z) however only 8
 1276|       |    * derived values were recorded in the cHRM chunk;
 1277|       |    * (red,green,blue,white)x(x,y).  This loses one degree of freedom and
 1278|       |    * therefore an arbitrary ninth value has to be introduced to undo the
 1279|       |    * original transformations.
 1280|       |    *
 1281|       |    * Think of the original end-points as points in (X,Y,Z) space.  The
 1282|       |    * chromaticity values (c) have the property:
 1283|       |    *
 1284|       |    *           C
 1285|       |    *   c = ---------
 1286|       |    *       X + Y + Z
 1287|       |    *
 1288|       |    * For each c (x,y,z) from the corresponding original C (X,Y,Z).  Thus the
 1289|       |    * three chromaticity values (x,y,z) for each end-point obey the
 1290|       |    * relationship:
 1291|       |    *
 1292|       |    *   x + y + z = 1
 1293|       |    *
 1294|       |    * This describes the plane in (X,Y,Z) space that intersects each axis at the
 1295|       |    * value 1.0; call this the chromaticity plane.  Thus the chromaticity
 1296|       |    * calculation has scaled each end-point so that it is on the x+y+z=1 plane
 1297|       |    * and chromaticity is the intersection of the vector from the origin to the
 1298|       |    * (X,Y,Z) value with the chromaticity plane.
 1299|       |    *
 1300|       |    * To fully invert the chromaticity calculation we would need the three
 1301|       |    * end-point scale factors, (red-scale, green-scale, blue-scale), but these
 1302|       |    * were not recorded.  Instead we calculated the reference white (X,Y,Z) and
 1303|       |    * recorded the chromaticity of this.  The reference white (X,Y,Z) would have
 1304|       |    * given all three of the scale factors since:
 1305|       |    *
 1306|       |    *    color-C = color-c * color-scale
 1307|       |    *    white-C = red-C + green-C + blue-C
 1308|       |    *            = red-c*red-scale + green-c*green-scale + blue-c*blue-scale
 1309|       |    *
 1310|       |    * But cHRM records only white-x and white-y, so we have lost the white scale
 1311|       |    * factor:
 1312|       |    *
 1313|       |    *    white-C = white-c*white-scale
 1314|       |    *
 1315|       |    * To handle this the inverse transformation makes an arbitrary assumption
 1316|       |    * about white-scale:
 1317|       |    *
 1318|       |    *    Assume: white-Y = 1.0
 1319|       |    *    Hence:  white-scale = 1/white-y
 1320|       |    *    Or:     red-Y + green-Y + blue-Y = 1.0
 1321|       |    *
 1322|       |    * Notice the last statement of the assumption gives an equation in three of
 1323|       |    * the nine values we want to calculate.  8 more equations come from the
 1324|       |    * above routine as summarised at the top above (the chromaticity
 1325|       |    * calculation):
 1326|       |    *
 1327|       |    *    Given: color-x = color-X / (color-X + color-Y + color-Z)
 1328|       |    *    Hence: (color-x - 1)*color-X + color.x*color-Y + color.x*color-Z = 0
 1329|       |    *
 1330|       |    * This is 9 simultaneous equations in the 9 variables "color-C" and can be
 1331|       |    * solved by Cramer's rule.  Cramer's rule requires calculating 10 9x9 matrix
 1332|       |    * determinants, however this is not as bad as it seems because only 28 of
 1333|       |    * the total of 90 terms in the various matrices are non-zero.  Nevertheless
 1334|       |    * Cramer's rule is notoriously numerically unstable because the determinant
 1335|       |    * calculation involves the difference of large, but similar, numbers.  It is
 1336|       |    * difficult to be sure that the calculation is stable for real world values
 1337|       |    * and it is certain that it becomes unstable where the end points are close
 1338|       |    * together.
 1339|       |    *
 1340|       |    * So this code uses the perhaps slightly less optimal but more
 1341|       |    * understandable and totally obvious approach of calculating color-scale.
 1342|       |    *
 1343|       |    * This algorithm depends on the precision in white-scale and that is
 1344|       |    * (1/white-y), so we can immediately see that as white-y approaches 0 the
 1345|       |    * accuracy inherent in the cHRM chunk drops off substantially.
 1346|       |    *
 1347|       |    * libpng arithmetic: a simple inversion of the above equations
 1348|       |    * ------------------------------------------------------------
 1349|       |    *
 1350|       |    *    white_scale = 1/white-y
 1351|       |    *    white-X = white-x * white-scale
 1352|       |    *    white-Y = 1.0
 1353|       |    *    white-Z = (1 - white-x - white-y) * white_scale
 1354|       |    *
 1355|       |    *    white-C = red-C + green-C + blue-C
 1356|       |    *            = red-c*red-scale + green-c*green-scale + blue-c*blue-scale
 1357|       |    *
 1358|       |    * This gives us three equations in (red-scale,green-scale,blue-scale) where
 1359|       |    * all the coefficients are now known:
 1360|       |    *
 1361|       |    *    red-x*red-scale + green-x*green-scale + blue-x*blue-scale
 1362|       |    *       = white-x/white-y
 1363|       |    *    red-y*red-scale + green-y*green-scale + blue-y*blue-scale = 1
 1364|       |    *    red-z*red-scale + green-z*green-scale + blue-z*blue-scale
 1365|       |    *       = (1 - white-x - white-y)/white-y
 1366|       |    *
 1367|       |    * In the last equation color-z is (1 - color-x - color-y) so we can add all
 1368|       |    * three equations together to get an alternative third:
 1369|       |    *
 1370|       |    *    red-scale + green-scale + blue-scale = 1/white-y = white-scale
 1371|       |    *
 1372|       |    * So now we have a Cramer's rule solution where the determinants are just
 1373|       |    * 3x3 - far more tractible.  Unfortunately 3x3 determinants still involve
 1374|       |    * multiplication of three coefficients so we can't guarantee to avoid
 1375|       |    * overflow in the libpng fixed point representation.  Using Cramer's rule in
 1376|       |    * floating point is probably a good choice here, but it's not an option for
 1377|       |    * fixed point.  Instead proceed to simplify the first two equations by
 1378|       |    * eliminating what is likely to be the largest value, blue-scale:
 1379|       |    *
 1380|       |    *    blue-scale = white-scale - red-scale - green-scale
 1381|       |    *
 1382|       |    * Hence:
 1383|       |    *
 1384|       |    *    (red-x - blue-x)*red-scale + (green-x - blue-x)*green-scale =
 1385|       |    *                (white-x - blue-x)*white-scale
 1386|       |    *
 1387|       |    *    (red-y - blue-y)*red-scale + (green-y - blue-y)*green-scale =
 1388|       |    *                1 - blue-y*white-scale
 1389|       |    *
 1390|       |    * And now we can trivially solve for (red-scale,green-scale):
 1391|       |    *
 1392|       |    *    green-scale =
 1393|       |    *                (white-x - blue-x)*white-scale - (red-x - blue-x)*red-scale
 1394|       |    *                -----------------------------------------------------------
 1395|       |    *                                  green-x - blue-x
 1396|       |    *
 1397|       |    *    red-scale =
 1398|       |    *                1 - blue-y*white-scale - (green-y - blue-y) * green-scale
 1399|       |    *                ---------------------------------------------------------
 1400|       |    *                                  red-y - blue-y
 1401|       |    *
 1402|       |    * Hence:
 1403|       |    *
 1404|       |    *    red-scale =
 1405|       |    *          ( (green-x - blue-x) * (white-y - blue-y) -
 1406|       |    *            (green-y - blue-y) * (white-x - blue-x) ) / white-y
 1407|       |    * -------------------------------------------------------------------------
 1408|       |    *  (green-x - blue-x)*(red-y - blue-y)-(green-y - blue-y)*(red-x - blue-x)
 1409|       |    *
 1410|       |    *    green-scale =
 1411|       |    *          ( (red-y - blue-y) * (white-x - blue-x) -
 1412|       |    *            (red-x - blue-x) * (white-y - blue-y) ) / white-y
 1413|       |    * -------------------------------------------------------------------------
 1414|       |    *  (green-x - blue-x)*(red-y - blue-y)-(green-y - blue-y)*(red-x - blue-x)
 1415|       |    *
 1416|       |    * Accuracy:
 1417|       |    * The input values have 5 decimal digits of accuracy.  The values are all in
 1418|       |    * the range 0 < value < 1, so simple products are in the same range but may
 1419|       |    * need up to 10 decimal digits to preserve the original precision and avoid
 1420|       |    * underflow.  Because we are using a 32-bit signed representation we cannot
 1421|       |    * match this; the best is a little over 9 decimal digits, less than 10.
 1422|       |    *
 1423|       |    * The approach used here is to preserve the maximum precision within the
 1424|       |    * signed representation.  Because the red-scale calculation above uses the
 1425|       |    * difference between two products of values that must be in the range -1..+1
 1426|       |    * it is sufficient to divide the product by 7; ceil(100,000/32767*2).  The
 1427|       |    * factor is irrelevant in the calculation because it is applied to both
 1428|       |    * numerator and denominator.
 1429|       |    *
 1430|       |    * Note that the values of the differences of the products of the
 1431|       |    * chromaticities in the above equations tend to be small, for example for
 1432|       |    * the sRGB chromaticities they are:
 1433|       |    *
 1434|       |    * red numerator:    -0.04751
 1435|       |    * green numerator:  -0.08788
 1436|       |    * denominator:      -0.2241 (without white-y multiplication)
 1437|       |    *
 1438|       |    *  The resultant Y coefficients from the chromaticities of some widely used
 1439|       |    *  color space definitions are (to 15 decimal places):
 1440|       |    *
 1441|       |    *  sRGB
 1442|       |    *    0.212639005871510 0.715168678767756 0.072192315360734
 1443|       |    *  Kodak ProPhoto
 1444|       |    *    0.288071128229293 0.711843217810102 0.000085653960605
 1445|       |    *  Adobe RGB
 1446|       |    *    0.297344975250536 0.627363566255466 0.075291458493998
 1447|       |    *  Adobe Wide Gamut RGB
 1448|       |    *    0.258728243040113 0.724682314948566 0.016589442011321
 1449|       |    */
 1450|       |   /* By the argument, above overflow should be impossible here. The return
 1451|       |    * value of 2 indicates an internal error to the caller.
 1452|       |    */
 1453|    234|   if (png_muldiv(&left, xy->greenx-xy->bluex, xy->redy - xy->bluey, 7) == 0)
  ------------------
  |  Branch (1453:8): [True: 0, False: 234]
  ------------------
 1454|      0|      return 2;
 1455|    234|   if (png_muldiv(&right, xy->greeny-xy->bluey, xy->redx - xy->bluex, 7) == 0)
  ------------------
  |  Branch (1455:8): [True: 0, False: 234]
  ------------------
 1456|      0|      return 2;
 1457|    234|   denominator = left - right;
 1458|       |
 1459|       |   /* Now find the red numerator. */
 1460|    234|   if (png_muldiv(&left, xy->greenx-xy->bluex, xy->whitey-xy->bluey, 7) == 0)
  ------------------
  |  Branch (1460:8): [True: 0, False: 234]
  ------------------
 1461|      0|      return 2;
 1462|    234|   if (png_muldiv(&right, xy->greeny-xy->bluey, xy->whitex-xy->bluex, 7) == 0)
  ------------------
  |  Branch (1462:8): [True: 0, False: 234]
  ------------------
 1463|      0|      return 2;
 1464|       |
 1465|       |   /* Overflow is possible here and it indicates an extreme set of PNG cHRM
 1466|       |    * chunk values.  This calculation actually returns the reciprocal of the
 1467|       |    * scale value because this allows us to delay the multiplication of white-y
 1468|       |    * into the denominator, which tends to produce a small number.
 1469|       |    */
 1470|    234|   if (png_muldiv(&red_inverse, xy->whitey, denominator, left-right) == 0 ||
  ------------------
  |  Branch (1470:8): [True: 1, False: 233]
  ------------------
 1471|    234|       red_inverse <= xy->whitey /* r+g+b scales = white scale */)
  ------------------
  |  Branch (1471:8): [True: 3, False: 230]
  ------------------
 1472|      4|      return 1;
 1473|       |
 1474|       |   /* Similarly for green_inverse: */
 1475|    230|   if (png_muldiv(&left, xy->redy-xy->bluey, xy->whitex-xy->bluex, 7) == 0)
  ------------------
  |  Branch (1475:8): [True: 0, False: 230]
  ------------------
 1476|      0|      return 2;
 1477|    230|   if (png_muldiv(&right, xy->redx-xy->bluex, xy->whitey-xy->bluey, 7) == 0)
  ------------------
  |  Branch (1477:8): [True: 0, False: 230]
  ------------------
 1478|      0|      return 2;
 1479|    230|   if (png_muldiv(&green_inverse, xy->whitey, denominator, left-right) == 0 ||
  ------------------
  |  Branch (1479:8): [True: 2, False: 228]
  ------------------
 1480|    230|       green_inverse <= xy->whitey)
  ------------------
  |  Branch (1480:8): [True: 6, False: 222]
  ------------------
 1481|      8|      return 1;
 1482|       |
 1483|       |   /* And the blue scale, the checks above guarantee this can't overflow but it
 1484|       |    * can still produce 0 for extreme cHRM values.
 1485|       |    */
 1486|    222|   blue_scale = png_reciprocal(xy->whitey) - png_reciprocal(red_inverse) -
 1487|    222|       png_reciprocal(green_inverse);
 1488|    222|   if (blue_scale <= 0)
  ------------------
  |  Branch (1488:8): [True: 23, False: 199]
  ------------------
 1489|     23|      return 1;
 1490|       |
 1491|       |
 1492|       |   /* And fill in the png_XYZ: */
 1493|    199|   if (png_muldiv(&XYZ->red_X, xy->redx, PNG_FP_1, red_inverse) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1493:8): [True: 0, False: 199]
  ------------------
 1494|      0|      return 1;
 1495|    199|   if (png_muldiv(&XYZ->red_Y, xy->redy, PNG_FP_1, red_inverse) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1495:8): [True: 0, False: 199]
  ------------------
 1496|      0|      return 1;
 1497|    199|   if (png_muldiv(&XYZ->red_Z, PNG_FP_1 - xy->redx - xy->redy, PNG_FP_1,
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
                 if (png_muldiv(&XYZ->red_Z, PNG_FP_1 - xy->redx - xy->redy, PNG_FP_1,
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1497:8): [True: 0, False: 199]
  ------------------
 1498|    199|       red_inverse) == 0)
 1499|      0|      return 1;
 1500|       |
 1501|    199|   if (png_muldiv(&XYZ->green_X, xy->greenx, PNG_FP_1, green_inverse) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1501:8): [True: 0, False: 199]
  ------------------
 1502|      0|      return 1;
 1503|    199|   if (png_muldiv(&XYZ->green_Y, xy->greeny, PNG_FP_1, green_inverse) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1503:8): [True: 0, False: 199]
  ------------------
 1504|      0|      return 1;
 1505|    199|   if (png_muldiv(&XYZ->green_Z, PNG_FP_1 - xy->greenx - xy->greeny, PNG_FP_1,
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
                 if (png_muldiv(&XYZ->green_Z, PNG_FP_1 - xy->greenx - xy->greeny, PNG_FP_1,
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1505:8): [True: 0, False: 199]
  ------------------
 1506|    199|       green_inverse) == 0)
 1507|      0|      return 1;
 1508|       |
 1509|    199|   if (png_muldiv(&XYZ->blue_X, xy->bluex, blue_scale, PNG_FP_1) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1509:8): [True: 0, False: 199]
  ------------------
 1510|      0|      return 1;
 1511|    199|   if (png_muldiv(&XYZ->blue_Y, xy->bluey, blue_scale, PNG_FP_1) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1511:8): [True: 0, False: 199]
  ------------------
 1512|      0|      return 1;
 1513|    199|   if (png_muldiv(&XYZ->blue_Z, PNG_FP_1 - xy->bluex - xy->bluey, blue_scale,
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1513:8): [True: 0, False: 199]
  ------------------
 1514|    199|       PNG_FP_1) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
 1515|      0|      return 1;
 1516|       |
 1517|    199|   return 0; /*success*/
 1518|    199|}
png.c:png_xy_from_XYZ:
 1213|    199|{
 1214|    199|   png_int_32 d, dwhite, whiteX, whiteY;
 1215|       |
 1216|    199|   d = XYZ->red_X + XYZ->red_Y + XYZ->red_Z;
 1217|    199|   if (png_muldiv(&xy->redx, XYZ->red_X, PNG_FP_1, d) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1217:8): [True: 0, False: 199]
  ------------------
 1218|      0|      return 1;
 1219|    199|   if (png_muldiv(&xy->redy, XYZ->red_Y, PNG_FP_1, d) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1219:8): [True: 0, False: 199]
  ------------------
 1220|      0|      return 1;
 1221|    199|   dwhite = d;
 1222|    199|   whiteX = XYZ->red_X;
 1223|    199|   whiteY = XYZ->red_Y;
 1224|       |
 1225|    199|   d = XYZ->green_X + XYZ->green_Y + XYZ->green_Z;
 1226|    199|   if (png_muldiv(&xy->greenx, XYZ->green_X, PNG_FP_1, d) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1226:8): [True: 0, False: 199]
  ------------------
 1227|      0|      return 1;
 1228|    199|   if (png_muldiv(&xy->greeny, XYZ->green_Y, PNG_FP_1, d) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1228:8): [True: 0, False: 199]
  ------------------
 1229|      0|      return 1;
 1230|    199|   dwhite += d;
 1231|    199|   whiteX += XYZ->green_X;
 1232|    199|   whiteY += XYZ->green_Y;
 1233|       |
 1234|    199|   d = XYZ->blue_X + XYZ->blue_Y + XYZ->blue_Z;
 1235|    199|   if (png_muldiv(&xy->bluex, XYZ->blue_X, PNG_FP_1, d) == 0)
  ------------------
  |  |  655|    199|#define PNG_FP_1    100000
  ------------------
  |  Branch (1235:8): [True: 1, False: 198]
  ------------------
 1236|      1|      return 1;
 1237|    198|   if (png_muldiv(&xy->bluey, XYZ->blue_Y, PNG_FP_1, d) == 0)
  ------------------
  |  |  655|    198|#define PNG_FP_1    100000
  ------------------
  |  Branch (1237:8): [True: 0, False: 198]
  ------------------
 1238|      0|      return 1;
 1239|    198|   dwhite += d;
 1240|    198|   whiteX += XYZ->blue_X;
 1241|    198|   whiteY += XYZ->blue_Y;
 1242|       |
 1243|       |   /* The reference white is simply the sum of the end-point (X,Y,Z) vectors,
 1244|       |    * thus:
 1245|       |    */
 1246|    198|   if (png_muldiv(&xy->whitex, whiteX, PNG_FP_1, dwhite) == 0)
  ------------------
  |  |  655|    198|#define PNG_FP_1    100000
  ------------------
  |  Branch (1246:8): [True: 0, False: 198]
  ------------------
 1247|      0|      return 1;
 1248|    198|   if (png_muldiv(&xy->whitey, whiteY, PNG_FP_1, dwhite) == 0)
  ------------------
  |  |  655|    198|#define PNG_FP_1    100000
  ------------------
  |  Branch (1248:8): [True: 0, False: 198]
  ------------------
 1249|      0|      return 1;
 1250|       |
 1251|    198|   return 0;
 1252|    198|}
png.c:png_colorspace_set_xy_and_XYZ:
 1654|     88|{
 1655|     88|   if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
  ------------------
  |  |  139|     88|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
  |  Branch (1655:8): [True: 0, False: 88]
  ------------------
 1656|      0|      return 0;
 1657|       |
 1658|       |   /* The consistency check is performed on the chromaticities; this factors out
 1659|       |    * variations because of the normalization (or not) of the end point Y
 1660|       |    * values.
 1661|       |    */
 1662|     88|   if (preferred < 2 &&
  ------------------
  |  Branch (1662:8): [True: 88, False: 0]
  ------------------
 1663|     88|       (colorspace->flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
  ------------------
  |  |  132|     88|#define PNG_COLORSPACE_HAVE_ENDPOINTS       0x0002
  ------------------
  |  Branch (1663:8): [True: 4, False: 84]
  ------------------
 1664|      4|   {
 1665|       |      /* The end points must be reasonably close to any we already have.  The
 1666|       |       * following allows an error of up to +/-.001
 1667|       |       */
 1668|      4|      if (png_colorspace_endpoints_match(xy, &colorspace->end_points_xy,
  ------------------
  |  Branch (1668:11): [True: 2, False: 2]
  ------------------
 1669|      4|          100) == 0)
 1670|      2|      {
 1671|      2|         colorspace->flags |= PNG_COLORSPACE_INVALID;
  ------------------
  |  |  139|      2|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
 1672|      2|         png_benign_error(png_ptr, "inconsistent chromaticities");
 1673|      2|         return 0; /* failed */
 1674|      2|      }
 1675|       |
 1676|       |      /* Only overwrite with preferred values */
 1677|      2|      if (preferred == 0)
  ------------------
  |  Branch (1677:11): [True: 0, False: 2]
  ------------------
 1678|      0|         return 1; /* ok, but no change */
 1679|      2|   }
 1680|       |
 1681|     86|   colorspace->end_points_xy = *xy;
 1682|     86|   colorspace->end_points_XYZ = *XYZ;
 1683|     86|   colorspace->flags |= PNG_COLORSPACE_HAVE_ENDPOINTS;
  ------------------
  |  |  132|     86|#define PNG_COLORSPACE_HAVE_ENDPOINTS       0x0002
  ------------------
 1684|       |
 1685|       |   /* The end points are normally quoted to two decimal digits, so allow +/-0.01
 1686|       |    * on this test.
 1687|       |    */
 1688|     86|   if (png_colorspace_endpoints_match(xy, &sRGB_xy, 1000) != 0)
  ------------------
  |  Branch (1688:8): [True: 19, False: 67]
  ------------------
 1689|     19|      colorspace->flags |= PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB;
  ------------------
  |  |  137|     19|#define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0040
  ------------------
 1690|       |
 1691|     67|   else
 1692|     67|      colorspace->flags &= PNG_COLORSPACE_CANCEL(
  ------------------
  |  |  140|     67|#define PNG_COLORSPACE_CANCEL(flags)        (0xffff ^ (flags))
  ------------------
 1693|     86|         PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB);
 1694|       |
 1695|     86|   return 2; /* ok and changed */
 1696|     88|}
png.c:png_icc_profile_error:
 1804|  19.7k|{
 1805|  19.7k|   size_t pos;
 1806|  19.7k|   char message[196]; /* see below for calculation */
 1807|       |
 1808|  19.7k|   if (colorspace != NULL)
  ------------------
  |  Branch (1808:8): [True: 816, False: 18.8k]
  ------------------
 1809|    816|      colorspace->flags |= PNG_COLORSPACE_INVALID;
  ------------------
  |  |  139|    816|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
 1810|       |
 1811|  19.7k|   pos = png_safecat(message, (sizeof message), 0, "profile '"); /* 9 chars */
 1812|  19.7k|   pos = png_safecat(message, pos+79, pos, name); /* Truncate to 79 chars */
 1813|  19.7k|   pos = png_safecat(message, (sizeof message), pos, "': "); /* +2 = 90 */
 1814|  19.7k|   if (is_ICC_signature(value) != 0)
  ------------------
  |  Branch (1814:8): [True: 2.34k, False: 17.3k]
  ------------------
 1815|  2.34k|   {
 1816|       |      /* So 'value' is at most 4 bytes and the following cast is safe */
 1817|  2.34k|      png_icc_tag_name(message+pos, (png_uint_32)value);
 1818|  2.34k|      pos += 6; /* total +8; less than the else clause */
 1819|  2.34k|      message[pos++] = ':';
 1820|  2.34k|      message[pos++] = ' ';
 1821|  2.34k|   }
 1822|  17.3k|#  ifdef PNG_WARNINGS_SUPPORTED
 1823|  17.3k|   else
 1824|  17.3k|   {
 1825|  17.3k|      char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */
 1826|       |
 1827|  17.3k|      pos = png_safecat(message, (sizeof message), pos,
 1828|  17.3k|          png_format_number(number, number+(sizeof number),
 1829|  17.3k|          PNG_NUMBER_FORMAT_x, value));
  ------------------
  |  | 1820|  17.3k|#define PNG_NUMBER_FORMAT_x     3
  ------------------
 1830|  17.3k|      pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */
 1831|  17.3k|   }
 1832|  19.7k|#  endif
 1833|       |   /* The 'reason' is an arbitrary message, allow +79 maximum 195 */
 1834|  19.7k|   pos = png_safecat(message, (sizeof message), pos, reason);
 1835|  19.7k|   PNG_UNUSED(pos)
  ------------------
  |  |  488|  19.7k|#  define PNG_UNUSED(param) (void)param;
  ------------------
 1836|       |
 1837|       |   /* This is recoverable, but make it unconditionally an app_error on write to
 1838|       |    * avoid writing invalid ICC profiles into PNG files (i.e., we handle them
 1839|       |    * on read, with a warning, but on write unless the app turns off
 1840|       |    * application errors the PNG won't be written.)
 1841|       |    */
 1842|  19.7k|   png_chunk_report(png_ptr, message,
 1843|  19.7k|       (colorspace != NULL) ? PNG_CHUNK_ERROR : PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1903|    816|#define PNG_CHUNK_ERROR       2 /* always an error */
  ------------------
                     (colorspace != NULL) ? PNG_CHUNK_ERROR : PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|  18.8k|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
  |  Branch (1843:8): [True: 816, False: 18.8k]
  ------------------
 1844|       |
 1845|  19.7k|   return 0;
 1846|  19.7k|}
png.c:is_ICC_signature:
 1794|  19.7k|{
 1795|  19.7k|   return is_ICC_signature_char(it >> 24) /* checks all the top bits */ &&
  ------------------
  |  Branch (1795:11): [True: 8.39k, False: 11.3k]
  ------------------
 1796|  19.7k|      is_ICC_signature_char((it >> 16) & 0xff) &&
  ------------------
  |  Branch (1796:7): [True: 6.74k, False: 1.65k]
  ------------------
 1797|  19.7k|      is_ICC_signature_char((it >> 8) & 0xff) &&
  ------------------
  |  Branch (1797:7): [True: 4.75k, False: 1.98k]
  ------------------
 1798|  19.7k|      is_ICC_signature_char(it & 0xff);
  ------------------
  |  Branch (1798:7): [True: 2.34k, False: 2.41k]
  ------------------
 1799|  19.7k|}
png.c:is_ICC_signature_char:
 1787|  39.6k|{
 1788|  39.6k|   return it == 32 || (it >= 48 && it <= 57) || (it >= 65 && it <= 90) ||
  ------------------
  |  Branch (1788:11): [True: 1.04k, False: 38.5k]
  |  Branch (1788:24): [True: 26.3k, False: 12.2k]
  |  Branch (1788:36): [True: 1.89k, False: 24.4k]
  |  Branch (1788:50): [True: 23.5k, False: 13.0k]
  |  Branch (1788:62): [True: 6.92k, False: 16.6k]
  ------------------
 1789|  39.6k|      (it >= 97 && it <= 122);
  ------------------
  |  Branch (1789:8): [True: 15.3k, False: 14.3k]
  |  Branch (1789:20): [True: 12.3k, False: 2.98k]
  ------------------
 1790|  39.6k|}
png.c:png_icc_tag_name:
 1776|  2.34k|{
 1777|  2.34k|   name[0] = '\'';
 1778|  2.34k|   name[1] = png_icc_tag_char(tag >> 24);
 1779|  2.34k|   name[2] = png_icc_tag_char(tag >> 16);
 1780|  2.34k|   name[3] = png_icc_tag_char(tag >>  8);
 1781|  2.34k|   name[4] = png_icc_tag_char(tag      );
 1782|  2.34k|   name[5] = '\'';
 1783|  2.34k|}
png.c:png_icc_tag_char:
 1766|  9.37k|{
 1767|  9.37k|   byte &= 0xff;
 1768|  9.37k|   if (byte >= 32 && byte <= 126)
  ------------------
  |  Branch (1768:8): [True: 9.37k, False: 0]
  |  Branch (1768:22): [True: 9.37k, False: 0]
  ------------------
 1769|  9.37k|      return (char)byte;
 1770|      0|   else
 1771|      0|      return '?';
 1772|  9.37k|}
png.c:png_colorspace_endpoints_match:
 1572|    301|{
 1573|       |   /* Allow an error of +/-0.01 (absolute value) on each chromaticity */
 1574|    301|   if (PNG_OUT_OF_RANGE(xy1->whitex, xy2->whitex,delta) ||
  ------------------
  |  |  792|    602|   ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
  |  |  ------------------
  |  |  |  Branch (792:6): [True: 22, False: 279]
  |  |  |  Branch (792:35): [True: 46, False: 233]
  |  |  ------------------
  ------------------
 1575|    301|       PNG_OUT_OF_RANGE(xy1->whitey, xy2->whitey,delta) ||
  ------------------
  |  |  792|    534|   ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
  |  |  ------------------
  |  |  |  Branch (792:6): [True: 2, False: 231]
  |  |  |  Branch (792:35): [True: 11, False: 220]
  |  |  ------------------
  ------------------
 1576|    301|       PNG_OUT_OF_RANGE(xy1->redx,   xy2->redx,  delta) ||
  ------------------
  |  |  792|    521|   ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
  |  |  ------------------
  |  |  |  Branch (792:6): [True: 1, False: 219]
  |  |  |  Branch (792:35): [True: 16, False: 203]
  |  |  ------------------
  ------------------
 1577|    301|       PNG_OUT_OF_RANGE(xy1->redy,   xy2->redy,  delta) ||
  ------------------
  |  |  792|    504|   ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
  |  |  ------------------
  |  |  |  Branch (792:6): [True: 3, False: 200]
  |  |  |  Branch (792:35): [True: 11, False: 189]
  |  |  ------------------
  ------------------
 1578|    301|       PNG_OUT_OF_RANGE(xy1->greenx, xy2->greenx,delta) ||
  ------------------
  |  |  792|    490|   ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
  |  |  ------------------
  |  |  |  Branch (792:6): [True: 1, False: 188]
  |  |  |  Branch (792:35): [True: 20, False: 168]
  |  |  ------------------
  ------------------
 1579|    301|       PNG_OUT_OF_RANGE(xy1->greeny, xy2->greeny,delta) ||
  ------------------
  |  |  792|    469|   ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
  |  |  ------------------
  |  |  |  Branch (792:6): [True: 5, False: 163]
  |  |  |  Branch (792:35): [True: 18, False: 145]
  |  |  ------------------
  ------------------
 1580|    301|       PNG_OUT_OF_RANGE(xy1->bluex,  xy2->bluex, delta) ||
  ------------------
  |  |  792|    446|   ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
  |  |  ------------------
  |  |  |  Branch (792:6): [True: 2, False: 143]
  |  |  |  Branch (792:35): [True: 13, False: 130]
  |  |  ------------------
  ------------------
 1581|    301|       PNG_OUT_OF_RANGE(xy1->bluey,  xy2->bluey, delta))
  ------------------
  |  |  792|    130|   ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
  |  |  ------------------
  |  |  |  Branch (792:6): [True: 1, False: 129]
  |  |  |  Branch (792:35): [True: 16, False: 113]
  |  |  ------------------
  ------------------
 1582|    188|      return 0;
 1583|    113|   return 1;
 1584|    301|}
png.c:icc_check_length:
 1951|  5.74k|{
 1952|  5.74k|   if (profile_length < 132)
  ------------------
  |  Branch (1952:8): [True: 7, False: 5.73k]
  ------------------
 1953|      7|      return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
 1954|      7|          "too short");
 1955|  5.73k|   return 1;
 1956|  5.74k|}
png.c:png_compare_ICC_profile_with_sRGB:
 2288|  4.66k|{
 2289|       |   /* The quick check is to verify just the MD5 signature and trust the
 2290|       |    * rest of the data.  Because the profile has already been verified for
 2291|       |    * correctness this is safe.  png_colorspace_set_sRGB will check the 'intent'
 2292|       |    * field too, so if the profile has been edited with an intent not defined
 2293|       |    * by sRGB (but maybe defined by a later ICC specification) the read of
 2294|       |    * the profile will fail at that point.
 2295|       |    */
 2296|       |
 2297|  4.66k|   png_uint_32 length = 0;
 2298|  4.66k|   png_uint_32 intent = 0x10000; /* invalid */
 2299|  4.66k|#if PNG_sRGB_PROFILE_CHECKS > 1
 2300|  4.66k|   uLong crc = 0; /* the value for 0 length data */
 2301|  4.66k|#endif
 2302|  4.66k|   unsigned int i;
 2303|       |
 2304|  4.66k|#ifdef PNG_SET_OPTION_SUPPORTED
 2305|       |   /* First see if PNG_SKIP_sRGB_CHECK_PROFILE has been set to "on" */
 2306|  4.66k|   if (((png_ptr->options >> PNG_SKIP_sRGB_CHECK_PROFILE) & 3) ==
  ------------------
  |  | 3202|  4.66k|#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
  ------------------
  |  Branch (2306:8): [True: 0, False: 4.66k]
  ------------------
 2307|  4.66k|               PNG_OPTION_ON)
  ------------------
  |  | 3223|  4.66k|#define PNG_OPTION_ON      3
  ------------------
 2308|      0|      return 0;
 2309|  4.66k|#endif
 2310|       |
 2311|  36.1k|   for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i)
  ------------------
  |  Branch (2311:14): [True: 32.3k, False: 3.77k]
  ------------------
 2312|  32.3k|   {
 2313|  32.3k|      if (png_get_uint_32(profile+84) == png_sRGB_checks[i].md5[0] &&
  ------------------
  |  | 2594|  32.3k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  32.3k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  32.3k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  32.3k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  32.3k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
  |  Branch (2313:11): [True: 11.9k, False: 20.4k]
  ------------------
 2314|  32.3k|         png_get_uint_32(profile+88) == png_sRGB_checks[i].md5[1] &&
  ------------------
  |  | 2594|  11.9k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  11.9k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  11.9k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  11.9k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  11.9k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
  |  Branch (2314:10): [True: 10.3k, False: 1.62k]
  ------------------
 2315|  32.3k|         png_get_uint_32(profile+92) == png_sRGB_checks[i].md5[2] &&
  ------------------
  |  | 2594|  10.3k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  10.3k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  10.3k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  10.3k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  10.3k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
  |  Branch (2315:10): [True: 9.12k, False: 1.19k]
  ------------------
 2316|  32.3k|         png_get_uint_32(profile+96) == png_sRGB_checks[i].md5[3])
  ------------------
  |  | 2594|  9.12k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  9.12k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  9.12k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  9.12k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  9.12k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
  |  Branch (2316:10): [True: 8.09k, False: 1.02k]
  ------------------
 2317|  8.09k|      {
 2318|       |         /* This may be one of the old HP profiles without an MD5, in that
 2319|       |          * case we can only use the length and Adler32 (note that these
 2320|       |          * are not used by default if there is an MD5!)
 2321|       |          */
 2322|       |#        if PNG_sRGB_PROFILE_CHECKS == 0
 2323|       |            if (png_sRGB_checks[i].have_md5 != 0)
 2324|       |               return 1+png_sRGB_checks[i].is_broken;
 2325|       |#        endif
 2326|       |
 2327|       |         /* Profile is unsigned or more checks have been configured in. */
 2328|  8.09k|         if (length == 0)
  ------------------
  |  Branch (2328:14): [True: 2.78k, False: 5.31k]
  ------------------
 2329|  2.78k|         {
 2330|  2.78k|            length = png_get_uint_32(profile);
  ------------------
  |  | 2594|  2.78k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  2.78k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  2.78k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  2.78k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  2.78k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2331|  2.78k|            intent = png_get_uint_32(profile+64);
  ------------------
  |  | 2594|  2.78k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  2.78k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  2.78k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  2.78k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  2.78k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2332|  2.78k|         }
 2333|       |
 2334|       |         /* Length *and* intent must match */
 2335|  8.09k|         if (length == (png_uint_32) png_sRGB_checks[i].length &&
  ------------------
  |  Branch (2335:14): [True: 2.38k, False: 5.70k]
  ------------------
 2336|  8.09k|            intent == (png_uint_32) png_sRGB_checks[i].intent)
  ------------------
  |  Branch (2336:13): [True: 892, False: 1.49k]
  ------------------
 2337|    892|         {
 2338|       |            /* Now calculate the adler32 if not done already. */
 2339|    892|            if (adler == 0)
  ------------------
  |  Branch (2339:17): [True: 147, False: 745]
  ------------------
 2340|    147|            {
 2341|    147|               adler = adler32(0, NULL, 0);
 2342|    147|               adler = adler32(adler, profile, length);
 2343|    147|            }
 2344|       |
 2345|    892|            if (adler == png_sRGB_checks[i].adler)
  ------------------
  |  Branch (2345:17): [True: 42, False: 850]
  ------------------
 2346|     42|            {
 2347|       |               /* These basic checks suggest that the data has not been
 2348|       |                * modified, but if the check level is more than 1 perform
 2349|       |                * our own crc32 checksum on the data.
 2350|       |                */
 2351|     42|#              if PNG_sRGB_PROFILE_CHECKS > 1
 2352|     42|                  if (crc == 0)
  ------------------
  |  Branch (2352:23): [True: 42, False: 0]
  ------------------
 2353|     42|                  {
 2354|     42|                     crc = crc32(0, NULL, 0);
 2355|     42|                     crc = crc32(crc, profile, length);
 2356|     42|                  }
 2357|       |
 2358|       |                  /* So this check must pass for the 'return' below to happen.
 2359|       |                   */
 2360|     42|                  if (crc == png_sRGB_checks[i].crc)
  ------------------
  |  Branch (2360:23): [True: 1, False: 41]
  ------------------
 2361|      1|#              endif
 2362|      1|               {
 2363|      1|                  if (png_sRGB_checks[i].is_broken != 0)
  ------------------
  |  Branch (2363:23): [True: 1, False: 0]
  ------------------
 2364|      1|                  {
 2365|       |                     /* These profiles are known to have bad data that may cause
 2366|       |                      * problems if they are used, therefore attempt to
 2367|       |                      * discourage their use, skip the 'have_md5' warning below,
 2368|       |                      * which is made irrelevant by this error.
 2369|       |                      */
 2370|      1|                     png_chunk_report(png_ptr, "known incorrect sRGB profile",
 2371|      1|                         PNG_CHUNK_ERROR);
  ------------------
  |  | 1903|      1|#define PNG_CHUNK_ERROR       2 /* always an error */
  ------------------
 2372|      1|                  }
 2373|       |
 2374|       |                  /* Warn that this being done; this isn't even an error since
 2375|       |                   * the profile is perfectly valid, but it would be nice if
 2376|       |                   * people used the up-to-date ones.
 2377|       |                   */
 2378|      0|                  else if (png_sRGB_checks[i].have_md5 == 0)
  ------------------
  |  Branch (2378:28): [True: 0, False: 0]
  ------------------
 2379|      0|                  {
 2380|      0|                     png_chunk_report(png_ptr,
 2381|      0|                         "out-of-date sRGB profile with no signature",
 2382|      0|                         PNG_CHUNK_WARNING);
  ------------------
  |  | 1901|      0|#define PNG_CHUNK_WARNING     0 /* never an error */
  ------------------
 2383|      0|                  }
 2384|       |
 2385|      1|                  return 1+png_sRGB_checks[i].is_broken;
 2386|      1|               }
 2387|     42|            }
 2388|       |
 2389|    891|# if PNG_sRGB_PROFILE_CHECKS > 0
 2390|       |         /* The signature matched, but the profile had been changed in some
 2391|       |          * way.  This probably indicates a data error or uninformed hacking.
 2392|       |          * Fall through to "no match".
 2393|       |          */
 2394|    891|         png_chunk_report(png_ptr,
 2395|    891|             "Not recognizing known sRGB profile that has been edited",
 2396|    891|             PNG_CHUNK_WARNING);
  ------------------
  |  | 1901|    891|#define PNG_CHUNK_WARNING     0 /* never an error */
  ------------------
 2397|    891|         break;
 2398|    892|# endif
 2399|    892|         }
 2400|  8.09k|      }
 2401|  32.3k|   }
 2402|       |
 2403|  4.66k|   return 0; /* no match */
 2404|  4.66k|}

png_error:
   41|  4.67k|{
   42|       |#ifdef PNG_ERROR_NUMBERS_SUPPORTED
   43|       |   char msg[16];
   44|       |   if (png_ptr != NULL)
   45|       |   {
   46|       |      if ((png_ptr->flags &
   47|       |         (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
   48|       |      {
   49|       |         if (*error_message == PNG_LITERAL_SHARP)
   50|       |         {
   51|       |            /* Strip "#nnnn " from beginning of error message. */
   52|       |            int offset;
   53|       |            for (offset = 1; offset<15; offset++)
   54|       |               if (error_message[offset] == ' ')
   55|       |                  break;
   56|       |
   57|       |            if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
   58|       |            {
   59|       |               int i;
   60|       |               for (i = 0; i < offset - 1; i++)
   61|       |                  msg[i] = error_message[i + 1];
   62|       |               msg[i - 1] = '\0';
   63|       |               error_message = msg;
   64|       |            }
   65|       |
   66|       |            else
   67|       |               error_message += offset;
   68|       |         }
   69|       |
   70|       |         else
   71|       |         {
   72|       |            if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
   73|       |            {
   74|       |               msg[0] = '0';
   75|       |               msg[1] = '\0';
   76|       |               error_message = msg;
   77|       |            }
   78|       |         }
   79|       |      }
   80|       |   }
   81|       |#endif
   82|  4.67k|   if (png_ptr != NULL && png_ptr->error_fn != NULL)
  ------------------
  |  Branch (82:8): [True: 4.67k, False: 0]
  |  Branch (82:27): [True: 4.67k, False: 0]
  ------------------
   83|  4.67k|      (*(png_ptr->error_fn))(png_constcast(png_structrp,png_ptr),
  ------------------
  |  |  545|  4.67k|#  define png_constcast(type, value) ((type)(void*)(const void*)(value))
  ------------------
   84|  4.67k|          error_message);
   85|       |
   86|       |   /* If the custom handler doesn't exist, or if it returns,
   87|       |      use the default handler, which will not return. */
   88|  4.67k|   png_default_error(png_ptr, error_message);
   89|  4.67k|}
png_safecat:
  114|   113k|{
  115|   113k|   if (buffer != NULL && pos < bufsize)
  ------------------
  |  Branch (115:8): [True: 113k, False: 0]
  |  Branch (115:26): [True: 113k, False: 0]
  ------------------
  116|   113k|   {
  117|   113k|      if (string != NULL)
  ------------------
  |  Branch (117:11): [True: 113k, False: 0]
  ------------------
  118|  1.17M|         while (*string != '\0' && pos < bufsize-1)
  ------------------
  |  Branch (118:17): [True: 1.06M, False: 113k]
  |  Branch (118:36): [True: 1.06M, False: 1]
  ------------------
  119|  1.06M|           buffer[pos++] = *string++;
  120|       |
  121|   113k|      buffer[pos] = '\0';
  122|   113k|   }
  123|       |
  124|   113k|   return pos;
  125|   113k|}
png_format_number:
  135|  17.3k|{
  136|  17.3k|   int count = 0;    /* number of digits output */
  137|  17.3k|   int mincount = 1; /* minimum number required */
  138|  17.3k|   int output = 0;   /* digit output (for the fixed point format) */
  139|       |
  140|  17.3k|   *--end = '\0';
  141|       |
  142|       |   /* This is written so that the loop always runs at least once, even with
  143|       |    * number zero.
  144|       |    */
  145|  95.0k|   while (end > start && (number != 0 || count < mincount))
  ------------------
  |  Branch (145:11): [True: 95.0k, False: 0]
  |  Branch (145:27): [True: 70.7k, False: 24.2k]
  |  Branch (145:42): [True: 6.89k, False: 17.3k]
  ------------------
  146|  77.6k|   {
  147|       |
  148|  77.6k|      static const char digits[] = "0123456789ABCDEF";
  149|       |
  150|  77.6k|      switch (format)
  151|  77.6k|      {
  152|      0|         case PNG_NUMBER_FORMAT_fixed:
  ------------------
  |  | 1822|      0|#define PNG_NUMBER_FORMAT_fixed 5 /* choose the signed API */
  ------------------
  |  Branch (152:10): [True: 0, False: 77.6k]
  ------------------
  153|       |            /* Needs five digits (the fraction) */
  154|      0|            mincount = 5;
  155|      0|            if (output != 0 || number % 10 != 0)
  ------------------
  |  Branch (155:17): [True: 0, False: 0]
  |  Branch (155:32): [True: 0, False: 0]
  ------------------
  156|      0|            {
  157|      0|               *--end = digits[number % 10];
  158|      0|               output = 1;
  159|      0|            }
  160|      0|            number /= 10;
  161|      0|            break;
  162|       |
  163|      0|         case PNG_NUMBER_FORMAT_02u:
  ------------------
  |  | 1817|      0|#define PNG_NUMBER_FORMAT_02u   2
  ------------------
  |  Branch (163:10): [True: 0, False: 77.6k]
  ------------------
  164|       |            /* Expects at least 2 digits. */
  165|      0|            mincount = 2;
  166|       |            /* FALLTHROUGH */
  167|       |
  168|      0|         case PNG_NUMBER_FORMAT_u:
  ------------------
  |  | 1816|      0|#define PNG_NUMBER_FORMAT_u     1 /* chose unsigned API! */
  ------------------
  |  Branch (168:10): [True: 0, False: 77.6k]
  ------------------
  169|      0|            *--end = digits[number % 10];
  170|      0|            number /= 10;
  171|      0|            break;
  172|       |
  173|      0|         case PNG_NUMBER_FORMAT_02x:
  ------------------
  |  | 1821|      0|#define PNG_NUMBER_FORMAT_02x   4
  ------------------
  |  Branch (173:10): [True: 0, False: 77.6k]
  ------------------
  174|       |            /* This format expects at least two digits */
  175|      0|            mincount = 2;
  176|       |            /* FALLTHROUGH */
  177|       |
  178|  77.6k|         case PNG_NUMBER_FORMAT_x:
  ------------------
  |  | 1820|  77.6k|#define PNG_NUMBER_FORMAT_x     3
  ------------------
  |  Branch (178:10): [True: 77.6k, False: 0]
  ------------------
  179|  77.6k|            *--end = digits[number & 0xf];
  180|  77.6k|            number >>= 4;
  181|  77.6k|            break;
  182|       |
  183|      0|         default: /* an error */
  ------------------
  |  Branch (183:10): [True: 0, False: 77.6k]
  ------------------
  184|      0|            number = 0;
  185|      0|            break;
  186|  77.6k|      }
  187|       |
  188|       |      /* Keep track of the number of digits added */
  189|  77.6k|      ++count;
  190|       |
  191|       |      /* Float a fixed number here: */
  192|  77.6k|      if ((format == PNG_NUMBER_FORMAT_fixed) && (count == 5) && (end > start))
  ------------------
  |  | 1822|  77.6k|#define PNG_NUMBER_FORMAT_fixed 5 /* choose the signed API */
  ------------------
  |  Branch (192:11): [True: 0, False: 77.6k]
  |  Branch (192:50): [True: 0, False: 0]
  |  Branch (192:66): [True: 0, False: 0]
  ------------------
  193|      0|      {
  194|       |         /* End of the fraction, but maybe nothing was output?  In that case
  195|       |          * drop the decimal point.  If the number is a true zero handle that
  196|       |          * here.
  197|       |          */
  198|      0|         if (output != 0)
  ------------------
  |  Branch (198:14): [True: 0, False: 0]
  ------------------
  199|      0|            *--end = '.';
  200|      0|         else if (number == 0) /* and !output */
  ------------------
  |  Branch (200:19): [True: 0, False: 0]
  ------------------
  201|      0|            *--end = '0';
  202|      0|      }
  203|  77.6k|   }
  204|       |
  205|  17.3k|   return end;
  206|  17.3k|}
png_warning:
  217|   107k|{
  218|   107k|   int offset = 0;
  219|   107k|   if (png_ptr != NULL)
  ------------------
  |  Branch (219:8): [True: 107k, False: 0]
  ------------------
  220|   107k|   {
  221|       |#ifdef PNG_ERROR_NUMBERS_SUPPORTED
  222|       |   if ((png_ptr->flags &
  223|       |       (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
  224|       |#endif
  225|   107k|      {
  226|   107k|         if (*warning_message == PNG_LITERAL_SHARP)
  ------------------
  |  |   39|   107k|#    define PNG_LITERAL_SHARP 0x23
  ------------------
  |  Branch (226:14): [True: 0, False: 107k]
  ------------------
  227|      0|         {
  228|      0|            for (offset = 1; offset < 15; offset++)
  ------------------
  |  Branch (228:30): [True: 0, False: 0]
  ------------------
  229|      0|               if (warning_message[offset] == ' ')
  ------------------
  |  Branch (229:20): [True: 0, False: 0]
  ------------------
  230|      0|                  break;
  231|      0|         }
  232|   107k|      }
  233|   107k|   }
  234|   107k|   if (png_ptr != NULL && png_ptr->warning_fn != NULL)
  ------------------
  |  Branch (234:8): [True: 107k, False: 0]
  |  Branch (234:27): [True: 107k, False: 0]
  ------------------
  235|   107k|      (*(png_ptr->warning_fn))(png_constcast(png_structrp,png_ptr),
  ------------------
  |  |  545|   107k|#  define png_constcast(type, value) ((type)(void*)(const void*)(value))
  ------------------
  236|   107k|          warning_message + offset);
  237|      0|   else
  238|      0|      png_default_warning(png_ptr, warning_message + offset);
  239|   107k|}
png_benign_error:
  363|  1.00k|{
  364|  1.00k|   if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
  ------------------
  |  |  724|  1.00k|#define PNG_FLAG_BENIGN_ERRORS_WARN     0x100000U /* Added to libpng-1.4.0 */
  ------------------
  |  Branch (364:8): [True: 1.00k, False: 0]
  ------------------
  365|  1.00k|   {
  366|  1.00k|#     ifdef PNG_READ_SUPPORTED
  367|  1.00k|         if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
  ------------------
  |  |  664|  1.00k|#define PNG_IS_READ_STRUCT        0x8000U /* Else is a write struct */
  ------------------
  |  Branch (367:14): [True: 1.00k, False: 0]
  ------------------
  368|  1.00k|            png_ptr->chunk_name != 0)
  ------------------
  |  Branch (368:13): [True: 1.00k, False: 0]
  ------------------
  369|  1.00k|            png_chunk_warning(png_ptr, error_message);
  370|      0|         else
  371|      0|#     endif
  372|      0|      png_warning(png_ptr, error_message);
  373|  1.00k|   }
  374|       |
  375|      0|   else
  376|      0|   {
  377|      0|#     ifdef PNG_READ_SUPPORTED
  378|      0|         if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
  ------------------
  |  |  664|      0|#define PNG_IS_READ_STRUCT        0x8000U /* Else is a write struct */
  ------------------
  |  Branch (378:14): [True: 0, False: 0]
  ------------------
  379|      0|            png_ptr->chunk_name != 0)
  ------------------
  |  Branch (379:13): [True: 0, False: 0]
  ------------------
  380|      0|            png_chunk_error(png_ptr, error_message);
  381|      0|         else
  382|      0|#     endif
  383|      0|      png_error(png_ptr, error_message);
  384|      0|   }
  385|       |
  386|       |#  ifndef PNG_ERROR_TEXT_SUPPORTED
  387|       |      PNG_UNUSED(error_message)
  388|       |#  endif
  389|  1.00k|}
png_chunk_error:
  482|    260|{
  483|    260|   char msg[18+PNG_MAX_ERROR_TEXT];
  484|    260|   if (png_ptr == NULL)
  ------------------
  |  Branch (484:8): [True: 0, False: 260]
  ------------------
  485|      0|      png_error(png_ptr, error_message);
  486|       |
  487|    260|   else
  488|    260|   {
  489|    260|      png_format_buffer(png_ptr, msg, error_message);
  490|    260|      png_error(png_ptr, msg);
  491|    260|   }
  492|    260|}
png_chunk_warning:
  498|   104k|{
  499|   104k|   char msg[18+PNG_MAX_ERROR_TEXT];
  500|   104k|   if (png_ptr == NULL)
  ------------------
  |  Branch (500:8): [True: 0, False: 104k]
  ------------------
  501|      0|      png_warning(png_ptr, warning_message);
  502|       |
  503|   104k|   else
  504|   104k|   {
  505|   104k|      png_format_buffer(png_ptr, msg, warning_message);
  506|   104k|      png_warning(png_ptr, msg);
  507|   104k|   }
  508|   104k|}
png_chunk_benign_error:
  516|  28.1k|{
  517|  28.1k|   if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
  ------------------
  |  |  724|  28.1k|#define PNG_FLAG_BENIGN_ERRORS_WARN     0x100000U /* Added to libpng-1.4.0 */
  ------------------
  |  Branch (517:8): [True: 28.1k, False: 0]
  ------------------
  518|  28.1k|      png_chunk_warning(png_ptr, error_message);
  519|       |
  520|      0|   else
  521|      0|      png_chunk_error(png_ptr, error_message);
  522|       |
  523|       |#  ifndef PNG_ERROR_TEXT_SUPPORTED
  524|       |      PNG_UNUSED(error_message)
  525|       |#  endif
  526|  28.1k|}
png_chunk_report:
  532|  22.7k|{
  533|       |#  ifndef PNG_WARNINGS_SUPPORTED
  534|       |      PNG_UNUSED(message)
  535|       |#  endif
  536|       |
  537|       |   /* This is always supported, but for just read or just write it
  538|       |    * unconditionally does the right thing.
  539|       |    */
  540|  22.7k|#  if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
  541|  22.7k|      if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
  ------------------
  |  |  664|  22.7k|#define PNG_IS_READ_STRUCT        0x8000U /* Else is a write struct */
  ------------------
  |  Branch (541:11): [True: 22.7k, False: 0]
  ------------------
  542|  22.7k|#  endif
  543|       |
  544|  22.7k|#  ifdef PNG_READ_SUPPORTED
  545|  22.7k|      {
  546|  22.7k|         if (error < PNG_CHUNK_ERROR)
  ------------------
  |  | 1903|  22.7k|#define PNG_CHUNK_ERROR       2 /* always an error */
  ------------------
  |  Branch (546:14): [True: 21.2k, False: 1.43k]
  ------------------
  547|  21.2k|            png_chunk_warning(png_ptr, message);
  548|       |
  549|  1.43k|         else
  550|  1.43k|            png_chunk_benign_error(png_ptr, message);
  551|  22.7k|      }
  552|      0|#  endif
  553|       |
  554|      0|#  if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
  555|      0|      else if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
  ------------------
  |  |  664|      0|#define PNG_IS_READ_STRUCT        0x8000U /* Else is a write struct */
  ------------------
  |  Branch (555:16): [True: 0, False: 0]
  ------------------
  556|      0|#  endif
  557|       |
  558|      0|#  ifdef PNG_WRITE_SUPPORTED
  559|      0|      {
  560|      0|         if (error < PNG_CHUNK_WRITE_ERROR)
  ------------------
  |  | 1902|      0|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
  |  Branch (560:14): [True: 0, False: 0]
  ------------------
  561|      0|            png_app_warning(png_ptr, message);
  562|       |
  563|      0|         else
  564|      0|            png_app_error(png_ptr, message);
  565|      0|      }
  566|  22.7k|#  endif
  567|  22.7k|}
png_set_longjmp_fn:
  599|  9.42k|{
  600|       |   /* From libpng 1.6.0 the app gets one chance to set a 'jmpbuf_size' value
  601|       |    * and it must not change after that.  Libpng doesn't care how big the
  602|       |    * buffer is, just that it doesn't change.
  603|       |    *
  604|       |    * If the buffer size is no *larger* than the size of jmp_buf when libpng is
  605|       |    * compiled a built in jmp_buf is returned; this preserves the pre-1.6.0
  606|       |    * semantics that this call will not fail.  If the size is larger, however,
  607|       |    * the buffer is allocated and this may fail, causing the function to return
  608|       |    * NULL.
  609|       |    */
  610|  9.42k|   if (png_ptr == NULL)
  ------------------
  |  Branch (610:8): [True: 0, False: 9.42k]
  ------------------
  611|      0|      return NULL;
  612|       |
  613|  9.42k|   if (png_ptr->jmp_buf_ptr == NULL)
  ------------------
  |  Branch (613:8): [True: 4.74k, False: 4.67k]
  ------------------
  614|  4.74k|   {
  615|  4.74k|      png_ptr->jmp_buf_size = 0; /* not allocated */
  616|       |
  617|  4.74k|      if (jmp_buf_size <= (sizeof png_ptr->jmp_buf_local))
  ------------------
  |  Branch (617:11): [True: 4.74k, False: 0]
  ------------------
  618|  4.74k|         png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local;
  619|       |
  620|      0|      else
  621|      0|      {
  622|      0|         png_ptr->jmp_buf_ptr = png_voidcast(jmp_buf *,
  ------------------
  |  |  544|      0|#  define png_voidcast(type, value) (value)
  ------------------
  623|      0|             png_malloc_warn(png_ptr, jmp_buf_size));
  624|       |
  625|      0|         if (png_ptr->jmp_buf_ptr == NULL)
  ------------------
  |  Branch (625:14): [True: 0, False: 0]
  ------------------
  626|      0|            return NULL; /* new NULL return on OOM */
  627|       |
  628|      0|         png_ptr->jmp_buf_size = jmp_buf_size;
  629|      0|      }
  630|  4.74k|   }
  631|       |
  632|  4.67k|   else /* Already allocated: check the size */
  633|  4.67k|   {
  634|  4.67k|      size_t size = png_ptr->jmp_buf_size;
  635|       |
  636|  4.67k|      if (size == 0)
  ------------------
  |  Branch (636:11): [True: 4.67k, False: 0]
  ------------------
  637|  4.67k|      {
  638|  4.67k|         size = (sizeof png_ptr->jmp_buf_local);
  639|  4.67k|         if (png_ptr->jmp_buf_ptr != &png_ptr->jmp_buf_local)
  ------------------
  |  Branch (639:14): [True: 0, False: 4.67k]
  ------------------
  640|      0|         {
  641|       |            /* This is an internal error in libpng: somehow we have been left
  642|       |             * with a stack allocated jmp_buf when the application regained
  643|       |             * control.  It's always possible to fix this up, but for the moment
  644|       |             * this is a png_error because that makes it easy to detect.
  645|       |             */
  646|      0|            png_error(png_ptr, "Libpng jmp_buf still allocated");
  647|       |            /* png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local; */
  648|      0|         }
  649|  4.67k|      }
  650|       |
  651|  4.67k|      if (size != jmp_buf_size)
  ------------------
  |  Branch (651:11): [True: 0, False: 4.67k]
  ------------------
  652|      0|      {
  653|      0|         png_warning(png_ptr, "Application jmp_buf size changed");
  654|      0|         return NULL; /* caller will probably crash: no choice here */
  655|      0|      }
  656|  4.67k|   }
  657|       |
  658|       |   /* Finally fill in the function, now we have a satisfactory buffer. It is
  659|       |    * valid to change the function on every call.
  660|       |    */
  661|  9.42k|   png_ptr->longjmp_fn = longjmp_fn;
  662|  9.42k|   return png_ptr->jmp_buf_ptr;
  663|  9.42k|}
png_free_jmpbuf:
  667|  4.74k|{
  668|  4.74k|   if (png_ptr != NULL)
  ------------------
  |  Branch (668:8): [True: 4.74k, False: 0]
  ------------------
  669|  4.74k|   {
  670|  4.74k|      jmp_buf *jb = png_ptr->jmp_buf_ptr;
  671|       |
  672|       |      /* A size of 0 is used to indicate a local, stack, allocation of the
  673|       |       * pointer; used here and in png.c
  674|       |       */
  675|  4.74k|      if (jb != NULL && png_ptr->jmp_buf_size > 0)
  ------------------
  |  Branch (675:11): [True: 4.74k, False: 0]
  |  Branch (675:25): [True: 0, False: 4.74k]
  ------------------
  676|      0|      {
  677|       |
  678|       |         /* This stuff is so that a failure to free the error control structure
  679|       |          * does not leave libpng in a state with no valid error handling: the
  680|       |          * free always succeeds, if there is an error it gets ignored.
  681|       |          */
  682|      0|         if (jb != &png_ptr->jmp_buf_local)
  ------------------
  |  Branch (682:14): [True: 0, False: 0]
  ------------------
  683|      0|         {
  684|       |            /* Make an internal, libpng, jmp_buf to return here */
  685|      0|            jmp_buf free_jmp_buf;
  686|       |
  687|      0|            if (!setjmp(free_jmp_buf))
  ------------------
  |  Branch (687:17): [True: 0, False: 0]
  ------------------
  688|      0|            {
  689|      0|               png_ptr->jmp_buf_ptr = &free_jmp_buf; /* come back here */
  690|      0|               png_ptr->jmp_buf_size = 0; /* stack allocation */
  691|      0|               png_ptr->longjmp_fn = longjmp;
  692|      0|               png_free(png_ptr, jb); /* Return to setjmp on error */
  693|      0|            }
  694|      0|         }
  695|      0|      }
  696|       |
  697|       |      /* *Always* cancel everything out: */
  698|  4.74k|      png_ptr->jmp_buf_size = 0;
  699|  4.74k|      png_ptr->jmp_buf_ptr = NULL;
  700|  4.74k|      png_ptr->longjmp_fn = 0;
  701|  4.74k|   }
  702|  4.74k|}
png_set_error_fn:
  837|  4.74k|{
  838|  4.74k|   if (png_ptr == NULL)
  ------------------
  |  Branch (838:8): [True: 0, False: 4.74k]
  ------------------
  839|      0|      return;
  840|       |
  841|  4.74k|   png_ptr->error_ptr = error_ptr;
  842|  4.74k|   png_ptr->error_fn = error_fn;
  843|  4.74k|#ifdef PNG_WARNINGS_SUPPORTED
  844|  4.74k|   png_ptr->warning_fn = warning_fn;
  845|       |#else
  846|       |   PNG_UNUSED(warning_fn)
  847|       |#endif
  848|  4.74k|}
png_get_error_ptr:
  857|  9.04k|{
  858|  9.04k|   if (png_ptr == NULL)
  ------------------
  |  Branch (858:8): [True: 0, False: 9.04k]
  ------------------
  859|      0|      return NULL;
  860|       |
  861|  9.04k|   return (png_voidp)png_ptr->error_ptr;
  862|  9.04k|}
pngerror.c:png_format_buffer:
  436|   104k|{
  437|   104k|   png_uint_32 chunk_name = png_ptr->chunk_name;
  438|   104k|   int iout = 0, ishift = 24;
  439|       |
  440|   521k|   while (ishift >= 0)
  ------------------
  |  Branch (440:11): [True: 417k, False: 104k]
  ------------------
  441|   417k|   {
  442|   417k|      int c = (int)(chunk_name >> ishift) & 0xff;
  443|       |
  444|   417k|      ishift -= 8;
  445|   417k|      if (isnonalpha(c) != 0)
  ------------------
  |  |  427|   417k|#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
  |  |  ------------------
  |  |  |  Branch (427:24): [True: 284, False: 417k]
  |  |  |  Branch (427:36): [True: 177, False: 416k]
  |  |  |  Branch (427:50): [True: 144k, False: 272k]
  |  |  |  Branch (427:62): [True: 15, False: 144k]
  |  |  ------------------
  ------------------
  |  Branch (445:11): [True: 476, False: 416k]
  ------------------
  446|    476|      {
  447|    476|         buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
  ------------------
  |  |   42|    476|#    define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
  ------------------
  448|    476|         buffer[iout++] = png_digit[(c & 0xf0) >> 4];
  449|    476|         buffer[iout++] = png_digit[c & 0x0f];
  450|    476|         buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
  ------------------
  |  |   45|    476|#    define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
  ------------------
  451|    476|      }
  452|       |
  453|   416k|      else
  454|   416k|      {
  455|   416k|         buffer[iout++] = (char)c;
  456|   416k|      }
  457|   417k|   }
  458|       |
  459|   104k|   if (error_message == NULL)
  ------------------
  |  Branch (459:8): [True: 0, False: 104k]
  ------------------
  460|      0|      buffer[iout] = '\0';
  461|       |
  462|   104k|   else
  463|   104k|   {
  464|   104k|      int iin = 0;
  465|       |
  466|   104k|      buffer[iout++] = ':';
  467|   104k|      buffer[iout++] = ' ';
  468|       |
  469|  2.19M|      while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
  ------------------
  |  |  418|  2.19M|#define PNG_MAX_ERROR_TEXT 196 /* Currently limited by profile_error in png.c */
  ------------------
  |  Branch (469:14): [True: 2.19M, False: 0]
  |  Branch (469:44): [True: 2.09M, False: 104k]
  ------------------
  470|  2.09M|         buffer[iout++] = error_message[iin++];
  471|       |
  472|       |      /* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */
  473|   104k|      buffer[iout] = '\0';
  474|   104k|   }
  475|   104k|}

png_get_valid:
   22|  1.01k|{
   23|  1.01k|   if (png_ptr != NULL && info_ptr != NULL)
  ------------------
  |  Branch (23:8): [True: 1.01k, False: 0]
  |  Branch (23:27): [True: 1.01k, False: 0]
  ------------------
   24|  1.01k|   {
   25|  1.01k|#ifdef PNG_READ_tRNS_SUPPORTED
   26|       |      /* png_handle_PLTE() may have canceled a valid tRNS chunk but left the
   27|       |       * 'valid' flag for the detection of duplicate chunks. Do not report a
   28|       |       * valid tRNS chunk in this case.
   29|       |       */
   30|  1.01k|      if (flag == PNG_INFO_tRNS && png_ptr->num_trans == 0)
  ------------------
  |  |  735|  2.02k|#define PNG_INFO_tRNS 0x0010U
  ------------------
  |  Branch (30:11): [True: 1.01k, False: 0]
  |  Branch (30:36): [True: 795, False: 216]
  ------------------
   31|    795|         return 0;
   32|    216|#endif
   33|       |
   34|    216|      return info_ptr->valid & flag;
   35|  1.01k|   }
   36|       |
   37|      0|   return 0;
   38|  1.01k|}
png_get_IHDR:
  840|  2.02k|{
  841|  2.02k|   png_debug1(1, "in %s retrieval function", "IHDR");
  ------------------
  |  |  148|  2.02k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  842|       |
  843|  2.02k|   if (png_ptr == NULL || info_ptr == NULL)
  ------------------
  |  Branch (843:8): [True: 0, False: 2.02k]
  |  Branch (843:27): [True: 0, False: 2.02k]
  ------------------
  844|      0|      return 0;
  845|       |
  846|  2.02k|   if (width != NULL)
  ------------------
  |  Branch (846:8): [True: 2.02k, False: 0]
  ------------------
  847|  2.02k|       *width = info_ptr->width;
  848|       |
  849|  2.02k|   if (height != NULL)
  ------------------
  |  Branch (849:8): [True: 2.02k, False: 0]
  ------------------
  850|  2.02k|       *height = info_ptr->height;
  851|       |
  852|  2.02k|   if (bit_depth != NULL)
  ------------------
  |  Branch (852:8): [True: 2.02k, False: 0]
  ------------------
  853|  2.02k|       *bit_depth = info_ptr->bit_depth;
  854|       |
  855|  2.02k|   if (color_type != NULL)
  ------------------
  |  Branch (855:8): [True: 2.02k, False: 0]
  ------------------
  856|  2.02k|       *color_type = info_ptr->color_type;
  857|       |
  858|  2.02k|   if (compression_type != NULL)
  ------------------
  |  Branch (858:8): [True: 0, False: 2.02k]
  ------------------
  859|      0|      *compression_type = info_ptr->compression_type;
  860|       |
  861|  2.02k|   if (filter_type != NULL)
  ------------------
  |  Branch (861:8): [True: 0, False: 2.02k]
  ------------------
  862|      0|      *filter_type = info_ptr->filter_type;
  863|       |
  864|  2.02k|   if (interlace_type != NULL)
  ------------------
  |  Branch (864:8): [True: 2.02k, False: 0]
  ------------------
  865|  2.02k|      *interlace_type = info_ptr->interlace_type;
  866|       |
  867|       |   /* This is redundant if we can be sure that the info_ptr values were all
  868|       |    * assigned in png_set_IHDR().  We do the check anyhow in case an
  869|       |    * application has ignored our advice not to mess with the members
  870|       |    * of info_ptr directly.
  871|       |    */
  872|  2.02k|   png_check_IHDR(png_ptr, info_ptr->width, info_ptr->height,
  873|  2.02k|       info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
  874|  2.02k|       info_ptr->compression_type, info_ptr->filter_type);
  875|       |
  876|  2.02k|   return 1;
  877|  2.02k|}

png_destroy_png_struct:
   26|  4.74k|{
   27|  4.74k|   if (png_ptr != NULL)
  ------------------
  |  Branch (27:8): [True: 4.74k, False: 0]
  ------------------
   28|  4.74k|   {
   29|       |      /* png_free might call png_error and may certainly call
   30|       |       * png_get_mem_ptr, so fake a temporary png_struct to support this.
   31|       |       */
   32|  4.74k|      png_struct dummy_struct = *png_ptr;
   33|  4.74k|      memset(png_ptr, 0, (sizeof *png_ptr));
   34|  4.74k|      png_free(&dummy_struct, png_ptr);
   35|       |
   36|  4.74k|#     ifdef PNG_SETJMP_SUPPORTED
   37|       |         /* We may have a jmp_buf left to deallocate. */
   38|  4.74k|         png_free_jmpbuf(&dummy_struct);
   39|  4.74k|#     endif
   40|  4.74k|   }
   41|  4.74k|}
png_calloc:
   51|    944|{
   52|    944|   png_voidp ret;
   53|       |
   54|    944|   ret = png_malloc(png_ptr, size);
   55|       |
   56|    944|   if (ret != NULL)
  ------------------
  |  Branch (56:8): [True: 944, False: 0]
  ------------------
   57|    944|      memset(ret, 0, size);
   58|       |
   59|    944|   return ret;
   60|    944|}
png_malloc_base:
   70|  67.5k|{
   71|       |   /* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS
   72|       |    * allocators have also been removed in 1.6.0, so any 16-bit system now has
   73|       |    * to implement a user memory handler.  This checks to be sure it isn't
   74|       |    * called with big numbers.
   75|       |    */
   76|       |#ifndef PNG_USER_MEM_SUPPORTED
   77|       |   PNG_UNUSED(png_ptr)
   78|       |#endif
   79|       |
   80|       |   /* Some compilers complain that this is always true.  However, it
   81|       |    * can be false when integer overflow happens.
   82|       |    */
   83|  67.5k|   if (size > 0 && size <= PNG_SIZE_MAX
  ------------------
  |  |  650|  66.1k|#define PNG_SIZE_MAX ((size_t)(-1))
  ------------------
  |  Branch (83:8): [True: 66.1k, False: 1.39k]
  |  Branch (83:20): [True: 66.1k, False: 0]
  ------------------
   84|       |#     ifdef PNG_MAX_MALLOC_64K
   85|       |         && size <= 65536U
   86|       |#     endif
   87|  67.5k|      )
   88|  66.1k|   {
   89|  66.1k|#ifdef PNG_USER_MEM_SUPPORTED
   90|  66.1k|      if (png_ptr != NULL && png_ptr->malloc_fn != NULL)
  ------------------
  |  Branch (90:11): [True: 66.1k, False: 0]
  |  Branch (90:30): [True: 0, False: 66.1k]
  ------------------
   91|      0|         return png_ptr->malloc_fn(png_constcast(png_structrp,png_ptr), size);
  ------------------
  |  |  545|      0|#  define png_constcast(type, value) ((type)(void*)(const void*)(value))
  ------------------
   92|       |
   93|  66.1k|      else
   94|  66.1k|#endif
   95|  66.1k|         return malloc((size_t)size); /* checked for truncation above */
   96|  66.1k|   }
   97|       |
   98|  1.39k|   else
   99|  1.39k|      return NULL;
  100|  67.5k|}
png_malloc_array:
  124|  1.53k|{
  125|  1.53k|   if (nelements <= 0 || element_size == 0)
  ------------------
  |  Branch (125:8): [True: 0, False: 1.53k]
  |  Branch (125:26): [True: 0, False: 1.53k]
  ------------------
  126|      0|      png_error(png_ptr, "internal error: array alloc");
  127|       |
  128|  1.53k|   return png_malloc_array_checked(png_ptr, nelements, element_size);
  129|  1.53k|}
png_realloc_array:
  134|  3.50k|{
  135|       |   /* These are internal errors: */
  136|  3.50k|   if (add_elements <= 0 || element_size == 0 || old_elements < 0 ||
  ------------------
  |  Branch (136:8): [True: 0, False: 3.50k]
  |  Branch (136:29): [True: 0, False: 3.50k]
  |  Branch (136:50): [True: 0, False: 3.50k]
  ------------------
  137|  3.50k|      (old_array == NULL && old_elements > 0))
  ------------------
  |  Branch (137:8): [True: 295, False: 3.20k]
  |  Branch (137:29): [True: 0, False: 295]
  ------------------
  138|      0|      png_error(png_ptr, "internal error: array realloc");
  139|       |
  140|       |   /* Check for overflow on the elements count (so the caller does not have to
  141|       |    * check.)
  142|       |    */
  143|  3.50k|   if (add_elements <= INT_MAX - old_elements)
  ------------------
  |  Branch (143:8): [True: 3.50k, False: 0]
  ------------------
  144|  3.50k|   {
  145|  3.50k|      png_voidp new_array = png_malloc_array_checked(png_ptr,
  146|  3.50k|          old_elements+add_elements, element_size);
  147|       |
  148|  3.50k|      if (new_array != NULL)
  ------------------
  |  Branch (148:11): [True: 3.50k, False: 0]
  ------------------
  149|  3.50k|      {
  150|       |         /* Because png_malloc_array worked the size calculations below cannot
  151|       |          * overflow.
  152|       |          */
  153|  3.50k|         if (old_elements > 0)
  ------------------
  |  Branch (153:14): [True: 3.20k, False: 295]
  ------------------
  154|  3.20k|            memcpy(new_array, old_array, element_size*(unsigned)old_elements);
  155|       |
  156|  3.50k|         memset((char*)new_array + element_size*(unsigned)old_elements, 0,
  157|  3.50k|             element_size*(unsigned)add_elements);
  158|       |
  159|  3.50k|         return new_array;
  160|  3.50k|      }
  161|  3.50k|   }
  162|       |
  163|      0|   return NULL; /* error */
  164|  3.50k|}
png_malloc:
  173|  2.49k|{
  174|  2.49k|   png_voidp ret;
  175|       |
  176|  2.49k|   if (png_ptr == NULL)
  ------------------
  |  Branch (176:8): [True: 0, False: 2.49k]
  ------------------
  177|      0|      return NULL;
  178|       |
  179|  2.49k|   ret = png_malloc_base(png_ptr, size);
  180|       |
  181|  2.49k|   if (ret == NULL)
  ------------------
  |  Branch (181:8): [True: 0, False: 2.49k]
  ------------------
  182|      0|       png_error(png_ptr, "Out of memory"); /* 'm' means png_malloc */
  183|       |
  184|  2.49k|   return ret;
  185|  2.49k|}
png_malloc_warn:
  214|  18.4k|{
  215|  18.4k|   if (png_ptr != NULL)
  ------------------
  |  Branch (215:8): [True: 18.4k, False: 0]
  ------------------
  216|  18.4k|   {
  217|  18.4k|      png_voidp ret = png_malloc_base(png_ptr, size);
  218|       |
  219|  18.4k|      if (ret != NULL)
  ------------------
  |  Branch (219:11): [True: 18.2k, False: 194]
  ------------------
  220|  18.2k|         return ret;
  221|       |
  222|    194|      png_warning(png_ptr, "Out of memory");
  223|    194|   }
  224|       |
  225|    194|   return NULL;
  226|  18.4k|}
png_free:
  233|   120k|{
  234|   120k|   if (png_ptr == NULL || ptr == NULL)
  ------------------
  |  Branch (234:8): [True: 0, False: 120k]
  |  Branch (234:27): [True: 54.8k, False: 66.1k]
  ------------------
  235|  54.8k|      return;
  236|       |
  237|  66.1k|#ifdef PNG_USER_MEM_SUPPORTED
  238|  66.1k|   if (png_ptr->free_fn != NULL)
  ------------------
  |  Branch (238:8): [True: 0, False: 66.1k]
  ------------------
  239|      0|      png_ptr->free_fn(png_constcast(png_structrp,png_ptr), ptr);
  ------------------
  |  |  545|      0|#  define png_constcast(type, value) ((type)(void*)(const void*)(value))
  ------------------
  240|       |
  241|  66.1k|   else
  242|  66.1k|      png_free_default(png_ptr, ptr);
  243|  66.1k|}
png_free_default:
  247|  66.1k|{
  248|  66.1k|   if (png_ptr == NULL || ptr == NULL)
  ------------------
  |  Branch (248:8): [True: 0, False: 66.1k]
  |  Branch (248:27): [True: 0, False: 66.1k]
  ------------------
  249|      0|      return;
  250|  66.1k|#endif /* USER_MEM */
  251|       |
  252|  66.1k|   free(ptr);
  253|  66.1k|}
png_set_mem_fn:
  262|  4.74k|{
  263|  4.74k|   if (png_ptr != NULL)
  ------------------
  |  Branch (263:8): [True: 4.74k, False: 0]
  ------------------
  264|  4.74k|   {
  265|  4.74k|      png_ptr->mem_ptr = mem_ptr;
  266|  4.74k|      png_ptr->malloc_fn = malloc_fn;
  267|  4.74k|      png_ptr->free_fn = free_fn;
  268|  4.74k|   }
  269|  4.74k|}
pngmem.c:png_malloc_array_checked:
  111|  5.04k|{
  112|  5.04k|   png_alloc_size_t req = (png_alloc_size_t)nelements; /* known to be > 0 */
  113|       |
  114|  5.04k|   if (req <= PNG_SIZE_MAX/element_size)
  ------------------
  |  |  650|  5.04k|#define PNG_SIZE_MAX ((size_t)(-1))
  ------------------
  |  Branch (114:8): [True: 5.04k, False: 0]
  ------------------
  115|  5.04k|      return png_malloc_base(png_ptr, req * element_size);
  116|       |
  117|       |   /* The failure case when the request is too large */
  118|      0|   return NULL;
  119|  5.04k|}

png_create_read_struct:
   28|  4.74k|{
   29|       |#ifndef PNG_USER_MEM_SUPPORTED
   30|       |   png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
   31|       |        error_fn, warn_fn, NULL, NULL, NULL);
   32|       |#else
   33|  4.74k|   return png_create_read_struct_2(user_png_ver, error_ptr, error_fn,
   34|  4.74k|        warn_fn, NULL, NULL, NULL);
   35|  4.74k|}
png_create_read_struct_2:
   44|  4.74k|{
   45|  4.74k|   png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
   46|  4.74k|       error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
   47|  4.74k|#endif /* USER_MEM */
   48|       |
   49|  4.74k|   if (png_ptr != NULL)
  ------------------
  |  Branch (49:8): [True: 4.74k, False: 0]
  ------------------
   50|  4.74k|   {
   51|  4.74k|      png_ptr->mode = PNG_IS_READ_STRUCT;
  ------------------
  |  |  664|  4.74k|#define PNG_IS_READ_STRUCT        0x8000U /* Else is a write struct */
  ------------------
   52|       |
   53|       |      /* Added in libpng-1.6.0; this can be used to detect a read structure if
   54|       |       * required (it will be zero in a write structure.)
   55|       |       */
   56|  4.74k|#     ifdef PNG_SEQUENTIAL_READ_SUPPORTED
   57|  4.74k|         png_ptr->IDAT_read_size = PNG_IDAT_READ_SIZE;
  ------------------
  |  |  200|  4.74k|#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
  |  |  ------------------
  |  |  |  |  216|  4.74k|#define PNG_ZBUF_SIZE 8192
  |  |  ------------------
  ------------------
   58|  4.74k|#     endif
   59|       |
   60|  4.74k|#     ifdef PNG_BENIGN_READ_ERRORS_SUPPORTED
   61|  4.74k|         png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
  ------------------
  |  |  724|  4.74k|#define PNG_FLAG_BENIGN_ERRORS_WARN     0x100000U /* Added to libpng-1.4.0 */
  ------------------
   62|       |
   63|       |         /* In stable builds only warn if an application error can be completely
   64|       |          * handled.
   65|       |          */
   66|  4.74k|#        if PNG_RELEASE_BUILD
   67|  4.74k|            png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
  ------------------
  |  |  725|  4.74k|#define PNG_FLAG_APP_WARNINGS_WARN      0x200000U /* Added to libpng-1.6.0 */
  ------------------
   68|  4.74k|#        endif
   69|  4.74k|#     endif
   70|       |
   71|       |      /* TODO: delay this, it can be done in png_init_io (if the app doesn't
   72|       |       * do it itself) avoiding setting the default function if it is not
   73|       |       * required.
   74|       |       */
   75|  4.74k|      png_set_read_fn(png_ptr, NULL, NULL);
   76|  4.74k|   }
   77|       |
   78|  4.74k|   return png_ptr;
   79|  4.74k|}
png_read_info:
   93|  4.74k|{
   94|  4.74k|#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
   95|  4.74k|   int keep;
   96|  4.74k|#endif
   97|       |
   98|  4.74k|   png_debug(1, "in png_read_info");
  ------------------
  |  |  145|  4.74k|#  define png_debug(l, m) ((void)0)
  ------------------
   99|       |
  100|  4.74k|   if (png_ptr == NULL || info_ptr == NULL)
  ------------------
  |  Branch (100:8): [True: 0, False: 4.74k]
  |  Branch (100:27): [True: 0, False: 4.74k]
  ------------------
  101|      0|      return;
  102|       |
  103|       |   /* Read and check the PNG file signature. */
  104|  4.74k|   png_read_sig(png_ptr, info_ptr);
  105|       |
  106|  4.74k|   for (;;)
  107|  97.2k|   {
  108|  97.2k|      png_uint_32 length = png_read_chunk_header(png_ptr);
  109|  97.2k|      png_uint_32 chunk_name = png_ptr->chunk_name;
  110|       |
  111|       |      /* IDAT logic needs to happen here to simplify getting the two flags
  112|       |       * right.
  113|       |       */
  114|  97.2k|      if (chunk_name == png_IDAT)
  ------------------
  |  |  873|  97.2k|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|  97.2k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  97.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  97.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  97.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  97.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (114:11): [True: 1.01k, False: 96.2k]
  ------------------
  115|  1.01k|      {
  116|  1.01k|         if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  1.01k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (116:14): [True: 0, False: 1.01k]
  ------------------
  117|      0|            png_chunk_error(png_ptr, "Missing IHDR before IDAT");
  118|       |
  119|  1.01k|         else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
  ------------------
  |  |  668|  2.02k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  1.01k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  1.01k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (119:19): [True: 84, False: 927]
  ------------------
  120|  1.01k|             (png_ptr->mode & PNG_HAVE_PLTE) == 0)
  ------------------
  |  |  644|     84|#define PNG_HAVE_PLTE  0x02
  ------------------
  |  Branch (120:14): [True: 0, False: 84]
  ------------------
  121|      0|            png_chunk_error(png_ptr, "Missing PLTE before IDAT");
  122|       |
  123|  1.01k|         else if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
  ------------------
  |  |  645|  1.01k|#define PNG_AFTER_IDAT 0x08
  ------------------
  |  Branch (123:19): [True: 0, False: 1.01k]
  ------------------
  124|      0|            png_chunk_benign_error(png_ptr, "Too many IDATs found");
  125|       |
  126|  1.01k|         png_ptr->mode |= PNG_HAVE_IDAT;
  ------------------
  |  |  651|  1.01k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  127|  1.01k|      }
  128|       |
  129|  96.2k|      else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|  96.2k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (129:16): [True: 0, False: 96.2k]
  ------------------
  130|      0|      {
  131|      0|         png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
  ------------------
  |  |  662|      0|#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
  ------------------
  132|      0|         png_ptr->mode |= PNG_AFTER_IDAT;
  ------------------
  |  |  645|      0|#define PNG_AFTER_IDAT 0x08
  ------------------
  133|      0|      }
  134|       |
  135|       |      /* This should be a binary subdivision search or a hash for
  136|       |       * matching the chunk name rather than a linear search.
  137|       |       */
  138|  97.2k|      if (chunk_name == png_IHDR)
  ------------------
  |  |  875|  97.2k|#define png_IHDR PNG_U32( 73,  72,  68,  82)
  |  |  ------------------
  |  |  |  |  848|  97.2k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  97.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  97.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  97.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  97.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (138:11): [True: 4.71k, False: 92.5k]
  ------------------
  139|  4.71k|         png_handle_IHDR(png_ptr, info_ptr, length);
  140|       |
  141|  92.5k|      else if (chunk_name == png_IEND)
  ------------------
  |  |  874|  92.5k|#define png_IEND PNG_U32( 73,  69,  78,  68)
  |  |  ------------------
  |  |  |  |  848|  92.5k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (141:16): [True: 12, False: 92.5k]
  ------------------
  142|     12|         png_handle_IEND(png_ptr, info_ptr, length);
  143|       |
  144|  92.5k|#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  145|  92.5k|      else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
  ------------------
  |  Branch (145:16): [True: 0, False: 92.5k]
  ------------------
  146|      0|      {
  147|      0|         png_handle_unknown(png_ptr, info_ptr, length, keep);
  148|       |
  149|      0|         if (chunk_name == png_PLTE)
  ------------------
  |  |  876|      0|#define png_PLTE PNG_U32( 80,  76,  84,  69)
  |  |  ------------------
  |  |  |  |  848|      0|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (149:14): [True: 0, False: 0]
  ------------------
  150|      0|            png_ptr->mode |= PNG_HAVE_PLTE;
  ------------------
  |  |  644|      0|#define PNG_HAVE_PLTE  0x02
  ------------------
  151|       |
  152|      0|         else if (chunk_name == png_IDAT)
  ------------------
  |  |  873|      0|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|      0|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (152:19): [True: 0, False: 0]
  ------------------
  153|      0|         {
  154|      0|            png_ptr->idat_size = 0; /* It has been consumed */
  155|      0|            break;
  156|      0|         }
  157|      0|      }
  158|  92.5k|#endif
  159|  92.5k|      else if (chunk_name == png_PLTE)
  ------------------
  |  |  876|  92.5k|#define png_PLTE PNG_U32( 80,  76,  84,  69)
  |  |  ------------------
  |  |  |  |  848|  92.5k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (159:16): [True: 289, False: 92.2k]
  ------------------
  160|    289|         png_handle_PLTE(png_ptr, info_ptr, length);
  161|       |
  162|  92.2k|      else if (chunk_name == png_IDAT)
  ------------------
  |  |  873|  92.2k|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|  92.2k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  92.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (162:16): [True: 1.01k, False: 91.2k]
  ------------------
  163|  1.01k|      {
  164|  1.01k|         png_ptr->idat_size = length;
  165|  1.01k|         break;
  166|  1.01k|      }
  167|       |
  168|  91.2k|#ifdef PNG_READ_bKGD_SUPPORTED
  169|  91.2k|      else if (chunk_name == png_bKGD)
  ------------------
  |  |  877|  91.2k|#define png_bKGD PNG_U32( 98,  75,  71,  68)
  |  |  ------------------
  |  |  |  |  848|  91.2k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  91.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  91.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  91.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  91.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (169:16): [True: 2.13k, False: 89.0k]
  ------------------
  170|  2.13k|         png_handle_bKGD(png_ptr, info_ptr, length);
  171|  89.0k|#endif
  172|       |
  173|  89.0k|#ifdef PNG_READ_cHRM_SUPPORTED
  174|  89.0k|      else if (chunk_name == png_cHRM)
  ------------------
  |  |  878|  89.0k|#define png_cHRM PNG_U32( 99,  72,  82,  77)
  |  |  ------------------
  |  |  |  |  848|  89.0k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  89.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  89.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  89.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  89.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (174:16): [True: 2.88k, False: 86.2k]
  ------------------
  175|  2.88k|         png_handle_cHRM(png_ptr, info_ptr, length);
  176|  86.2k|#endif
  177|       |
  178|  86.2k|#ifdef PNG_READ_eXIf_SUPPORTED
  179|  86.2k|      else if (chunk_name == png_eXIf)
  ------------------
  |  |  879|  86.2k|#define png_eXIf PNG_U32(101,  88,  73, 102) /* registered July 2017 */
  |  |  ------------------
  |  |  |  |  848|  86.2k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  86.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  86.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  86.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  86.2k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (179:16): [True: 1.47k, False: 84.7k]
  ------------------
  180|  1.47k|         png_handle_eXIf(png_ptr, info_ptr, length);
  181|  84.7k|#endif
  182|       |
  183|  84.7k|#ifdef PNG_READ_gAMA_SUPPORTED
  184|  84.7k|      else if (chunk_name == png_gAMA)
  ------------------
  |  |  881|  84.7k|#define png_gAMA PNG_U32(103,  65,  77,  65)
  |  |  ------------------
  |  |  |  |  848|  84.7k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  84.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  84.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  84.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  84.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (184:16): [True: 1.87k, False: 82.8k]
  ------------------
  185|  1.87k|         png_handle_gAMA(png_ptr, info_ptr, length);
  186|  82.8k|#endif
  187|       |
  188|  82.8k|#ifdef PNG_READ_hIST_SUPPORTED
  189|  82.8k|      else if (chunk_name == png_hIST)
  ------------------
  |  |  885|  82.8k|#define png_hIST PNG_U32(104,  73,  83,  84)
  |  |  ------------------
  |  |  |  |  848|  82.8k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  82.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  82.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  82.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  82.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (189:16): [True: 753, False: 82.1k]
  ------------------
  190|    753|         png_handle_hIST(png_ptr, info_ptr, length);
  191|  82.1k|#endif
  192|       |
  193|  82.1k|#ifdef PNG_READ_oFFs_SUPPORTED
  194|  82.1k|      else if (chunk_name == png_oFFs)
  ------------------
  |  |  888|  82.1k|#define png_oFFs PNG_U32(111,  70,  70, 115)
  |  |  ------------------
  |  |  |  |  848|  82.1k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  82.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  82.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  82.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  82.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (194:16): [True: 343, False: 81.7k]
  ------------------
  195|    343|         png_handle_oFFs(png_ptr, info_ptr, length);
  196|  81.7k|#endif
  197|       |
  198|  81.7k|#ifdef PNG_READ_pCAL_SUPPORTED
  199|  81.7k|      else if (chunk_name == png_pCAL)
  ------------------
  |  |  889|  81.7k|#define png_pCAL PNG_U32(112,  67,  65,  76)
  |  |  ------------------
  |  |  |  |  848|  81.7k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  81.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  81.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  81.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  81.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (199:16): [True: 5.19k, False: 76.5k]
  ------------------
  200|  5.19k|         png_handle_pCAL(png_ptr, info_ptr, length);
  201|  76.5k|#endif
  202|       |
  203|  76.5k|#ifdef PNG_READ_sCAL_SUPPORTED
  204|  76.5k|      else if (chunk_name == png_sCAL)
  ------------------
  |  |  892|  76.5k|#define png_sCAL PNG_U32(115,  67,  65,  76)
  |  |  ------------------
  |  |  |  |  848|  76.5k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  76.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  76.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  76.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  76.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (204:16): [True: 6.37k, False: 70.1k]
  ------------------
  205|  6.37k|         png_handle_sCAL(png_ptr, info_ptr, length);
  206|  70.1k|#endif
  207|       |
  208|  70.1k|#ifdef PNG_READ_pHYs_SUPPORTED
  209|  70.1k|      else if (chunk_name == png_pHYs)
  ------------------
  |  |  890|  70.1k|#define png_pHYs PNG_U32(112,  72,  89, 115)
  |  |  ------------------
  |  |  |  |  848|  70.1k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  70.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  70.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  70.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  70.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (209:16): [True: 370, False: 69.8k]
  ------------------
  210|    370|         png_handle_pHYs(png_ptr, info_ptr, length);
  211|  69.8k|#endif
  212|       |
  213|  69.8k|#ifdef PNG_READ_sBIT_SUPPORTED
  214|  69.8k|      else if (chunk_name == png_sBIT)
  ------------------
  |  |  891|  69.8k|#define png_sBIT PNG_U32(115,  66,  73,  84)
  |  |  ------------------
  |  |  |  |  848|  69.8k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  69.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  69.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  69.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  69.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (214:16): [True: 1.22k, False: 68.6k]
  ------------------
  215|  1.22k|         png_handle_sBIT(png_ptr, info_ptr, length);
  216|  68.6k|#endif
  217|       |
  218|  68.6k|#ifdef PNG_READ_sRGB_SUPPORTED
  219|  68.6k|      else if (chunk_name == png_sRGB)
  ------------------
  |  |  894|  68.6k|#define png_sRGB PNG_U32(115,  82,  71,  66)
  |  |  ------------------
  |  |  |  |  848|  68.6k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  68.6k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  68.6k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  68.6k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  68.6k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (219:16): [True: 869, False: 67.7k]
  ------------------
  220|    869|         png_handle_sRGB(png_ptr, info_ptr, length);
  221|  67.7k|#endif
  222|       |
  223|  67.7k|#ifdef PNG_READ_iCCP_SUPPORTED
  224|  67.7k|      else if (chunk_name == png_iCCP)
  ------------------
  |  |  886|  67.7k|#define png_iCCP PNG_U32(105,  67,  67,  80)
  |  |  ------------------
  |  |  |  |  848|  67.7k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  67.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  67.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  67.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  67.7k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (224:16): [True: 6.60k, False: 61.1k]
  ------------------
  225|  6.60k|         png_handle_iCCP(png_ptr, info_ptr, length);
  226|  61.1k|#endif
  227|       |
  228|  61.1k|#ifdef PNG_READ_sPLT_SUPPORTED
  229|  61.1k|      else if (chunk_name == png_sPLT)
  ------------------
  |  |  893|  61.1k|#define png_sPLT PNG_U32(115,  80,  76,  84)
  |  |  ------------------
  |  |  |  |  848|  61.1k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  61.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  61.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  61.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  61.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (229:16): [True: 7.95k, False: 53.1k]
  ------------------
  230|  7.95k|         png_handle_sPLT(png_ptr, info_ptr, length);
  231|  53.1k|#endif
  232|       |
  233|  53.1k|#ifdef PNG_READ_tEXt_SUPPORTED
  234|  53.1k|      else if (chunk_name == png_tEXt)
  ------------------
  |  |  896|  53.1k|#define png_tEXt PNG_U32(116,  69,  88, 116)
  |  |  ------------------
  |  |  |  |  848|  53.1k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  53.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  53.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  53.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  53.1k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (234:16): [True: 13.6k, False: 39.5k]
  ------------------
  235|  13.6k|         png_handle_tEXt(png_ptr, info_ptr, length);
  236|  39.5k|#endif
  237|       |
  238|  39.5k|#ifdef PNG_READ_tIME_SUPPORTED
  239|  39.5k|      else if (chunk_name == png_tIME)
  ------------------
  |  |  897|  39.5k|#define png_tIME PNG_U32(116,  73,  77,  69)
  |  |  ------------------
  |  |  |  |  848|  39.5k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  39.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  39.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  39.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  39.5k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (239:16): [True: 1.49k, False: 38.0k]
  ------------------
  240|  1.49k|         png_handle_tIME(png_ptr, info_ptr, length);
  241|  38.0k|#endif
  242|       |
  243|  38.0k|#ifdef PNG_READ_tRNS_SUPPORTED
  244|  38.0k|      else if (chunk_name == png_tRNS)
  ------------------
  |  |  898|  38.0k|#define png_tRNS PNG_U32(116,  82,  78,  83)
  |  |  ------------------
  |  |  |  |  848|  38.0k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  38.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  38.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  38.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  38.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (244:16): [True: 2.05k, False: 36.0k]
  ------------------
  245|  2.05k|         png_handle_tRNS(png_ptr, info_ptr, length);
  246|  36.0k|#endif
  247|       |
  248|  36.0k|#ifdef PNG_READ_zTXt_SUPPORTED
  249|  36.0k|      else if (chunk_name == png_zTXt)
  ------------------
  |  |  899|  36.0k|#define png_zTXt PNG_U32(122,  84,  88, 116)
  |  |  ------------------
  |  |  |  |  848|  36.0k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  36.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  36.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  36.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  36.0k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (249:16): [True: 25.1k, False: 10.8k]
  ------------------
  250|  25.1k|         png_handle_zTXt(png_ptr, info_ptr, length);
  251|  10.8k|#endif
  252|       |
  253|  10.8k|#ifdef PNG_READ_iTXt_SUPPORTED
  254|  10.8k|      else if (chunk_name == png_iTXt)
  ------------------
  |  |  887|  10.8k|#define png_iTXt PNG_U32(105,  84,  88, 116)
  |  |  ------------------
  |  |  |  |  848|  10.8k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  10.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  10.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  10.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  10.8k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (254:16): [True: 7.65k, False: 3.18k]
  ------------------
  255|  7.65k|         png_handle_iTXt(png_ptr, info_ptr, length);
  256|  3.18k|#endif
  257|       |
  258|  3.18k|      else
  259|  3.18k|         png_handle_unknown(png_ptr, info_ptr, length,
  260|  3.18k|             PNG_HANDLE_CHUNK_AS_DEFAULT);
  ------------------
  |  | 2341|  3.18k|#define PNG_HANDLE_CHUNK_AS_DEFAULT   0
  ------------------
  261|  97.2k|   }
  262|  4.74k|}
png_read_update_info:
  268|  1.01k|{
  269|  1.01k|   png_debug(1, "in png_read_update_info");
  ------------------
  |  |  145|  1.01k|#  define png_debug(l, m) ((void)0)
  ------------------
  270|       |
  271|  1.01k|   if (png_ptr != NULL)
  ------------------
  |  Branch (271:8): [True: 1.01k, False: 0]
  ------------------
  272|  1.01k|   {
  273|  1.01k|      if ((png_ptr->flags & PNG_FLAG_ROW_INIT) == 0)
  ------------------
  |  |  710|  1.01k|#define PNG_FLAG_ROW_INIT                 0x0040U
  ------------------
  |  Branch (273:11): [True: 1.01k, False: 0]
  ------------------
  274|  1.01k|      {
  275|  1.01k|         png_read_start_row(png_ptr);
  276|       |
  277|  1.01k|#        ifdef PNG_READ_TRANSFORMS_SUPPORTED
  278|  1.01k|            png_read_transform_info(png_ptr, info_ptr);
  279|       |#        else
  280|       |            PNG_UNUSED(info_ptr)
  281|       |#        endif
  282|  1.01k|      }
  283|       |
  284|       |      /* New in 1.6.0 this avoids the bug of doing the initializations twice */
  285|      0|      else
  286|      0|         png_app_error(png_ptr,
  287|      0|             "png_read_update_info/png_start_read_image: duplicate call");
  288|  1.01k|   }
  289|  1.01k|}
png_read_row:
  384|   259k|{
  385|   259k|   png_row_info row_info;
  386|       |
  387|   259k|   if (png_ptr == NULL)
  ------------------
  |  Branch (387:8): [True: 0, False: 259k]
  ------------------
  388|      0|      return;
  389|       |
  390|   259k|   png_debug2(1, "in png_read_row (row %lu, pass %d)",
  ------------------
  |  |  151|   259k|#  define png_debug2(l, m, p1, p2) ((void)0)
  ------------------
  391|   259k|       (unsigned long)png_ptr->row_number, png_ptr->pass);
  392|       |
  393|       |   /* png_read_start_row sets the information (in particular iwidth) for this
  394|       |    * interlace pass.
  395|       |    */
  396|   259k|   if ((png_ptr->flags & PNG_FLAG_ROW_INIT) == 0)
  ------------------
  |  |  710|   259k|#define PNG_FLAG_ROW_INIT                 0x0040U
  ------------------
  |  Branch (396:8): [True: 0, False: 259k]
  ------------------
  397|      0|      png_read_start_row(png_ptr);
  398|       |
  399|       |   /* 1.5.6: row_info moved out of png_struct to a local here. */
  400|   259k|   row_info.width = png_ptr->iwidth; /* NOTE: width of current interlaced row */
  401|   259k|   row_info.color_type = png_ptr->color_type;
  402|   259k|   row_info.bit_depth = png_ptr->bit_depth;
  403|   259k|   row_info.channels = png_ptr->channels;
  404|   259k|   row_info.pixel_depth = png_ptr->pixel_depth;
  405|   259k|   row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width);
  ------------------
  |  |  764|   259k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 245k, False: 14.3k]
  |  |  ------------------
  |  |  765|   259k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|   259k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
  406|       |
  407|   259k|#ifdef PNG_WARNINGS_SUPPORTED
  408|   259k|   if (png_ptr->row_number == 0 && png_ptr->pass == 0)
  ------------------
  |  Branch (408:8): [True: 4.39k, False: 255k]
  |  Branch (408:36): [True: 1.01k, False: 3.38k]
  ------------------
  409|  1.01k|   {
  410|       |   /* Check for transforms that have been set but were defined out */
  411|       |#if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED)
  412|       |   if ((png_ptr->transformations & PNG_INVERT_MONO) != 0)
  413|       |      png_warning(png_ptr, "PNG_READ_INVERT_SUPPORTED is not defined");
  414|       |#endif
  415|       |
  416|       |#if defined(PNG_WRITE_FILLER_SUPPORTED) && !defined(PNG_READ_FILLER_SUPPORTED)
  417|       |   if ((png_ptr->transformations & PNG_FILLER) != 0)
  418|       |      png_warning(png_ptr, "PNG_READ_FILLER_SUPPORTED is not defined");
  419|       |#endif
  420|       |
  421|       |#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \
  422|       |    !defined(PNG_READ_PACKSWAP_SUPPORTED)
  423|       |   if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
  424|       |      png_warning(png_ptr, "PNG_READ_PACKSWAP_SUPPORTED is not defined");
  425|       |#endif
  426|       |
  427|       |#if defined(PNG_WRITE_PACK_SUPPORTED) && !defined(PNG_READ_PACK_SUPPORTED)
  428|       |   if ((png_ptr->transformations & PNG_PACK) != 0)
  429|       |      png_warning(png_ptr, "PNG_READ_PACK_SUPPORTED is not defined");
  430|       |#endif
  431|       |
  432|       |#if defined(PNG_WRITE_SHIFT_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED)
  433|       |   if ((png_ptr->transformations & PNG_SHIFT) != 0)
  434|       |      png_warning(png_ptr, "PNG_READ_SHIFT_SUPPORTED is not defined");
  435|       |#endif
  436|       |
  437|       |#if defined(PNG_WRITE_BGR_SUPPORTED) && !defined(PNG_READ_BGR_SUPPORTED)
  438|       |   if ((png_ptr->transformations & PNG_BGR) != 0)
  439|       |      png_warning(png_ptr, "PNG_READ_BGR_SUPPORTED is not defined");
  440|       |#endif
  441|       |
  442|       |#if defined(PNG_WRITE_SWAP_SUPPORTED) && !defined(PNG_READ_SWAP_SUPPORTED)
  443|       |   if ((png_ptr->transformations & PNG_SWAP_BYTES) != 0)
  444|       |      png_warning(png_ptr, "PNG_READ_SWAP_SUPPORTED is not defined");
  445|       |#endif
  446|  1.01k|   }
  447|   259k|#endif /* WARNINGS */
  448|       |
  449|   259k|#ifdef PNG_READ_INTERLACING_SUPPORTED
  450|       |   /* If interlaced and we do not need a new row, combine row and return.
  451|       |    * Notice that the pixels we have from previous rows have been transformed
  452|       |    * already; we can only combine like with like (transformed or
  453|       |    * untransformed) and, because of the libpng API for interlaced images, this
  454|       |    * means we must transform before de-interlacing.
  455|       |    */
  456|   259k|   if (png_ptr->interlaced != 0 &&
  ------------------
  |  Branch (456:8): [True: 181k, False: 78.9k]
  ------------------
  457|   259k|       (png_ptr->transformations & PNG_INTERLACE) != 0)
  ------------------
  |  |  668|   181k|#define PNG_INTERLACE           0x0002U
  ------------------
  |  Branch (457:8): [True: 181k, False: 0]
  ------------------
  458|   181k|   {
  459|   181k|      switch (png_ptr->pass)
  460|   181k|      {
  461|  88.7k|         case 0:
  ------------------
  |  Branch (461:10): [True: 88.7k, False: 92.2k]
  ------------------
  462|  88.7k|            if (png_ptr->row_number & 0x07)
  ------------------
  |  Branch (462:17): [True: 77.0k, False: 11.6k]
  ------------------
  463|  77.0k|            {
  464|  77.0k|               if (dsp_row != NULL)
  ------------------
  |  Branch (464:20): [True: 0, False: 77.0k]
  ------------------
  465|      0|                  png_combine_row(png_ptr, dsp_row, 1/*display*/);
  466|  77.0k|               png_read_finish_row(png_ptr);
  467|  77.0k|               return;
  468|  77.0k|            }
  469|  11.6k|            break;
  470|       |
  471|  46.8k|         case 1:
  ------------------
  |  Branch (471:10): [True: 46.8k, False: 134k]
  ------------------
  472|  46.8k|            if ((png_ptr->row_number & 0x07) || png_ptr->width < 5)
  ------------------
  |  Branch (472:17): [True: 40.5k, False: 6.34k]
  |  Branch (472:49): [True: 1.37k, False: 4.96k]
  ------------------
  473|  41.9k|            {
  474|  41.9k|               if (dsp_row != NULL)
  ------------------
  |  Branch (474:20): [True: 0, False: 41.9k]
  ------------------
  475|      0|                  png_combine_row(png_ptr, dsp_row, 1/*display*/);
  476|       |
  477|  41.9k|               png_read_finish_row(png_ptr);
  478|  41.9k|               return;
  479|  41.9k|            }
  480|  4.96k|            break;
  481|       |
  482|  15.6k|         case 2:
  ------------------
  |  Branch (482:10): [True: 15.6k, False: 165k]
  ------------------
  483|  15.6k|            if ((png_ptr->row_number & 0x07) != 4)
  ------------------
  |  Branch (483:17): [True: 13.7k, False: 1.90k]
  ------------------
  484|  13.7k|            {
  485|  13.7k|               if (dsp_row != NULL && (png_ptr->row_number & 4))
  ------------------
  |  Branch (485:20): [True: 0, False: 13.7k]
  |  Branch (485:39): [True: 0, False: 0]
  ------------------
  486|      0|                  png_combine_row(png_ptr, dsp_row, 1/*display*/);
  487|       |
  488|  13.7k|               png_read_finish_row(png_ptr);
  489|  13.7k|               return;
  490|  13.7k|            }
  491|  1.90k|            break;
  492|       |
  493|  10.9k|         case 3:
  ------------------
  |  Branch (493:10): [True: 10.9k, False: 170k]
  ------------------
  494|  10.9k|            if ((png_ptr->row_number & 3) || png_ptr->width < 3)
  ------------------
  |  Branch (494:17): [True: 7.77k, False: 3.14k]
  |  Branch (494:46): [True: 1.34k, False: 1.79k]
  ------------------
  495|  9.12k|            {
  496|  9.12k|               if (dsp_row != NULL)
  ------------------
  |  Branch (496:20): [True: 0, False: 9.12k]
  ------------------
  497|      0|                  png_combine_row(png_ptr, dsp_row, 1/*display*/);
  498|       |
  499|  9.12k|               png_read_finish_row(png_ptr);
  500|  9.12k|               return;
  501|  9.12k|            }
  502|  1.79k|            break;
  503|       |
  504|  8.31k|         case 4:
  ------------------
  |  Branch (504:10): [True: 8.31k, False: 172k]
  ------------------
  505|  8.31k|            if ((png_ptr->row_number & 3) != 2)
  ------------------
  |  Branch (505:17): [True: 6.36k, False: 1.95k]
  ------------------
  506|  6.36k|            {
  507|  6.36k|               if (dsp_row != NULL && (png_ptr->row_number & 2))
  ------------------
  |  Branch (507:20): [True: 0, False: 6.36k]
  |  Branch (507:39): [True: 0, False: 0]
  ------------------
  508|      0|                  png_combine_row(png_ptr, dsp_row, 1/*display*/);
  509|       |
  510|  6.36k|               png_read_finish_row(png_ptr);
  511|  6.36k|               return;
  512|  6.36k|            }
  513|  1.95k|            break;
  514|       |
  515|  6.25k|         case 5:
  ------------------
  |  Branch (515:10): [True: 6.25k, False: 174k]
  ------------------
  516|  6.25k|            if ((png_ptr->row_number & 1) || png_ptr->width < 2)
  ------------------
  |  Branch (516:17): [True: 2.86k, False: 3.38k]
  |  Branch (516:46): [True: 1.72k, False: 1.66k]
  ------------------
  517|  4.58k|            {
  518|  4.58k|               if (dsp_row != NULL)
  ------------------
  |  Branch (518:20): [True: 0, False: 4.58k]
  ------------------
  519|      0|                  png_combine_row(png_ptr, dsp_row, 1/*display*/);
  520|       |
  521|  4.58k|               png_read_finish_row(png_ptr);
  522|  4.58k|               return;
  523|  4.58k|            }
  524|  1.66k|            break;
  525|       |
  526|  1.66k|         default:
  ------------------
  |  Branch (526:10): [True: 0, False: 181k]
  ------------------
  527|  4.28k|         case 6:
  ------------------
  |  Branch (527:10): [True: 4.28k, False: 176k]
  ------------------
  528|  4.28k|            if ((png_ptr->row_number & 1) == 0)
  ------------------
  |  Branch (528:17): [True: 2.39k, False: 1.89k]
  ------------------
  529|  2.39k|            {
  530|  2.39k|               png_read_finish_row(png_ptr);
  531|  2.39k|               return;
  532|  2.39k|            }
  533|  1.89k|            break;
  534|   181k|      }
  535|   181k|   }
  536|   104k|#endif
  537|       |
  538|   104k|   if ((png_ptr->mode & PNG_HAVE_IDAT) == 0)
  ------------------
  |  |  651|   104k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (538:8): [True: 0, False: 104k]
  ------------------
  539|      0|      png_error(png_ptr, "Invalid attempt to read row data");
  540|       |
  541|       |   /* Fill the row with IDAT data: */
  542|   104k|   png_ptr->row_buf[0]=255; /* to force error if no data was found */
  543|   104k|   png_read_IDAT_data(png_ptr, png_ptr->row_buf, row_info.rowbytes + 1);
  544|       |
  545|   104k|   if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE)
  ------------------
  |  | 1475|   104k|#define PNG_FILTER_VALUE_NONE  0
  ------------------
  |  Branch (545:8): [True: 24.8k, False: 79.9k]
  ------------------
  546|  24.8k|   {
  547|  24.8k|      if (png_ptr->row_buf[0] < PNG_FILTER_VALUE_LAST)
  ------------------
  |  | 1480|  24.8k|#define PNG_FILTER_VALUE_LAST  5
  ------------------
  |  Branch (547:11): [True: 24.8k, False: 12]
  ------------------
  548|  24.8k|         png_read_filter_row(png_ptr, &row_info, png_ptr->row_buf + 1,
  549|  24.8k|             png_ptr->prev_row + 1, png_ptr->row_buf[0]);
  550|     12|      else
  551|     12|         png_error(png_ptr, "bad adaptive filter value");
  552|  24.8k|   }
  553|       |
  554|       |   /* libpng 1.5.6: the following line was copying png_ptr->rowbytes before
  555|       |    * 1.5.6, while the buffer really is this big in current versions of libpng
  556|       |    * it may not be in the future, so this was changed just to copy the
  557|       |    * interlaced count:
  558|       |    */
  559|   104k|   memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1);
  560|       |
  561|   104k|#ifdef PNG_MNG_FEATURES_SUPPORTED
  562|   104k|   if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
  ------------------
  |  |  857|   104k|#define PNG_FLAG_MNG_FILTER_64      0x04
  ------------------
  |  Branch (562:8): [True: 0, False: 104k]
  ------------------
  563|   104k|       (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
  ------------------
  |  |  682|      0|#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
  ------------------
  |  Branch (563:8): [True: 0, False: 0]
  ------------------
  564|      0|   {
  565|       |      /* Intrapixel differencing */
  566|      0|      png_do_read_intrapixel(&row_info, png_ptr->row_buf + 1);
  567|      0|   }
  568|   104k|#endif
  569|       |
  570|   104k|#ifdef PNG_READ_TRANSFORMS_SUPPORTED
  571|   104k|   if (png_ptr->transformations
  ------------------
  |  Branch (571:8): [True: 104k, False: 0]
  ------------------
  572|   104k|#     ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
  573|   104k|         || png_ptr->num_palette_max >= 0
  ------------------
  |  Branch (573:13): [True: 0, False: 0]
  ------------------
  574|   104k|#     endif
  575|   104k|      )
  576|   104k|      png_do_read_transformations(png_ptr, &row_info);
  577|   104k|#endif
  578|       |
  579|       |   /* The transformed pixel depth should match the depth now in row_info. */
  580|   104k|   if (png_ptr->transformed_pixel_depth == 0)
  ------------------
  |  Branch (580:8): [True: 920, False: 103k]
  ------------------
  581|    920|   {
  582|    920|      png_ptr->transformed_pixel_depth = row_info.pixel_depth;
  583|    920|      if (row_info.pixel_depth > png_ptr->maximum_pixel_depth)
  ------------------
  |  Branch (583:11): [True: 0, False: 920]
  ------------------
  584|      0|         png_error(png_ptr, "sequential row overflow");
  585|    920|   }
  586|       |
  587|   103k|   else if (png_ptr->transformed_pixel_depth != row_info.pixel_depth)
  ------------------
  |  Branch (587:13): [True: 0, False: 103k]
  ------------------
  588|      0|      png_error(png_ptr, "internal sequential row size calculation error");
  589|       |
  590|   104k|#ifdef PNG_READ_INTERLACING_SUPPORTED
  591|       |   /* Expand interlaced rows to full size */
  592|   104k|   if (png_ptr->interlaced != 0 &&
  ------------------
  |  Branch (592:8): [True: 25.6k, False: 79.1k]
  ------------------
  593|   104k|      (png_ptr->transformations & PNG_INTERLACE) != 0)
  ------------------
  |  |  668|  25.6k|#define PNG_INTERLACE           0x0002U
  ------------------
  |  Branch (593:7): [True: 25.6k, False: 0]
  ------------------
  594|  25.6k|   {
  595|  25.6k|      if (png_ptr->pass < 6)
  ------------------
  |  Branch (595:11): [True: 23.7k, False: 1.88k]
  ------------------
  596|  23.7k|         png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
  597|  23.7k|             png_ptr->transformations);
  598|       |
  599|  25.6k|      if (dsp_row != NULL)
  ------------------
  |  Branch (599:11): [True: 0, False: 25.6k]
  ------------------
  600|      0|         png_combine_row(png_ptr, dsp_row, 1/*display*/);
  601|       |
  602|  25.6k|      if (row != NULL)
  ------------------
  |  Branch (602:11): [True: 25.6k, False: 0]
  ------------------
  603|  25.6k|         png_combine_row(png_ptr, row, 0/*row*/);
  604|  25.6k|   }
  605|       |
  606|  79.1k|   else
  607|  79.1k|#endif
  608|  79.1k|   {
  609|  79.1k|      if (row != NULL)
  ------------------
  |  Branch (609:11): [True: 78.7k, False: 364]
  ------------------
  610|  78.7k|         png_combine_row(png_ptr, row, -1/*ignored*/);
  611|       |
  612|  79.1k|      if (dsp_row != NULL)
  ------------------
  |  Branch (612:11): [True: 0, False: 79.1k]
  ------------------
  613|      0|         png_combine_row(png_ptr, dsp_row, -1/*ignored*/);
  614|  79.1k|   }
  615|   104k|   png_read_finish_row(png_ptr);
  616|       |
  617|   104k|   if (png_ptr->read_row_fn != NULL)
  ------------------
  |  Branch (617:8): [True: 0, False: 104k]
  ------------------
  618|      0|      (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
  619|       |
  620|   104k|}
png_read_image:
  705|  1.01k|{
  706|  1.01k|   png_uint_32 i, image_height;
  707|  1.01k|   int pass, j;
  708|  1.01k|   png_bytepp rp;
  709|       |
  710|  1.01k|   png_debug(1, "in png_read_image");
  ------------------
  |  |  145|  1.01k|#  define png_debug(l, m) ((void)0)
  ------------------
  711|       |
  712|  1.01k|   if (png_ptr == NULL)
  ------------------
  |  Branch (712:8): [True: 0, False: 1.01k]
  ------------------
  713|      0|      return;
  714|       |
  715|  1.01k|#ifdef PNG_READ_INTERLACING_SUPPORTED
  716|  1.01k|   if ((png_ptr->flags & PNG_FLAG_ROW_INIT) == 0)
  ------------------
  |  |  710|  1.01k|#define PNG_FLAG_ROW_INIT                 0x0040U
  ------------------
  |  Branch (716:8): [True: 0, False: 1.01k]
  ------------------
  717|      0|   {
  718|      0|      pass = png_set_interlace_handling(png_ptr);
  719|       |      /* And make sure transforms are initialized. */
  720|      0|      png_start_read_image(png_ptr);
  721|      0|   }
  722|  1.01k|   else
  723|  1.01k|   {
  724|  1.01k|      if (png_ptr->interlaced != 0 &&
  ------------------
  |  Branch (724:11): [True: 710, False: 301]
  ------------------
  725|  1.01k|          (png_ptr->transformations & PNG_INTERLACE) == 0)
  ------------------
  |  |  668|    710|#define PNG_INTERLACE           0x0002U
  ------------------
  |  Branch (725:11): [True: 0, False: 710]
  ------------------
  726|      0|      {
  727|       |         /* Caller called png_start_read_image or png_read_update_info without
  728|       |          * first turning on the PNG_INTERLACE transform.  We can fix this here,
  729|       |          * but the caller should do it!
  730|       |          */
  731|      0|         png_warning(png_ptr, "Interlace handling should be turned on when "
  732|      0|             "using png_read_image");
  733|       |         /* Make sure this is set correctly */
  734|      0|         png_ptr->num_rows = png_ptr->height;
  735|      0|      }
  736|       |
  737|       |      /* Obtain the pass number, which also turns on the PNG_INTERLACE flag in
  738|       |       * the above error case.
  739|       |       */
  740|  1.01k|      pass = png_set_interlace_handling(png_ptr);
  741|  1.01k|   }
  742|       |#else
  743|       |   if (png_ptr->interlaced)
  744|       |      png_error(png_ptr,
  745|       |          "Cannot read interlaced image -- interlace handler disabled");
  746|       |
  747|       |   pass = 1;
  748|       |#endif
  749|       |
  750|  1.01k|   image_height=png_ptr->height;
  751|       |
  752|  5.40k|   for (j = 0; j < pass; j++)
  ------------------
  |  Branch (752:16): [True: 4.39k, False: 1.01k]
  ------------------
  753|  4.39k|   {
  754|  4.39k|      rp = image;
  755|   264k|      for (i = 0; i < image_height; i++)
  ------------------
  |  Branch (755:19): [True: 259k, False: 4.39k]
  ------------------
  756|   259k|      {
  757|   259k|         png_read_row(png_ptr, *rp, NULL);
  758|   259k|         rp++;
  759|   259k|      }
  760|  4.39k|   }
  761|  1.01k|}
png_read_end:
  771|    586|{
  772|    586|#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  773|    586|   int keep;
  774|    586|#endif
  775|       |
  776|    586|   png_debug(1, "in png_read_end");
  ------------------
  |  |  145|    586|#  define png_debug(l, m) ((void)0)
  ------------------
  777|       |
  778|    586|   if (png_ptr == NULL)
  ------------------
  |  Branch (778:8): [True: 0, False: 586]
  ------------------
  779|      0|      return;
  780|       |
  781|       |   /* If png_read_end is called in the middle of reading the rows there may
  782|       |    * still be pending IDAT data and an owned zstream.  Deal with this here.
  783|       |    */
  784|    586|#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  785|    586|   if (png_chunk_unknown_handling(png_ptr, png_IDAT) == 0)
  ------------------
  |  |  873|    586|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|    586|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|    586|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|    586|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|    586|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|    586|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (785:8): [True: 586, False: 0]
  ------------------
  786|    586|#endif
  787|    586|      png_read_finish_IDAT(png_ptr);
  788|       |
  789|    586|#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
  790|       |   /* Report invalid palette index; added at libng-1.5.10 */
  791|    586|   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
  ------------------
  |  |  668|  1.17k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|    586|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|    586|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (791:8): [True: 2, False: 584]
  ------------------
  792|    586|       png_ptr->num_palette_max >= png_ptr->num_palette)
  ------------------
  |  Branch (792:8): [True: 0, False: 2]
  ------------------
  793|      0|      png_benign_error(png_ptr, "Read palette index exceeding num_palette");
  794|    586|#endif
  795|       |
  796|    586|   do
  797|  5.40k|   {
  798|  5.40k|      png_uint_32 length = png_read_chunk_header(png_ptr);
  799|  5.40k|      png_uint_32 chunk_name = png_ptr->chunk_name;
  800|       |
  801|  5.40k|      if (chunk_name != png_IDAT)
  ------------------
  |  |  873|  5.40k|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|  5.40k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (801:11): [True: 4.38k, False: 1.02k]
  ------------------
  802|  4.38k|         png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
  ------------------
  |  |  662|  4.38k|#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
  ------------------
  803|       |
  804|  5.40k|      if (chunk_name == png_IEND)
  ------------------
  |  |  874|  5.40k|#define png_IEND PNG_U32( 73,  69,  78,  68)
  |  |  ------------------
  |  |  |  |  848|  5.40k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (804:11): [True: 72, False: 5.33k]
  ------------------
  805|     72|         png_handle_IEND(png_ptr, info_ptr, length);
  806|       |
  807|  5.33k|      else if (chunk_name == png_IHDR)
  ------------------
  |  |  875|  5.33k|#define png_IHDR PNG_U32( 73,  72,  68,  82)
  |  |  ------------------
  |  |  |  |  848|  5.33k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.33k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.33k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.33k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.33k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (807:16): [True: 1, False: 5.33k]
  ------------------
  808|      1|         png_handle_IHDR(png_ptr, info_ptr, length);
  809|       |
  810|  5.33k|      else if (info_ptr == NULL)
  ------------------
  |  Branch (810:16): [True: 0, False: 5.33k]
  ------------------
  811|      0|         png_crc_finish(png_ptr, length);
  812|       |
  813|  5.33k|#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  814|  5.33k|      else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
  ------------------
  |  Branch (814:16): [True: 0, False: 5.33k]
  ------------------
  815|      0|      {
  816|      0|         if (chunk_name == png_IDAT)
  ------------------
  |  |  873|      0|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|      0|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (816:14): [True: 0, False: 0]
  ------------------
  817|      0|         {
  818|      0|            if ((length > 0 && !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
  ------------------
  |  |  707|      0|#define PNG_FLAG_ZSTREAM_ENDED            0x0008U /* Added to libpng-1.6.0 */
  ------------------
  |  Branch (818:18): [True: 0, False: 0]
  |  Branch (818:32): [True: 0, False: 0]
  ------------------
  819|      0|                || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
  ------------------
  |  |  662|      0|#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
  ------------------
  |  Branch (819:20): [True: 0, False: 0]
  ------------------
  820|      0|               png_benign_error(png_ptr, ".Too many IDATs found");
  821|      0|         }
  822|      0|         png_handle_unknown(png_ptr, info_ptr, length, keep);
  823|      0|         if (chunk_name == png_PLTE)
  ------------------
  |  |  876|      0|#define png_PLTE PNG_U32( 80,  76,  84,  69)
  |  |  ------------------
  |  |  |  |  848|      0|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|      0|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (823:14): [True: 0, False: 0]
  ------------------
  824|      0|            png_ptr->mode |= PNG_HAVE_PLTE;
  ------------------
  |  |  644|      0|#define PNG_HAVE_PLTE  0x02
  ------------------
  825|      0|      }
  826|  5.33k|#endif
  827|       |
  828|  5.33k|      else if (chunk_name == png_IDAT)
  ------------------
  |  |  873|  5.33k|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|  5.33k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.33k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.33k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.33k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.33k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (828:16): [True: 955, False: 4.38k]
  ------------------
  829|    955|      {
  830|       |         /* Zero length IDATs are legal after the last IDAT has been
  831|       |          * read, but not after other chunks have been read.  1.6 does not
  832|       |          * always read all the deflate data; specifically it cannot be relied
  833|       |          * upon to read the Adler32 at the end.  If it doesn't ignore IDAT
  834|       |          * chunks which are longer than zero as well:
  835|       |          */
  836|    955|         if ((length > 0 && !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
  ------------------
  |  |  707|    377|#define PNG_FLAG_ZSTREAM_ENDED            0x0008U /* Added to libpng-1.6.0 */
  ------------------
  |  Branch (836:15): [True: 377, False: 578]
  |  Branch (836:29): [True: 0, False: 377]
  ------------------
  837|    955|             || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
  ------------------
  |  |  662|    955|#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
  ------------------
  |  Branch (837:17): [True: 222, False: 733]
  ------------------
  838|    222|            png_benign_error(png_ptr, "..Too many IDATs found");
  839|       |
  840|    955|         png_crc_finish(png_ptr, length);
  841|    955|      }
  842|  4.38k|      else if (chunk_name == png_PLTE)
  ------------------
  |  |  876|  4.38k|#define png_PLTE PNG_U32( 80,  76,  84,  69)
  |  |  ------------------
  |  |  |  |  848|  4.38k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.38k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.38k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.38k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.38k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (842:16): [True: 242, False: 4.13k]
  ------------------
  843|    242|         png_handle_PLTE(png_ptr, info_ptr, length);
  844|       |
  845|  4.13k|#ifdef PNG_READ_bKGD_SUPPORTED
  846|  4.13k|      else if (chunk_name == png_bKGD)
  ------------------
  |  |  877|  4.13k|#define png_bKGD PNG_U32( 98,  75,  71,  68)
  |  |  ------------------
  |  |  |  |  848|  4.13k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.13k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.13k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.13k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.13k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (846:16): [True: 66, False: 4.07k]
  ------------------
  847|     66|         png_handle_bKGD(png_ptr, info_ptr, length);
  848|  4.07k|#endif
  849|       |
  850|  4.07k|#ifdef PNG_READ_cHRM_SUPPORTED
  851|  4.07k|      else if (chunk_name == png_cHRM)
  ------------------
  |  |  878|  4.07k|#define png_cHRM PNG_U32( 99,  72,  82,  77)
  |  |  ------------------
  |  |  |  |  848|  4.07k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.07k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.07k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.07k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  4.07k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (851:16): [True: 196, False: 3.87k]
  ------------------
  852|    196|         png_handle_cHRM(png_ptr, info_ptr, length);
  853|  3.87k|#endif
  854|       |
  855|  3.87k|#ifdef PNG_READ_eXIf_SUPPORTED
  856|  3.87k|      else if (chunk_name == png_eXIf)
  ------------------
  |  |  879|  3.87k|#define png_eXIf PNG_U32(101,  88,  73, 102) /* registered July 2017 */
  |  |  ------------------
  |  |  |  |  848|  3.87k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.87k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.87k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.87k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.87k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (856:16): [True: 202, False: 3.67k]
  ------------------
  857|    202|         png_handle_eXIf(png_ptr, info_ptr, length);
  858|  3.67k|#endif
  859|       |
  860|  3.67k|#ifdef PNG_READ_gAMA_SUPPORTED
  861|  3.67k|      else if (chunk_name == png_gAMA)
  ------------------
  |  |  881|  3.67k|#define png_gAMA PNG_U32(103,  65,  77,  65)
  |  |  ------------------
  |  |  |  |  848|  3.67k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.67k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.67k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.67k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.67k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (861:16): [True: 207, False: 3.46k]
  ------------------
  862|    207|         png_handle_gAMA(png_ptr, info_ptr, length);
  863|  3.46k|#endif
  864|       |
  865|  3.46k|#ifdef PNG_READ_hIST_SUPPORTED
  866|  3.46k|      else if (chunk_name == png_hIST)
  ------------------
  |  |  885|  3.46k|#define png_hIST PNG_U32(104,  73,  83,  84)
  |  |  ------------------
  |  |  |  |  848|  3.46k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.46k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.46k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.46k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.46k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (866:16): [True: 68, False: 3.40k]
  ------------------
  867|     68|         png_handle_hIST(png_ptr, info_ptr, length);
  868|  3.40k|#endif
  869|       |
  870|  3.40k|#ifdef PNG_READ_oFFs_SUPPORTED
  871|  3.40k|      else if (chunk_name == png_oFFs)
  ------------------
  |  |  888|  3.40k|#define png_oFFs PNG_U32(111,  70,  70, 115)
  |  |  ------------------
  |  |  |  |  848|  3.40k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.40k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (871:16): [True: 194, False: 3.20k]
  ------------------
  872|    194|         png_handle_oFFs(png_ptr, info_ptr, length);
  873|  3.20k|#endif
  874|       |
  875|  3.20k|#ifdef PNG_READ_pCAL_SUPPORTED
  876|  3.20k|      else if (chunk_name == png_pCAL)
  ------------------
  |  |  889|  3.20k|#define png_pCAL PNG_U32(112,  67,  65,  76)
  |  |  ------------------
  |  |  |  |  848|  3.20k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.20k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.20k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.20k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.20k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (876:16): [True: 204, False: 3.00k]
  ------------------
  877|    204|         png_handle_pCAL(png_ptr, info_ptr, length);
  878|  3.00k|#endif
  879|       |
  880|  3.00k|#ifdef PNG_READ_sCAL_SUPPORTED
  881|  3.00k|      else if (chunk_name == png_sCAL)
  ------------------
  |  |  892|  3.00k|#define png_sCAL PNG_U32(115,  67,  65,  76)
  |  |  ------------------
  |  |  |  |  848|  3.00k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.00k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.00k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.00k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  3.00k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (881:16): [True: 75, False: 2.92k]
  ------------------
  882|     75|         png_handle_sCAL(png_ptr, info_ptr, length);
  883|  2.92k|#endif
  884|       |
  885|  2.92k|#ifdef PNG_READ_pHYs_SUPPORTED
  886|  2.92k|      else if (chunk_name == png_pHYs)
  ------------------
  |  |  890|  2.92k|#define png_pHYs PNG_U32(112,  72,  89, 115)
  |  |  ------------------
  |  |  |  |  848|  2.92k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.92k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.92k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.92k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.92k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (886:16): [True: 67, False: 2.86k]
  ------------------
  887|     67|         png_handle_pHYs(png_ptr, info_ptr, length);
  888|  2.86k|#endif
  889|       |
  890|  2.86k|#ifdef PNG_READ_sBIT_SUPPORTED
  891|  2.86k|      else if (chunk_name == png_sBIT)
  ------------------
  |  |  891|  2.86k|#define png_sBIT PNG_U32(115,  66,  73,  84)
  |  |  ------------------
  |  |  |  |  848|  2.86k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.86k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.86k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.86k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.86k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (891:16): [True: 238, False: 2.62k]
  ------------------
  892|    238|         png_handle_sBIT(png_ptr, info_ptr, length);
  893|  2.62k|#endif
  894|       |
  895|  2.62k|#ifdef PNG_READ_sRGB_SUPPORTED
  896|  2.62k|      else if (chunk_name == png_sRGB)
  ------------------
  |  |  894|  2.62k|#define png_sRGB PNG_U32(115,  82,  71,  66)
  |  |  ------------------
  |  |  |  |  848|  2.62k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.62k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.62k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.62k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.62k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (896:16): [True: 226, False: 2.39k]
  ------------------
  897|    226|         png_handle_sRGB(png_ptr, info_ptr, length);
  898|  2.39k|#endif
  899|       |
  900|  2.39k|#ifdef PNG_READ_iCCP_SUPPORTED
  901|  2.39k|      else if (chunk_name == png_iCCP)
  ------------------
  |  |  886|  2.39k|#define png_iCCP PNG_U32(105,  67,  67,  80)
  |  |  ------------------
  |  |  |  |  848|  2.39k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.39k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.39k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.39k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.39k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (901:16): [True: 200, False: 2.19k]
  ------------------
  902|    200|         png_handle_iCCP(png_ptr, info_ptr, length);
  903|  2.19k|#endif
  904|       |
  905|  2.19k|#ifdef PNG_READ_sPLT_SUPPORTED
  906|  2.19k|      else if (chunk_name == png_sPLT)
  ------------------
  |  |  893|  2.19k|#define png_sPLT PNG_U32(115,  80,  76,  84)
  |  |  ------------------
  |  |  |  |  848|  2.19k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.19k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.19k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.19k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  2.19k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (906:16): [True: 201, False: 1.99k]
  ------------------
  907|    201|         png_handle_sPLT(png_ptr, info_ptr, length);
  908|  1.99k|#endif
  909|       |
  910|  1.99k|#ifdef PNG_READ_tEXt_SUPPORTED
  911|  1.99k|      else if (chunk_name == png_tEXt)
  ------------------
  |  |  896|  1.99k|#define png_tEXt PNG_U32(116,  69,  88, 116)
  |  |  ------------------
  |  |  |  |  848|  1.99k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.99k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.99k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.99k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.99k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (911:16): [True: 345, False: 1.65k]
  ------------------
  912|    345|         png_handle_tEXt(png_ptr, info_ptr, length);
  913|  1.65k|#endif
  914|       |
  915|  1.65k|#ifdef PNG_READ_tIME_SUPPORTED
  916|  1.65k|      else if (chunk_name == png_tIME)
  ------------------
  |  |  897|  1.65k|#define png_tIME PNG_U32(116,  73,  77,  69)
  |  |  ------------------
  |  |  |  |  848|  1.65k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.65k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.65k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.65k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.65k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (916:16): [True: 205, False: 1.44k]
  ------------------
  917|    205|         png_handle_tIME(png_ptr, info_ptr, length);
  918|  1.44k|#endif
  919|       |
  920|  1.44k|#ifdef PNG_READ_tRNS_SUPPORTED
  921|  1.44k|      else if (chunk_name == png_tRNS)
  ------------------
  |  |  898|  1.44k|#define png_tRNS PNG_U32(116,  82,  78,  83)
  |  |  ------------------
  |  |  |  |  848|  1.44k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.44k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.44k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.44k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.44k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (921:16): [True: 196, False: 1.24k]
  ------------------
  922|    196|         png_handle_tRNS(png_ptr, info_ptr, length);
  923|  1.24k|#endif
  924|       |
  925|  1.24k|#ifdef PNG_READ_zTXt_SUPPORTED
  926|  1.24k|      else if (chunk_name == png_zTXt)
  ------------------
  |  |  899|  1.24k|#define png_zTXt PNG_U32(122,  84,  88, 116)
  |  |  ------------------
  |  |  |  |  848|  1.24k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.24k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.24k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.24k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.24k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (926:16): [True: 208, False: 1.04k]
  ------------------
  927|    208|         png_handle_zTXt(png_ptr, info_ptr, length);
  928|  1.04k|#endif
  929|       |
  930|  1.04k|#ifdef PNG_READ_iTXt_SUPPORTED
  931|  1.04k|      else if (chunk_name == png_iTXt)
  ------------------
  |  |  887|  1.04k|#define png_iTXt PNG_U32(105,  84,  88, 116)
  |  |  ------------------
  |  |  |  |  848|  1.04k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.04k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.04k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.04k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.04k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (931:16): [True: 448, False: 593]
  ------------------
  932|    448|         png_handle_iTXt(png_ptr, info_ptr, length);
  933|    593|#endif
  934|       |
  935|    593|      else
  936|    593|         png_handle_unknown(png_ptr, info_ptr, length,
  937|    593|             PNG_HANDLE_CHUNK_AS_DEFAULT);
  ------------------
  |  | 2341|    593|#define PNG_HANDLE_CHUNK_AS_DEFAULT   0
  ------------------
  938|  5.40k|   } while ((png_ptr->mode & PNG_HAVE_IEND) == 0);
  ------------------
  |  |  653|  5.40k|#define PNG_HAVE_IEND               0x10U
  ------------------
  |  Branch (938:13): [True: 4.82k, False: 586]
  ------------------
  939|    586|}
png_destroy_read_struct:
 1017|  4.74k|{
 1018|  4.74k|   png_structrp png_ptr = NULL;
 1019|       |
 1020|  4.74k|   png_debug(1, "in png_destroy_read_struct");
  ------------------
  |  |  145|  4.74k|#  define png_debug(l, m) ((void)0)
  ------------------
 1021|       |
 1022|  4.74k|   if (png_ptr_ptr != NULL)
  ------------------
  |  Branch (1022:8): [True: 4.74k, False: 0]
  ------------------
 1023|  4.74k|      png_ptr = *png_ptr_ptr;
 1024|       |
 1025|  4.74k|   if (png_ptr == NULL)
  ------------------
  |  Branch (1025:8): [True: 0, False: 4.74k]
  ------------------
 1026|      0|      return;
 1027|       |
 1028|       |   /* libpng 1.6.0: use the API to destroy info structs to ensure consistent
 1029|       |    * behavior.  Prior to 1.6.0 libpng did extra 'info' destruction in this API.
 1030|       |    * The extra was, apparently, unnecessary yet this hides memory leak bugs.
 1031|       |    */
 1032|  4.74k|   png_destroy_info_struct(png_ptr, end_info_ptr_ptr);
 1033|  4.74k|   png_destroy_info_struct(png_ptr, info_ptr_ptr);
 1034|       |
 1035|  4.74k|   *png_ptr_ptr = NULL;
 1036|  4.74k|   png_read_destroy(png_ptr);
 1037|  4.74k|   png_destroy_png_struct(png_ptr);
 1038|  4.74k|}
pngread.c:png_read_destroy:
  945|  4.74k|{
  946|  4.74k|   png_debug(1, "in png_read_destroy");
  ------------------
  |  |  145|  4.74k|#  define png_debug(l, m) ((void)0)
  ------------------
  947|       |
  948|  4.74k|#ifdef PNG_READ_GAMMA_SUPPORTED
  949|  4.74k|   png_destroy_gamma_table(png_ptr);
  950|  4.74k|#endif
  951|       |
  952|  4.74k|   png_free(png_ptr, png_ptr->big_row_buf);
  953|  4.74k|   png_ptr->big_row_buf = NULL;
  954|  4.74k|   png_free(png_ptr, png_ptr->big_prev_row);
  955|  4.74k|   png_ptr->big_prev_row = NULL;
  956|  4.74k|   png_free(png_ptr, png_ptr->read_buffer);
  957|  4.74k|   png_ptr->read_buffer = NULL;
  958|       |
  959|  4.74k|#ifdef PNG_READ_QUANTIZE_SUPPORTED
  960|  4.74k|   png_free(png_ptr, png_ptr->palette_lookup);
  961|  4.74k|   png_ptr->palette_lookup = NULL;
  962|  4.74k|   png_free(png_ptr, png_ptr->quantize_index);
  963|  4.74k|   png_ptr->quantize_index = NULL;
  964|  4.74k|#endif
  965|       |
  966|  4.74k|   if ((png_ptr->free_me & PNG_FREE_PLTE) != 0)
  ------------------
  |  | 1754|  4.74k|#define PNG_FREE_PLTE 0x1000U
  ------------------
  |  Branch (966:8): [True: 0, False: 4.74k]
  ------------------
  967|      0|   {
  968|      0|      png_zfree(png_ptr, png_ptr->palette);
  969|      0|      png_ptr->palette = NULL;
  970|      0|   }
  971|  4.74k|   png_ptr->free_me &= ~PNG_FREE_PLTE;
  ------------------
  |  | 1754|  4.74k|#define PNG_FREE_PLTE 0x1000U
  ------------------
  972|       |
  973|  4.74k|#if defined(PNG_tRNS_SUPPORTED) || \
  974|  4.74k|    defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  975|  4.74k|   if ((png_ptr->free_me & PNG_FREE_TRNS) != 0)
  ------------------
  |  | 1755|  4.74k|#define PNG_FREE_TRNS 0x2000U
  ------------------
  |  Branch (975:8): [True: 0, False: 4.74k]
  ------------------
  976|      0|   {
  977|      0|      png_free(png_ptr, png_ptr->trans_alpha);
  978|      0|      png_ptr->trans_alpha = NULL;
  979|      0|   }
  980|  4.74k|   png_ptr->free_me &= ~PNG_FREE_TRNS;
  ------------------
  |  | 1755|  4.74k|#define PNG_FREE_TRNS 0x2000U
  ------------------
  981|  4.74k|#endif
  982|       |
  983|  4.74k|   inflateEnd(&png_ptr->zstream);
  984|       |
  985|  4.74k|#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  986|  4.74k|   png_free(png_ptr, png_ptr->save_buffer);
  987|  4.74k|   png_ptr->save_buffer = NULL;
  988|  4.74k|#endif
  989|       |
  990|  4.74k|#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) && \
  991|  4.74k|   defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
  992|  4.74k|   png_free(png_ptr, png_ptr->unknown_chunk.data);
  993|  4.74k|   png_ptr->unknown_chunk.data = NULL;
  994|  4.74k|#endif
  995|       |
  996|  4.74k|#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
  997|  4.74k|   png_free(png_ptr, png_ptr->chunk_list);
  998|  4.74k|   png_ptr->chunk_list = NULL;
  999|  4.74k|#endif
 1000|       |
 1001|  4.74k|#if defined(PNG_READ_EXPAND_SUPPORTED) && \
 1002|  4.74k|    defined(PNG_ARM_NEON_IMPLEMENTATION)
 1003|  4.74k|   png_free(png_ptr, png_ptr->riffled_palette);
 1004|  4.74k|   png_ptr->riffled_palette = NULL;
 1005|  4.74k|#endif
 1006|       |
 1007|       |   /* NOTE: the 'setjmp' buffer may still be allocated and the memory and error
 1008|       |    * callbacks are still set at this point.  They are required to complete the
 1009|       |    * destruction of the png_struct itself.
 1010|       |    */
 1011|  4.74k|}

png_read_data:
   33|  1.34M|{
   34|  1.34M|   png_debug1(4, "reading %d bytes", (int)length);
  ------------------
  |  |  148|  1.34M|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
   35|       |
   36|  1.34M|   if (png_ptr->read_data_fn != NULL)
  ------------------
  |  Branch (36:8): [True: 1.34M, False: 0]
  ------------------
   37|  1.34M|      (*(png_ptr->read_data_fn))(png_ptr, data, length);
   38|       |
   39|      0|   else
   40|      0|      png_error(png_ptr, "Call to NULL read function");
   41|  1.34M|}
png_set_read_fn:
   89|  9.49k|{
   90|  9.49k|   if (png_ptr == NULL)
  ------------------
  |  Branch (90:8): [True: 0, False: 9.49k]
  ------------------
   91|      0|      return;
   92|       |
   93|  9.49k|   png_ptr->io_ptr = io_ptr;
   94|       |
   95|  9.49k|#ifdef PNG_STDIO_SUPPORTED
   96|  9.49k|   if (read_data_fn != NULL)
  ------------------
  |  Branch (96:8): [True: 4.74k, False: 4.74k]
  ------------------
   97|  4.74k|      png_ptr->read_data_fn = read_data_fn;
   98|       |
   99|  4.74k|   else
  100|  4.74k|      png_ptr->read_data_fn = png_default_read_data;
  101|       |#else
  102|       |   png_ptr->read_data_fn = read_data_fn;
  103|       |#endif
  104|       |
  105|  9.49k|#ifdef PNG_WRITE_SUPPORTED
  106|       |   /* It is an error to write to a read device */
  107|  9.49k|   if (png_ptr->write_data_fn != NULL)
  ------------------
  |  Branch (107:8): [True: 0, False: 9.49k]
  ------------------
  108|      0|   {
  109|      0|      png_ptr->write_data_fn = NULL;
  110|      0|      png_warning(png_ptr,
  111|      0|          "Can't set both read_data_fn and write_data_fn in the"
  112|      0|          " same structure");
  113|      0|   }
  114|  9.49k|#endif
  115|       |
  116|  9.49k|#ifdef PNG_WRITE_FLUSH_SUPPORTED
  117|  9.49k|   png_ptr->output_flush_fn = NULL;
  118|  9.49k|#endif
  119|  9.49k|}

png_set_palette_to_rgb:
  899|     84|{
  900|     84|   png_debug(1, "in png_set_palette_to_rgb");
  ------------------
  |  |  145|     84|#  define png_debug(l, m) ((void)0)
  ------------------
  901|       |
  902|     84|   if (png_rtran_ok(png_ptr, 0) == 0)
  ------------------
  |  Branch (902:8): [True: 0, False: 84]
  ------------------
  903|      0|      return;
  904|       |
  905|     84|   png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
  ------------------
  |  |  679|     84|#define PNG_EXPAND              0x1000U
  ------------------
                 png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
  ------------------
  |  |  693|     84|#define PNG_EXPAND_tRNS      0x2000000U /* Added to libpng-1.2.9 */
  ------------------
  906|     84|}
png_set_expand_gray_1_2_4_to_8:
  911|    295|{
  912|    295|   png_debug(1, "in png_set_expand_gray_1_2_4_to_8");
  ------------------
  |  |  145|    295|#  define png_debug(l, m) ((void)0)
  ------------------
  913|       |
  914|    295|   if (png_rtran_ok(png_ptr, 0) == 0)
  ------------------
  |  Branch (914:8): [True: 0, False: 295]
  ------------------
  915|      0|      return;
  916|       |
  917|    295|   png_ptr->transformations |= PNG_EXPAND;
  ------------------
  |  |  679|    295|#define PNG_EXPAND              0x1000U
  ------------------
  918|    295|}
png_set_tRNS_to_alpha:
  923|    216|{
  924|    216|   png_debug(1, "in png_set_tRNS_to_alpha");
  ------------------
  |  |  145|    216|#  define png_debug(l, m) ((void)0)
  ------------------
  925|       |
  926|    216|   if (png_rtran_ok(png_ptr, 0) == 0)
  ------------------
  |  Branch (926:8): [True: 0, False: 216]
  ------------------
  927|      0|      return;
  928|       |
  929|    216|   png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
  ------------------
  |  |  679|    216|#define PNG_EXPAND              0x1000U
  ------------------
                 png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
  ------------------
  |  |  693|    216|#define PNG_EXPAND_tRNS      0x2000000U /* Added to libpng-1.2.9 */
  ------------------
  930|    216|}
png_set_gray_to_rgb:
  952|    163|{
  953|    163|   png_debug(1, "in png_set_gray_to_rgb");
  ------------------
  |  |  145|    163|#  define png_debug(l, m) ((void)0)
  ------------------
  954|       |
  955|    163|   if (png_rtran_ok(png_ptr, 0) == 0)
  ------------------
  |  Branch (955:8): [True: 0, False: 163]
  ------------------
  956|      0|      return;
  957|       |
  958|       |   /* Because rgb must be 8 bits or more: */
  959|    163|   png_set_expand_gray_1_2_4_to_8(png_ptr);
  960|    163|   png_ptr->transformations |= PNG_GRAY_TO_RGB;
  ------------------
  |  |  681|    163|#define PNG_GRAY_TO_RGB         0x4000U
  ------------------
  961|    163|}
png_set_read_user_transform_fn:
 1071|    341|{
 1072|    341|   png_debug(1, "in png_set_read_user_transform_fn");
  ------------------
  |  |  145|    341|#  define png_debug(l, m) ((void)0)
  ------------------
 1073|       |
 1074|    341|#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
 1075|    341|   png_ptr->transformations |= PNG_USER_TRANSFORM;
  ------------------
  |  |  687|    341|#define PNG_USER_TRANSFORM    0x100000U
  ------------------
 1076|    341|   png_ptr->read_user_transform_fn = read_user_transform_fn;
 1077|    341|#endif
 1078|    341|}
png_init_read_transformations:
 1288|  1.01k|{
 1289|  1.01k|   png_debug(1, "in png_init_read_transformations");
  ------------------
  |  |  145|  1.01k|#  define png_debug(l, m) ((void)0)
  ------------------
 1290|       |
 1291|       |   /* This internal function is called from png_read_start_row in pngrutil.c
 1292|       |    * and it is called before the 'rowbytes' calculation is done, so the code
 1293|       |    * in here can change or update the transformations flags.
 1294|       |    *
 1295|       |    * First do updates that do not depend on the details of the PNG image data
 1296|       |    * being processed.
 1297|       |    */
 1298|       |
 1299|  1.01k|#ifdef PNG_READ_GAMMA_SUPPORTED
 1300|       |   /* Prior to 1.5.4 these tests were performed from png_set_gamma, 1.5.4 adds
 1301|       |    * png_set_alpha_mode and this is another source for a default file gamma so
 1302|       |    * the test needs to be performed later - here.  In addition prior to 1.5.4
 1303|       |    * the tests were repeated for the PALETTE color type here - this is no
 1304|       |    * longer necessary (and doesn't seem to have been necessary before.)
 1305|       |    */
 1306|  1.01k|   {
 1307|       |      /* The following temporary indicates if overall gamma correction is
 1308|       |       * required.
 1309|       |       */
 1310|  1.01k|      int gamma_correction = 0;
 1311|       |
 1312|  1.01k|      if (png_ptr->colorspace.gamma != 0) /* has been set */
  ------------------
  |  Branch (1312:11): [True: 21, False: 990]
  ------------------
 1313|     21|      {
 1314|     21|         if (png_ptr->screen_gamma != 0) /* screen set too */
  ------------------
  |  Branch (1314:14): [True: 0, False: 21]
  ------------------
 1315|      0|            gamma_correction = png_gamma_threshold(png_ptr->colorspace.gamma,
 1316|      0|                png_ptr->screen_gamma);
 1317|       |
 1318|     21|         else
 1319|       |            /* Assume the output matches the input; a long time default behavior
 1320|       |             * of libpng, although the standard has nothing to say about this.
 1321|       |             */
 1322|     21|            png_ptr->screen_gamma = png_reciprocal(png_ptr->colorspace.gamma);
 1323|     21|      }
 1324|       |
 1325|    990|      else if (png_ptr->screen_gamma != 0)
  ------------------
  |  Branch (1325:16): [True: 0, False: 990]
  ------------------
 1326|       |         /* The converse - assume the file matches the screen, note that this
 1327|       |          * perhaps undesirable default can (from 1.5.4) be changed by calling
 1328|       |          * png_set_alpha_mode (even if the alpha handling mode isn't required
 1329|       |          * or isn't changed from the default.)
 1330|       |          */
 1331|      0|         png_ptr->colorspace.gamma = png_reciprocal(png_ptr->screen_gamma);
 1332|       |
 1333|    990|      else /* neither are set */
 1334|       |         /* Just in case the following prevents any processing - file and screen
 1335|       |          * are both assumed to be linear and there is no way to introduce a
 1336|       |          * third gamma value other than png_set_background with 'UNIQUE', and,
 1337|       |          * prior to 1.5.4
 1338|       |          */
 1339|    990|         png_ptr->screen_gamma = png_ptr->colorspace.gamma = PNG_FP_1;
  ------------------
  |  |  655|    990|#define PNG_FP_1    100000
  ------------------
 1340|       |
 1341|       |      /* We have a gamma value now. */
 1342|  1.01k|      png_ptr->colorspace.flags |= PNG_COLORSPACE_HAVE_GAMMA;
  ------------------
  |  |  131|  1.01k|#define PNG_COLORSPACE_HAVE_GAMMA           0x0001
  ------------------
 1343|       |
 1344|       |      /* Now turn the gamma transformation on or off as appropriate.  Notice
 1345|       |       * that PNG_GAMMA just refers to the file->screen correction.  Alpha
 1346|       |       * composition may independently cause gamma correction because it needs
 1347|       |       * linear data (e.g. if the file has a gAMA chunk but the screen gamma
 1348|       |       * hasn't been specified.)  In any case this flag may get turned off in
 1349|       |       * the code immediately below if the transform can be handled outside the
 1350|       |       * row loop.
 1351|       |       */
 1352|  1.01k|      if (gamma_correction != 0)
  ------------------
  |  Branch (1352:11): [True: 0, False: 1.01k]
  ------------------
 1353|      0|         png_ptr->transformations |= PNG_GAMMA;
  ------------------
  |  |  680|      0|#define PNG_GAMMA               0x2000U
  ------------------
 1354|       |
 1355|  1.01k|      else
 1356|  1.01k|         png_ptr->transformations &= ~PNG_GAMMA;
  ------------------
  |  |  680|  1.01k|#define PNG_GAMMA               0x2000U
  ------------------
 1357|  1.01k|   }
 1358|  1.01k|#endif
 1359|       |
 1360|       |   /* Certain transformations have the effect of preventing other
 1361|       |    * transformations that happen afterward in png_do_read_transformations;
 1362|       |    * resolve the interdependencies here.  From the code of
 1363|       |    * png_do_read_transformations the order is:
 1364|       |    *
 1365|       |    *  1) PNG_EXPAND (including PNG_EXPAND_tRNS)
 1366|       |    *  2) PNG_STRIP_ALPHA (if no compose)
 1367|       |    *  3) PNG_RGB_TO_GRAY
 1368|       |    *  4) PNG_GRAY_TO_RGB iff !PNG_BACKGROUND_IS_GRAY
 1369|       |    *  5) PNG_COMPOSE
 1370|       |    *  6) PNG_GAMMA
 1371|       |    *  7) PNG_STRIP_ALPHA (if compose)
 1372|       |    *  8) PNG_ENCODE_ALPHA
 1373|       |    *  9) PNG_SCALE_16_TO_8
 1374|       |    * 10) PNG_16_TO_8
 1375|       |    * 11) PNG_QUANTIZE (converts to palette)
 1376|       |    * 12) PNG_EXPAND_16
 1377|       |    * 13) PNG_GRAY_TO_RGB iff PNG_BACKGROUND_IS_GRAY
 1378|       |    * 14) PNG_INVERT_MONO
 1379|       |    * 15) PNG_INVERT_ALPHA
 1380|       |    * 16) PNG_SHIFT
 1381|       |    * 17) PNG_PACK
 1382|       |    * 18) PNG_BGR
 1383|       |    * 19) PNG_PACKSWAP
 1384|       |    * 20) PNG_FILLER (includes PNG_ADD_ALPHA)
 1385|       |    * 21) PNG_SWAP_ALPHA
 1386|       |    * 22) PNG_SWAP_BYTES
 1387|       |    * 23) PNG_USER_TRANSFORM [must be last]
 1388|       |    */
 1389|  1.01k|#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
 1390|  1.01k|   if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0 &&
  ------------------
  |  |  685|  1.01k|#define PNG_STRIP_ALPHA        0x40000U
  ------------------
  |  Branch (1390:8): [True: 0, False: 1.01k]
  ------------------
 1391|  1.01k|       (png_ptr->transformations & PNG_COMPOSE) == 0)
  ------------------
  |  |  674|      0|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (1391:8): [True: 0, False: 0]
  ------------------
 1392|      0|   {
 1393|       |      /* Stripping the alpha channel happens immediately after the 'expand'
 1394|       |       * transformations, before all other transformation, so it cancels out
 1395|       |       * the alpha handling.  It has the side effect negating the effect of
 1396|       |       * PNG_EXPAND_tRNS too:
 1397|       |       */
 1398|      0|      png_ptr->transformations &= ~(PNG_BACKGROUND_EXPAND | PNG_ENCODE_ALPHA |
  ------------------
  |  |  675|      0|#define PNG_BACKGROUND_EXPAND   0x0100U
  ------------------
                    png_ptr->transformations &= ~(PNG_BACKGROUND_EXPAND | PNG_ENCODE_ALPHA |
  ------------------
  |  |  691|      0|#define PNG_ENCODE_ALPHA      0x800000U /* Added to libpng-1.5.4 */
  ------------------
 1399|      0|         PNG_EXPAND_tRNS);
  ------------------
  |  |  693|      0|#define PNG_EXPAND_tRNS      0x2000000U /* Added to libpng-1.2.9 */
  ------------------
 1400|      0|      png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
  ------------------
  |  |  717|      0|#define PNG_FLAG_OPTIMIZE_ALPHA           0x2000U /* Added to libpng-1.5.4 */
  ------------------
 1401|       |
 1402|       |      /* Kill the tRNS chunk itself too.  Prior to 1.5.4 this did not happen
 1403|       |       * so transparency information would remain just so long as it wasn't
 1404|       |       * expanded.  This produces unexpected API changes if the set of things
 1405|       |       * that do PNG_EXPAND_tRNS changes (perfectly possible given the
 1406|       |       * documentation - which says ask for what you want, accept what you
 1407|       |       * get.)  This makes the behavior consistent from 1.5.4:
 1408|       |       */
 1409|      0|      png_ptr->num_trans = 0;
 1410|      0|   }
 1411|  1.01k|#endif /* STRIP_ALPHA supported, no COMPOSE */
 1412|       |
 1413|  1.01k|#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
 1414|       |   /* If the screen gamma is about 1.0 then the OPTIMIZE_ALPHA and ENCODE_ALPHA
 1415|       |    * settings will have no effect.
 1416|       |    */
 1417|  1.01k|   if (png_gamma_significant(png_ptr->screen_gamma) == 0)
  ------------------
  |  Branch (1417:8): [True: 994, False: 17]
  ------------------
 1418|    994|   {
 1419|    994|      png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
  ------------------
  |  |  691|    994|#define PNG_ENCODE_ALPHA      0x800000U /* Added to libpng-1.5.4 */
  ------------------
 1420|    994|      png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
  ------------------
  |  |  717|    994|#define PNG_FLAG_OPTIMIZE_ALPHA           0x2000U /* Added to libpng-1.5.4 */
  ------------------
 1421|    994|   }
 1422|  1.01k|#endif
 1423|       |
 1424|  1.01k|#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 1425|       |   /* Make sure the coefficients for the rgb to gray conversion are set
 1426|       |    * appropriately.
 1427|       |    */
 1428|  1.01k|   if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
  ------------------
  |  |  690|  1.01k|#define PNG_RGB_TO_GRAY       0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
  ------------------
  |  Branch (1428:8): [True: 0, False: 1.01k]
  ------------------
 1429|      0|      png_colorspace_set_rgb_coefficients(png_ptr);
 1430|  1.01k|#endif
 1431|       |
 1432|  1.01k|#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 1433|  1.01k|#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
 1434|       |   /* Detect gray background and attempt to enable optimization for
 1435|       |    * gray --> RGB case.
 1436|       |    *
 1437|       |    * Note:  if PNG_BACKGROUND_EXPAND is set and color_type is either RGB or
 1438|       |    * RGB_ALPHA (in which case need_expand is superfluous anyway), the
 1439|       |    * background color might actually be gray yet not be flagged as such.
 1440|       |    * This is not a problem for the current code, which uses
 1441|       |    * PNG_BACKGROUND_IS_GRAY only to decide when to do the
 1442|       |    * png_do_gray_to_rgb() transformation.
 1443|       |    *
 1444|       |    * TODO: this code needs to be revised to avoid the complexity and
 1445|       |    * interdependencies.  The color type of the background should be recorded in
 1446|       |    * png_set_background, along with the bit depth, then the code has a record
 1447|       |    * of exactly what color space the background is currently in.
 1448|       |    */
 1449|  1.01k|   if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) != 0)
  ------------------
  |  |  675|  1.01k|#define PNG_BACKGROUND_EXPAND   0x0100U
  ------------------
  |  Branch (1449:8): [True: 0, False: 1.01k]
  ------------------
 1450|      0|   {
 1451|       |      /* PNG_BACKGROUND_EXPAND: the background is in the file color space, so if
 1452|       |       * the file was grayscale the background value is gray.
 1453|       |       */
 1454|      0|      if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
  ------------------
  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (1454:11): [True: 0, False: 0]
  ------------------
 1455|      0|         png_ptr->mode |= PNG_BACKGROUND_IS_GRAY;
  ------------------
  |  |  660|      0|#define PNG_BACKGROUND_IS_GRAY     0x800U
  ------------------
 1456|      0|   }
 1457|       |
 1458|  1.01k|   else if ((png_ptr->transformations & PNG_COMPOSE) != 0)
  ------------------
  |  |  674|  1.01k|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (1458:13): [True: 0, False: 1.01k]
  ------------------
 1459|      0|   {
 1460|       |      /* PNG_COMPOSE: png_set_background was called with need_expand false,
 1461|       |       * so the color is in the color space of the output or png_set_alpha_mode
 1462|       |       * was called and the color is black.  Ignore RGB_TO_GRAY because that
 1463|       |       * happens before GRAY_TO_RGB.
 1464|       |       */
 1465|      0|      if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0)
  ------------------
  |  |  681|      0|#define PNG_GRAY_TO_RGB         0x4000U
  ------------------
  |  Branch (1465:11): [True: 0, False: 0]
  ------------------
 1466|      0|      {
 1467|      0|         if (png_ptr->background.red == png_ptr->background.green &&
  ------------------
  |  Branch (1467:14): [True: 0, False: 0]
  ------------------
 1468|      0|             png_ptr->background.red == png_ptr->background.blue)
  ------------------
  |  Branch (1468:14): [True: 0, False: 0]
  ------------------
 1469|      0|         {
 1470|      0|            png_ptr->mode |= PNG_BACKGROUND_IS_GRAY;
  ------------------
  |  |  660|      0|#define PNG_BACKGROUND_IS_GRAY     0x800U
  ------------------
 1471|      0|            png_ptr->background.gray = png_ptr->background.red;
 1472|      0|         }
 1473|      0|      }
 1474|      0|   }
 1475|  1.01k|#endif /* READ_EXPAND && READ_BACKGROUND */
 1476|  1.01k|#endif /* READ_GRAY_TO_RGB */
 1477|       |
 1478|       |   /* For indexed PNG data (PNG_COLOR_TYPE_PALETTE) many of the transformations
 1479|       |    * can be performed directly on the palette, and some (such as rgb to gray)
 1480|       |    * can be optimized inside the palette.  This is particularly true of the
 1481|       |    * composite (background and alpha) stuff, which can be pretty much all done
 1482|       |    * in the palette even if the result is expanded to RGB or gray afterward.
 1483|       |    *
 1484|       |    * NOTE: this is Not Yet Implemented, the code behaves as in 1.5.1 and
 1485|       |    * earlier and the palette stuff is actually handled on the first row.  This
 1486|       |    * leads to the reported bug that the palette returned by png_get_PLTE is not
 1487|       |    * updated.
 1488|       |    */
 1489|  1.01k|   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|  1.01k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  1.01k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  1.01k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1489:8): [True: 84, False: 927]
  ------------------
 1490|     84|      png_init_palette_transformations(png_ptr);
 1491|       |
 1492|    927|   else
 1493|    927|      png_init_rgb_transformations(png_ptr);
 1494|       |
 1495|  1.01k|#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
 1496|  1.01k|   defined(PNG_READ_EXPAND_16_SUPPORTED)
 1497|  1.01k|   if ((png_ptr->transformations & PNG_EXPAND_16) != 0 &&
  ------------------
  |  |  676|  1.01k|#define PNG_EXPAND_16           0x0200U    /* Added to libpng 1.5.2 */
  ------------------
  |  Branch (1497:8): [True: 0, False: 1.01k]
  ------------------
 1498|  1.01k|       (png_ptr->transformations & PNG_COMPOSE) != 0 &&
  ------------------
  |  |  674|      0|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (1498:8): [True: 0, False: 0]
  ------------------
 1499|  1.01k|       (png_ptr->transformations & PNG_BACKGROUND_EXPAND) == 0 &&
  ------------------
  |  |  675|      0|#define PNG_BACKGROUND_EXPAND   0x0100U
  ------------------
  |  Branch (1499:8): [True: 0, False: 0]
  ------------------
 1500|  1.01k|       png_ptr->bit_depth != 16)
  ------------------
  |  Branch (1500:8): [True: 0, False: 0]
  ------------------
 1501|      0|   {
 1502|       |      /* TODO: fix this.  Because the expand_16 operation is after the compose
 1503|       |       * handling the background color must be 8, not 16, bits deep, but the
 1504|       |       * application will supply a 16-bit value so reduce it here.
 1505|       |       *
 1506|       |       * The PNG_BACKGROUND_EXPAND code above does not expand to 16 bits at
 1507|       |       * present, so that case is ok (until do_expand_16 is moved.)
 1508|       |       *
 1509|       |       * NOTE: this discards the low 16 bits of the user supplied background
 1510|       |       * color, but until expand_16 works properly there is no choice!
 1511|       |       */
 1512|      0|#     define CHOP(x) (x)=((png_uint_16)PNG_DIV257(x))
 1513|      0|      CHOP(png_ptr->background.red);
  ------------------
  |  | 1512|      0|#     define CHOP(x) (x)=((png_uint_16)PNG_DIV257(x))
  |  |  ------------------
  |  |  |  |  760|      0|#define PNG_DIV257(v16) PNG_DIV65535((png_uint_32)(v16) * 255)
  |  |  |  |  ------------------
  |  |  |  |  |  |  759|      0|#define PNG_DIV65535(v24) (((v24) + 32895) >> 16)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1514|      0|      CHOP(png_ptr->background.green);
  ------------------
  |  | 1512|      0|#     define CHOP(x) (x)=((png_uint_16)PNG_DIV257(x))
  |  |  ------------------
  |  |  |  |  760|      0|#define PNG_DIV257(v16) PNG_DIV65535((png_uint_32)(v16) * 255)
  |  |  |  |  ------------------
  |  |  |  |  |  |  759|      0|#define PNG_DIV65535(v24) (((v24) + 32895) >> 16)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1515|      0|      CHOP(png_ptr->background.blue);
  ------------------
  |  | 1512|      0|#     define CHOP(x) (x)=((png_uint_16)PNG_DIV257(x))
  |  |  ------------------
  |  |  |  |  760|      0|#define PNG_DIV257(v16) PNG_DIV65535((png_uint_32)(v16) * 255)
  |  |  |  |  ------------------
  |  |  |  |  |  |  759|      0|#define PNG_DIV65535(v24) (((v24) + 32895) >> 16)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1516|      0|      CHOP(png_ptr->background.gray);
  ------------------
  |  | 1512|      0|#     define CHOP(x) (x)=((png_uint_16)PNG_DIV257(x))
  |  |  ------------------
  |  |  |  |  760|      0|#define PNG_DIV257(v16) PNG_DIV65535((png_uint_32)(v16) * 255)
  |  |  |  |  ------------------
  |  |  |  |  |  |  759|      0|#define PNG_DIV65535(v24) (((v24) + 32895) >> 16)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1517|      0|#     undef CHOP
 1518|      0|   }
 1519|  1.01k|#endif /* READ_BACKGROUND && READ_EXPAND_16 */
 1520|       |
 1521|  1.01k|#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
 1522|  1.01k|   (defined(PNG_READ_SCALE_16_TO_8_SUPPORTED) || \
 1523|  1.01k|   defined(PNG_READ_STRIP_16_TO_8_SUPPORTED))
 1524|  1.01k|   if ((png_ptr->transformations & (PNG_16_TO_8|PNG_SCALE_16_TO_8)) != 0 &&
  ------------------
  |  |  677|  1.01k|#define PNG_16_TO_8             0x0400U    /* Becomes 'chop' in 1.5.4 */
  ------------------
                 if ((png_ptr->transformations & (PNG_16_TO_8|PNG_SCALE_16_TO_8)) != 0 &&
  ------------------
  |  |  694|  1.01k|#define PNG_SCALE_16_TO_8    0x4000000U /* Added to libpng-1.5.4 */
  ------------------
  |  Branch (1524:8): [True: 0, False: 1.01k]
  ------------------
 1525|  1.01k|       (png_ptr->transformations & PNG_COMPOSE) != 0 &&
  ------------------
  |  |  674|      0|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (1525:8): [True: 0, False: 0]
  ------------------
 1526|  1.01k|       (png_ptr->transformations & PNG_BACKGROUND_EXPAND) == 0 &&
  ------------------
  |  |  675|      0|#define PNG_BACKGROUND_EXPAND   0x0100U
  ------------------
  |  Branch (1526:8): [True: 0, False: 0]
  ------------------
 1527|  1.01k|       png_ptr->bit_depth == 16)
  ------------------
  |  Branch (1527:8): [True: 0, False: 0]
  ------------------
 1528|      0|   {
 1529|       |      /* On the other hand, if a 16-bit file is to be reduced to 8-bits per
 1530|       |       * component this will also happen after PNG_COMPOSE and so the background
 1531|       |       * color must be pre-expanded here.
 1532|       |       *
 1533|       |       * TODO: fix this too.
 1534|       |       */
 1535|      0|      png_ptr->background.red = (png_uint_16)(png_ptr->background.red * 257);
 1536|      0|      png_ptr->background.green =
 1537|      0|         (png_uint_16)(png_ptr->background.green * 257);
 1538|      0|      png_ptr->background.blue = (png_uint_16)(png_ptr->background.blue * 257);
 1539|      0|      png_ptr->background.gray = (png_uint_16)(png_ptr->background.gray * 257);
 1540|      0|   }
 1541|  1.01k|#endif
 1542|       |
 1543|       |   /* NOTE: below 'PNG_READ_ALPHA_MODE_SUPPORTED' is presumed to also enable the
 1544|       |    * background support (see the comments in scripts/pnglibconf.dfa), this
 1545|       |    * allows pre-multiplication of the alpha channel to be implemented as
 1546|       |    * compositing on black.  This is probably sub-optimal and has been done in
 1547|       |    * 1.5.4 betas simply to enable external critique and testing (i.e. to
 1548|       |    * implement the new API quickly, without lots of internal changes.)
 1549|       |    */
 1550|       |
 1551|  1.01k|#ifdef PNG_READ_GAMMA_SUPPORTED
 1552|  1.01k|#  ifdef PNG_READ_BACKGROUND_SUPPORTED
 1553|       |      /* Includes ALPHA_MODE */
 1554|  1.01k|      png_ptr->background_1 = png_ptr->background;
 1555|  1.01k|#  endif
 1556|       |
 1557|       |   /* This needs to change - in the palette image case a whole set of tables are
 1558|       |    * built when it would be quicker to just calculate the correct value for
 1559|       |    * each palette entry directly.  Also, the test is too tricky - why check
 1560|       |    * PNG_RGB_TO_GRAY if PNG_GAMMA is not set?  The answer seems to be that
 1561|       |    * PNG_GAMMA is cancelled even if the gamma is known?  The test excludes the
 1562|       |    * PNG_COMPOSE case, so apparently if there is no *overall* gamma correction
 1563|       |    * the gamma tables will not be built even if composition is required on a
 1564|       |    * gamma encoded value.
 1565|       |    *
 1566|       |    * In 1.5.4 this is addressed below by an additional check on the individual
 1567|       |    * file gamma - if it is not 1.0 both RGB_TO_GRAY and COMPOSE need the
 1568|       |    * tables.
 1569|       |    */
 1570|  1.01k|   if ((png_ptr->transformations & PNG_GAMMA) != 0 ||
  ------------------
  |  |  680|  1.01k|#define PNG_GAMMA               0x2000U
  ------------------
  |  Branch (1570:8): [True: 0, False: 1.01k]
  ------------------
 1571|  1.01k|       ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0 &&
  ------------------
  |  |  690|  1.01k|#define PNG_RGB_TO_GRAY       0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
  ------------------
  |  Branch (1571:9): [True: 0, False: 1.01k]
  ------------------
 1572|  1.01k|        (png_gamma_significant(png_ptr->colorspace.gamma) != 0 ||
  ------------------
  |  Branch (1572:10): [True: 0, False: 0]
  ------------------
 1573|      0|         png_gamma_significant(png_ptr->screen_gamma) != 0)) ||
  ------------------
  |  Branch (1573:10): [True: 0, False: 0]
  ------------------
 1574|  1.01k|        ((png_ptr->transformations & PNG_COMPOSE) != 0 &&
  ------------------
  |  |  674|  1.01k|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (1574:10): [True: 0, False: 1.01k]
  ------------------
 1575|  1.01k|         (png_gamma_significant(png_ptr->colorspace.gamma) != 0 ||
  ------------------
  |  Branch (1575:11): [True: 0, False: 0]
  ------------------
 1576|      0|          png_gamma_significant(png_ptr->screen_gamma) != 0
  ------------------
  |  Branch (1576:11): [True: 0, False: 0]
  ------------------
 1577|      0|#  ifdef PNG_READ_BACKGROUND_SUPPORTED
 1578|      0|         || (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_UNIQUE &&
  ------------------
  |  | 1309|      0|#  define PNG_BACKGROUND_GAMMA_UNIQUE  3
  ------------------
  |  Branch (1578:14): [True: 0, False: 0]
  ------------------
 1579|      0|           png_gamma_significant(png_ptr->background_gamma) != 0)
  ------------------
  |  Branch (1579:12): [True: 0, False: 0]
  ------------------
 1580|      0|#  endif
 1581|  1.01k|        )) || ((png_ptr->transformations & PNG_ENCODE_ALPHA) != 0 &&
  ------------------
  |  |  691|  1.01k|#define PNG_ENCODE_ALPHA      0x800000U /* Added to libpng-1.5.4 */
  ------------------
  |  Branch (1581:16): [True: 0, False: 1.01k]
  ------------------
 1582|  1.01k|       png_gamma_significant(png_ptr->screen_gamma) != 0))
  ------------------
  |  Branch (1582:8): [True: 0, False: 0]
  ------------------
 1583|      0|   {
 1584|      0|      png_build_gamma_table(png_ptr, png_ptr->bit_depth);
 1585|       |
 1586|      0|#ifdef PNG_READ_BACKGROUND_SUPPORTED
 1587|      0|      if ((png_ptr->transformations & PNG_COMPOSE) != 0)
  ------------------
  |  |  674|      0|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (1587:11): [True: 0, False: 0]
  ------------------
 1588|      0|      {
 1589|       |         /* Issue a warning about this combination: because RGB_TO_GRAY is
 1590|       |          * optimized to do the gamma transform if present yet do_background has
 1591|       |          * to do the same thing if both options are set a
 1592|       |          * double-gamma-correction happens.  This is true in all versions of
 1593|       |          * libpng to date.
 1594|       |          */
 1595|      0|         if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
  ------------------
  |  |  690|      0|#define PNG_RGB_TO_GRAY       0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
  ------------------
  |  Branch (1595:14): [True: 0, False: 0]
  ------------------
 1596|      0|            png_warning(png_ptr,
 1597|      0|                "libpng does not support gamma+background+rgb_to_gray");
 1598|       |
 1599|      0|         if ((png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) != 0)
  ------------------
  |  |  668|      0|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|      0|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1599:14): [True: 0, False: 0]
  ------------------
 1600|      0|         {
 1601|       |            /* We don't get to here unless there is a tRNS chunk with non-opaque
 1602|       |             * entries - see the checking code at the start of this function.
 1603|       |             */
 1604|      0|            png_color back, back_1;
 1605|      0|            png_colorp palette = png_ptr->palette;
 1606|      0|            int num_palette = png_ptr->num_palette;
 1607|      0|            int i;
 1608|      0|            if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_FILE)
  ------------------
  |  | 1308|      0|#  define PNG_BACKGROUND_GAMMA_FILE    2
  ------------------
  |  Branch (1608:17): [True: 0, False: 0]
  ------------------
 1609|      0|            {
 1610|       |
 1611|      0|               back.red = png_ptr->gamma_table[png_ptr->background.red];
 1612|      0|               back.green = png_ptr->gamma_table[png_ptr->background.green];
 1613|      0|               back.blue = png_ptr->gamma_table[png_ptr->background.blue];
 1614|       |
 1615|      0|               back_1.red = png_ptr->gamma_to_1[png_ptr->background.red];
 1616|      0|               back_1.green = png_ptr->gamma_to_1[png_ptr->background.green];
 1617|      0|               back_1.blue = png_ptr->gamma_to_1[png_ptr->background.blue];
 1618|      0|            }
 1619|      0|            else
 1620|      0|            {
 1621|      0|               png_fixed_point g, gs;
 1622|       |
 1623|      0|               switch (png_ptr->background_gamma_type)
 1624|      0|               {
 1625|      0|                  case PNG_BACKGROUND_GAMMA_SCREEN:
  ------------------
  |  | 1307|      0|#  define PNG_BACKGROUND_GAMMA_SCREEN  1
  ------------------
  |  Branch (1625:19): [True: 0, False: 0]
  ------------------
 1626|      0|                     g = (png_ptr->screen_gamma);
 1627|      0|                     gs = PNG_FP_1;
  ------------------
  |  |  655|      0|#define PNG_FP_1    100000
  ------------------
 1628|      0|                     break;
 1629|       |
 1630|      0|                  case PNG_BACKGROUND_GAMMA_FILE:
  ------------------
  |  | 1308|      0|#  define PNG_BACKGROUND_GAMMA_FILE    2
  ------------------
  |  Branch (1630:19): [True: 0, False: 0]
  ------------------
 1631|      0|                     g = png_reciprocal(png_ptr->colorspace.gamma);
 1632|      0|                     gs = png_reciprocal2(png_ptr->colorspace.gamma,
 1633|      0|                         png_ptr->screen_gamma);
 1634|      0|                     break;
 1635|       |
 1636|      0|                  case PNG_BACKGROUND_GAMMA_UNIQUE:
  ------------------
  |  | 1309|      0|#  define PNG_BACKGROUND_GAMMA_UNIQUE  3
  ------------------
  |  Branch (1636:19): [True: 0, False: 0]
  ------------------
 1637|      0|                     g = png_reciprocal(png_ptr->background_gamma);
 1638|      0|                     gs = png_reciprocal2(png_ptr->background_gamma,
 1639|      0|                         png_ptr->screen_gamma);
 1640|      0|                     break;
 1641|      0|                  default:
  ------------------
  |  Branch (1641:19): [True: 0, False: 0]
  ------------------
 1642|      0|                     g = PNG_FP_1;    /* back_1 */
  ------------------
  |  |  655|      0|#define PNG_FP_1    100000
  ------------------
 1643|      0|                     gs = PNG_FP_1;   /* back */
  ------------------
  |  |  655|      0|#define PNG_FP_1    100000
  ------------------
 1644|      0|                     break;
 1645|      0|               }
 1646|       |
 1647|      0|               if (png_gamma_significant(gs) != 0)
  ------------------
  |  Branch (1647:20): [True: 0, False: 0]
  ------------------
 1648|      0|               {
 1649|      0|                  back.red = png_gamma_8bit_correct(png_ptr->background.red,
 1650|      0|                      gs);
 1651|      0|                  back.green = png_gamma_8bit_correct(png_ptr->background.green,
 1652|      0|                      gs);
 1653|      0|                  back.blue = png_gamma_8bit_correct(png_ptr->background.blue,
 1654|      0|                      gs);
 1655|      0|               }
 1656|       |
 1657|      0|               else
 1658|      0|               {
 1659|      0|                  back.red   = (png_byte)png_ptr->background.red;
 1660|      0|                  back.green = (png_byte)png_ptr->background.green;
 1661|      0|                  back.blue  = (png_byte)png_ptr->background.blue;
 1662|      0|               }
 1663|       |
 1664|      0|               if (png_gamma_significant(g) != 0)
  ------------------
  |  Branch (1664:20): [True: 0, False: 0]
  ------------------
 1665|      0|               {
 1666|      0|                  back_1.red = png_gamma_8bit_correct(png_ptr->background.red,
 1667|      0|                      g);
 1668|      0|                  back_1.green = png_gamma_8bit_correct(
 1669|      0|                      png_ptr->background.green, g);
 1670|      0|                  back_1.blue = png_gamma_8bit_correct(png_ptr->background.blue,
 1671|      0|                      g);
 1672|      0|               }
 1673|       |
 1674|      0|               else
 1675|      0|               {
 1676|      0|                  back_1.red   = (png_byte)png_ptr->background.red;
 1677|      0|                  back_1.green = (png_byte)png_ptr->background.green;
 1678|      0|                  back_1.blue  = (png_byte)png_ptr->background.blue;
 1679|      0|               }
 1680|      0|            }
 1681|       |
 1682|      0|            for (i = 0; i < num_palette; i++)
  ------------------
  |  Branch (1682:25): [True: 0, False: 0]
  ------------------
 1683|      0|            {
 1684|      0|               if (i < (int)png_ptr->num_trans &&
  ------------------
  |  Branch (1684:20): [True: 0, False: 0]
  ------------------
 1685|      0|                   png_ptr->trans_alpha[i] != 0xff)
  ------------------
  |  Branch (1685:20): [True: 0, False: 0]
  ------------------
 1686|      0|               {
 1687|      0|                  if (png_ptr->trans_alpha[i] == 0)
  ------------------
  |  Branch (1687:23): [True: 0, False: 0]
  ------------------
 1688|      0|                  {
 1689|      0|                     palette[i] = back;
 1690|      0|                  }
 1691|      0|                  else /* if (png_ptr->trans_alpha[i] != 0xff) */
 1692|      0|                  {
 1693|      0|                     png_byte v, w;
 1694|       |
 1695|      0|                     v = png_ptr->gamma_to_1[palette[i].red];
 1696|      0|                     png_composite(w, v, png_ptr->trans_alpha[i], back_1.red);
  ------------------
  |  | 2507|      0|   {                                                     \
  |  | 2508|      0|      png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
  |  | 2509|      0|          * (png_uint_16)(alpha)                         \
  |  | 2510|      0|          + (png_uint_16)(bg)*(png_uint_16)(255          \
  |  | 2511|      0|          - (png_uint_16)(alpha)) + 128);                \
  |  | 2512|      0|      (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \
  |  | 2513|      0|   }
  ------------------
 1697|      0|                     palette[i].red = png_ptr->gamma_from_1[w];
 1698|       |
 1699|      0|                     v = png_ptr->gamma_to_1[palette[i].green];
 1700|      0|                     png_composite(w, v, png_ptr->trans_alpha[i], back_1.green);
  ------------------
  |  | 2507|      0|   {                                                     \
  |  | 2508|      0|      png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
  |  | 2509|      0|          * (png_uint_16)(alpha)                         \
  |  | 2510|      0|          + (png_uint_16)(bg)*(png_uint_16)(255          \
  |  | 2511|      0|          - (png_uint_16)(alpha)) + 128);                \
  |  | 2512|      0|      (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \
  |  | 2513|      0|   }
  ------------------
 1701|      0|                     palette[i].green = png_ptr->gamma_from_1[w];
 1702|       |
 1703|      0|                     v = png_ptr->gamma_to_1[palette[i].blue];
 1704|      0|                     png_composite(w, v, png_ptr->trans_alpha[i], back_1.blue);
  ------------------
  |  | 2507|      0|   {                                                     \
  |  | 2508|      0|      png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
  |  | 2509|      0|          * (png_uint_16)(alpha)                         \
  |  | 2510|      0|          + (png_uint_16)(bg)*(png_uint_16)(255          \
  |  | 2511|      0|          - (png_uint_16)(alpha)) + 128);                \
  |  | 2512|      0|      (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \
  |  | 2513|      0|   }
  ------------------
 1705|      0|                     palette[i].blue = png_ptr->gamma_from_1[w];
 1706|      0|                  }
 1707|      0|               }
 1708|      0|               else
 1709|      0|               {
 1710|      0|                  palette[i].red = png_ptr->gamma_table[palette[i].red];
 1711|      0|                  palette[i].green = png_ptr->gamma_table[palette[i].green];
 1712|      0|                  palette[i].blue = png_ptr->gamma_table[palette[i].blue];
 1713|      0|               }
 1714|      0|            }
 1715|       |
 1716|       |            /* Prevent the transformations being done again.
 1717|       |             *
 1718|       |             * NOTE: this is highly dubious; it removes the transformations in
 1719|       |             * place.  This seems inconsistent with the general treatment of the
 1720|       |             * transformations elsewhere.
 1721|       |             */
 1722|      0|            png_ptr->transformations &= ~(PNG_COMPOSE | PNG_GAMMA);
  ------------------
  |  |  674|      0|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
                          png_ptr->transformations &= ~(PNG_COMPOSE | PNG_GAMMA);
  ------------------
  |  |  680|      0|#define PNG_GAMMA               0x2000U
  ------------------
 1723|      0|         } /* color_type == PNG_COLOR_TYPE_PALETTE */
 1724|       |
 1725|       |         /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */
 1726|      0|         else /* color_type != PNG_COLOR_TYPE_PALETTE */
 1727|      0|         {
 1728|      0|            int gs_sig, g_sig;
 1729|      0|            png_fixed_point g = PNG_FP_1;  /* Correction to linear */
  ------------------
  |  |  655|      0|#define PNG_FP_1    100000
  ------------------
 1730|      0|            png_fixed_point gs = PNG_FP_1; /* Correction to screen */
  ------------------
  |  |  655|      0|#define PNG_FP_1    100000
  ------------------
 1731|       |
 1732|      0|            switch (png_ptr->background_gamma_type)
 1733|      0|            {
 1734|      0|               case PNG_BACKGROUND_GAMMA_SCREEN:
  ------------------
  |  | 1307|      0|#  define PNG_BACKGROUND_GAMMA_SCREEN  1
  ------------------
  |  Branch (1734:16): [True: 0, False: 0]
  ------------------
 1735|      0|                  g = png_ptr->screen_gamma;
 1736|       |                  /* gs = PNG_FP_1; */
 1737|      0|                  break;
 1738|       |
 1739|      0|               case PNG_BACKGROUND_GAMMA_FILE:
  ------------------
  |  | 1308|      0|#  define PNG_BACKGROUND_GAMMA_FILE    2
  ------------------
  |  Branch (1739:16): [True: 0, False: 0]
  ------------------
 1740|      0|                  g = png_reciprocal(png_ptr->colorspace.gamma);
 1741|      0|                  gs = png_reciprocal2(png_ptr->colorspace.gamma,
 1742|      0|                      png_ptr->screen_gamma);
 1743|      0|                  break;
 1744|       |
 1745|      0|               case PNG_BACKGROUND_GAMMA_UNIQUE:
  ------------------
  |  | 1309|      0|#  define PNG_BACKGROUND_GAMMA_UNIQUE  3
  ------------------
  |  Branch (1745:16): [True: 0, False: 0]
  ------------------
 1746|      0|                  g = png_reciprocal(png_ptr->background_gamma);
 1747|      0|                  gs = png_reciprocal2(png_ptr->background_gamma,
 1748|      0|                      png_ptr->screen_gamma);
 1749|      0|                  break;
 1750|       |
 1751|      0|               default:
  ------------------
  |  Branch (1751:16): [True: 0, False: 0]
  ------------------
 1752|      0|                  png_error(png_ptr, "invalid background gamma type");
 1753|      0|            }
 1754|       |
 1755|      0|            g_sig = png_gamma_significant(g);
 1756|      0|            gs_sig = png_gamma_significant(gs);
 1757|       |
 1758|      0|            if (g_sig != 0)
  ------------------
  |  Branch (1758:17): [True: 0, False: 0]
  ------------------
 1759|      0|               png_ptr->background_1.gray = png_gamma_correct(png_ptr,
 1760|      0|                   png_ptr->background.gray, g);
 1761|       |
 1762|      0|            if (gs_sig != 0)
  ------------------
  |  Branch (1762:17): [True: 0, False: 0]
  ------------------
 1763|      0|               png_ptr->background.gray = png_gamma_correct(png_ptr,
 1764|      0|                   png_ptr->background.gray, gs);
 1765|       |
 1766|      0|            if ((png_ptr->background.red != png_ptr->background.green) ||
  ------------------
  |  Branch (1766:17): [True: 0, False: 0]
  ------------------
 1767|      0|                (png_ptr->background.red != png_ptr->background.blue) ||
  ------------------
  |  Branch (1767:17): [True: 0, False: 0]
  ------------------
 1768|      0|                (png_ptr->background.red != png_ptr->background.gray))
  ------------------
  |  Branch (1768:17): [True: 0, False: 0]
  ------------------
 1769|      0|            {
 1770|       |               /* RGB or RGBA with color background */
 1771|      0|               if (g_sig != 0)
  ------------------
  |  Branch (1771:20): [True: 0, False: 0]
  ------------------
 1772|      0|               {
 1773|      0|                  png_ptr->background_1.red = png_gamma_correct(png_ptr,
 1774|      0|                      png_ptr->background.red, g);
 1775|       |
 1776|      0|                  png_ptr->background_1.green = png_gamma_correct(png_ptr,
 1777|      0|                      png_ptr->background.green, g);
 1778|       |
 1779|      0|                  png_ptr->background_1.blue = png_gamma_correct(png_ptr,
 1780|      0|                      png_ptr->background.blue, g);
 1781|      0|               }
 1782|       |
 1783|      0|               if (gs_sig != 0)
  ------------------
  |  Branch (1783:20): [True: 0, False: 0]
  ------------------
 1784|      0|               {
 1785|      0|                  png_ptr->background.red = png_gamma_correct(png_ptr,
 1786|      0|                      png_ptr->background.red, gs);
 1787|       |
 1788|      0|                  png_ptr->background.green = png_gamma_correct(png_ptr,
 1789|      0|                      png_ptr->background.green, gs);
 1790|       |
 1791|      0|                  png_ptr->background.blue = png_gamma_correct(png_ptr,
 1792|      0|                      png_ptr->background.blue, gs);
 1793|      0|               }
 1794|      0|            }
 1795|       |
 1796|      0|            else
 1797|      0|            {
 1798|       |               /* GRAY, GRAY ALPHA, RGB, or RGBA with gray background */
 1799|      0|               png_ptr->background_1.red = png_ptr->background_1.green
 1800|      0|                   = png_ptr->background_1.blue = png_ptr->background_1.gray;
 1801|       |
 1802|      0|               png_ptr->background.red = png_ptr->background.green
 1803|      0|                   = png_ptr->background.blue = png_ptr->background.gray;
 1804|      0|            }
 1805|       |
 1806|       |            /* The background is now in screen gamma: */
 1807|      0|            png_ptr->background_gamma_type = PNG_BACKGROUND_GAMMA_SCREEN;
  ------------------
  |  | 1307|      0|#  define PNG_BACKGROUND_GAMMA_SCREEN  1
  ------------------
 1808|      0|         } /* color_type != PNG_COLOR_TYPE_PALETTE */
 1809|      0|      }/* png_ptr->transformations & PNG_BACKGROUND */
 1810|       |
 1811|      0|      else
 1812|       |      /* Transformation does not include PNG_BACKGROUND */
 1813|      0|#endif /* READ_BACKGROUND */
 1814|      0|      if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE
  ------------------
  |  |  668|      0|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|      0|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1814:11): [True: 0, False: 0]
  ------------------
 1815|      0|#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 1816|       |         /* RGB_TO_GRAY needs to have non-gamma-corrected values! */
 1817|      0|         && ((png_ptr->transformations & PNG_EXPAND) == 0 ||
  ------------------
  |  |  679|      0|#define PNG_EXPAND              0x1000U
  ------------------
  |  Branch (1817:14): [True: 0, False: 0]
  ------------------
 1818|      0|         (png_ptr->transformations & PNG_RGB_TO_GRAY) == 0)
  ------------------
  |  |  690|      0|#define PNG_RGB_TO_GRAY       0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
  ------------------
  |  Branch (1818:10): [True: 0, False: 0]
  ------------------
 1819|      0|#endif
 1820|      0|         )
 1821|      0|      {
 1822|      0|         png_colorp palette = png_ptr->palette;
 1823|      0|         int num_palette = png_ptr->num_palette;
 1824|      0|         int i;
 1825|       |
 1826|       |         /* NOTE: there are other transformations that should probably be in
 1827|       |          * here too.
 1828|       |          */
 1829|      0|         for (i = 0; i < num_palette; i++)
  ------------------
  |  Branch (1829:22): [True: 0, False: 0]
  ------------------
 1830|      0|         {
 1831|      0|            palette[i].red = png_ptr->gamma_table[palette[i].red];
 1832|      0|            palette[i].green = png_ptr->gamma_table[palette[i].green];
 1833|      0|            palette[i].blue = png_ptr->gamma_table[palette[i].blue];
 1834|      0|         }
 1835|       |
 1836|       |         /* Done the gamma correction. */
 1837|      0|         png_ptr->transformations &= ~PNG_GAMMA;
  ------------------
  |  |  680|      0|#define PNG_GAMMA               0x2000U
  ------------------
 1838|      0|      } /* color_type == PALETTE && !PNG_BACKGROUND transformation */
 1839|      0|   }
 1840|  1.01k|#ifdef PNG_READ_BACKGROUND_SUPPORTED
 1841|  1.01k|   else
 1842|  1.01k|#endif
 1843|  1.01k|#endif /* READ_GAMMA */
 1844|       |
 1845|  1.01k|#ifdef PNG_READ_BACKGROUND_SUPPORTED
 1846|       |   /* No GAMMA transformation (see the hanging else 4 lines above) */
 1847|  1.01k|   if ((png_ptr->transformations & PNG_COMPOSE) != 0 &&
  ------------------
  |  |  674|  1.01k|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (1847:8): [True: 0, False: 1.01k]
  ------------------
 1848|  1.01k|       (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
  ------------------
  |  |  668|      0|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|      0|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1848:8): [True: 0, False: 0]
  ------------------
 1849|      0|   {
 1850|      0|      int i;
 1851|      0|      int istop = (int)png_ptr->num_trans;
 1852|      0|      png_color back;
 1853|      0|      png_colorp palette = png_ptr->palette;
 1854|       |
 1855|      0|      back.red   = (png_byte)png_ptr->background.red;
 1856|      0|      back.green = (png_byte)png_ptr->background.green;
 1857|      0|      back.blue  = (png_byte)png_ptr->background.blue;
 1858|       |
 1859|      0|      for (i = 0; i < istop; i++)
  ------------------
  |  Branch (1859:19): [True: 0, False: 0]
  ------------------
 1860|      0|      {
 1861|      0|         if (png_ptr->trans_alpha[i] == 0)
  ------------------
  |  Branch (1861:14): [True: 0, False: 0]
  ------------------
 1862|      0|         {
 1863|      0|            palette[i] = back;
 1864|      0|         }
 1865|       |
 1866|      0|         else if (png_ptr->trans_alpha[i] != 0xff)
  ------------------
  |  Branch (1866:19): [True: 0, False: 0]
  ------------------
 1867|      0|         {
 1868|       |            /* The png_composite() macro is defined in png.h */
 1869|      0|            png_composite(palette[i].red, palette[i].red,
  ------------------
  |  | 2507|      0|   {                                                     \
  |  | 2508|      0|      png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
  |  | 2509|      0|          * (png_uint_16)(alpha)                         \
  |  | 2510|      0|          + (png_uint_16)(bg)*(png_uint_16)(255          \
  |  | 2511|      0|          - (png_uint_16)(alpha)) + 128);                \
  |  | 2512|      0|      (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \
  |  | 2513|      0|   }
  ------------------
 1870|      0|                png_ptr->trans_alpha[i], back.red);
 1871|       |
 1872|      0|            png_composite(palette[i].green, palette[i].green,
  ------------------
  |  | 2507|      0|   {                                                     \
  |  | 2508|      0|      png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
  |  | 2509|      0|          * (png_uint_16)(alpha)                         \
  |  | 2510|      0|          + (png_uint_16)(bg)*(png_uint_16)(255          \
  |  | 2511|      0|          - (png_uint_16)(alpha)) + 128);                \
  |  | 2512|      0|      (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \
  |  | 2513|      0|   }
  ------------------
 1873|      0|                png_ptr->trans_alpha[i], back.green);
 1874|       |
 1875|      0|            png_composite(palette[i].blue, palette[i].blue,
  ------------------
  |  | 2507|      0|   {                                                     \
  |  | 2508|      0|      png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
  |  | 2509|      0|          * (png_uint_16)(alpha)                         \
  |  | 2510|      0|          + (png_uint_16)(bg)*(png_uint_16)(255          \
  |  | 2511|      0|          - (png_uint_16)(alpha)) + 128);                \
  |  | 2512|      0|      (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \
  |  | 2513|      0|   }
  ------------------
 1876|      0|                png_ptr->trans_alpha[i], back.blue);
 1877|      0|         }
 1878|      0|      }
 1879|       |
 1880|      0|      png_ptr->transformations &= ~PNG_COMPOSE;
  ------------------
  |  |  674|      0|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
 1881|      0|   }
 1882|  1.01k|#endif /* READ_BACKGROUND */
 1883|       |
 1884|  1.01k|#ifdef PNG_READ_SHIFT_SUPPORTED
 1885|  1.01k|   if ((png_ptr->transformations & PNG_SHIFT) != 0 &&
  ------------------
  |  |  670|  1.01k|#define PNG_SHIFT               0x0008U
  ------------------
  |  Branch (1885:8): [True: 0, False: 1.01k]
  ------------------
 1886|  1.01k|       (png_ptr->transformations & PNG_EXPAND) == 0 &&
  ------------------
  |  |  679|      0|#define PNG_EXPAND              0x1000U
  ------------------
  |  Branch (1886:8): [True: 0, False: 0]
  ------------------
 1887|  1.01k|       (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
  ------------------
  |  |  668|      0|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|      0|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1887:8): [True: 0, False: 0]
  ------------------
 1888|      0|   {
 1889|      0|      int i;
 1890|      0|      int istop = png_ptr->num_palette;
 1891|      0|      int shift = 8 - png_ptr->sig_bit.red;
 1892|       |
 1893|      0|      png_ptr->transformations &= ~PNG_SHIFT;
  ------------------
  |  |  670|      0|#define PNG_SHIFT               0x0008U
  ------------------
 1894|       |
 1895|       |      /* significant bits can be in the range 1 to 7 for a meaningful result, if
 1896|       |       * the number of significant bits is 0 then no shift is done (this is an
 1897|       |       * error condition which is silently ignored.)
 1898|       |       */
 1899|      0|      if (shift > 0 && shift < 8)
  ------------------
  |  Branch (1899:11): [True: 0, False: 0]
  |  Branch (1899:24): [True: 0, False: 0]
  ------------------
 1900|      0|         for (i=0; i<istop; ++i)
  ------------------
  |  Branch (1900:20): [True: 0, False: 0]
  ------------------
 1901|      0|         {
 1902|      0|            int component = png_ptr->palette[i].red;
 1903|       |
 1904|      0|            component >>= shift;
 1905|      0|            png_ptr->palette[i].red = (png_byte)component;
 1906|      0|         }
 1907|       |
 1908|      0|      shift = 8 - png_ptr->sig_bit.green;
 1909|      0|      if (shift > 0 && shift < 8)
  ------------------
  |  Branch (1909:11): [True: 0, False: 0]
  |  Branch (1909:24): [True: 0, False: 0]
  ------------------
 1910|      0|         for (i=0; i<istop; ++i)
  ------------------
  |  Branch (1910:20): [True: 0, False: 0]
  ------------------
 1911|      0|         {
 1912|      0|            int component = png_ptr->palette[i].green;
 1913|       |
 1914|      0|            component >>= shift;
 1915|      0|            png_ptr->palette[i].green = (png_byte)component;
 1916|      0|         }
 1917|       |
 1918|      0|      shift = 8 - png_ptr->sig_bit.blue;
 1919|      0|      if (shift > 0 && shift < 8)
  ------------------
  |  Branch (1919:11): [True: 0, False: 0]
  |  Branch (1919:24): [True: 0, False: 0]
  ------------------
 1920|      0|         for (i=0; i<istop; ++i)
  ------------------
  |  Branch (1920:20): [True: 0, False: 0]
  ------------------
 1921|      0|         {
 1922|      0|            int component = png_ptr->palette[i].blue;
 1923|       |
 1924|      0|            component >>= shift;
 1925|      0|            png_ptr->palette[i].blue = (png_byte)component;
 1926|      0|         }
 1927|      0|   }
 1928|  1.01k|#endif /* READ_SHIFT */
 1929|  1.01k|}
png_read_transform_info:
 1937|  1.01k|{
 1938|  1.01k|   png_debug(1, "in png_read_transform_info");
  ------------------
  |  |  145|  1.01k|#  define png_debug(l, m) ((void)0)
  ------------------
 1939|       |
 1940|  1.01k|#ifdef PNG_READ_EXPAND_SUPPORTED
 1941|  1.01k|   if ((png_ptr->transformations & PNG_EXPAND) != 0)
  ------------------
  |  |  679|  1.01k|#define PNG_EXPAND              0x1000U
  ------------------
  |  Branch (1941:8): [True: 382, False: 629]
  ------------------
 1942|    382|   {
 1943|    382|      if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|    382|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|    382|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|    382|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1943:11): [True: 84, False: 298]
  ------------------
 1944|     84|      {
 1945|       |         /* This check must match what actually happens in
 1946|       |          * png_do_expand_palette; if it ever checks the tRNS chunk to see if
 1947|       |          * it is all opaque we must do the same (at present it does not.)
 1948|       |          */
 1949|     84|         if (png_ptr->num_trans > 0)
  ------------------
  |  Branch (1949:14): [True: 29, False: 55]
  ------------------
 1950|     29|            info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
  ------------------
  |  |  670|     29|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|     29|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|     29|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
 1951|       |
 1952|     55|         else
 1953|     55|            info_ptr->color_type = PNG_COLOR_TYPE_RGB;
  ------------------
  |  |  669|     55|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|     55|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
 1954|       |
 1955|     84|         info_ptr->bit_depth = 8;
 1956|     84|         info_ptr->num_trans = 0;
 1957|       |
 1958|     84|         if (png_ptr->palette == NULL)
  ------------------
  |  Branch (1958:14): [True: 0, False: 84]
  ------------------
 1959|      0|            png_error (png_ptr, "Palette is NULL in indexed image");
 1960|     84|      }
 1961|    298|      else
 1962|    298|      {
 1963|    298|         if (png_ptr->num_trans != 0)
  ------------------
  |  Branch (1963:14): [True: 187, False: 111]
  ------------------
 1964|    187|         {
 1965|    187|            if ((png_ptr->transformations & PNG_EXPAND_tRNS) != 0)
  ------------------
  |  |  693|    187|#define PNG_EXPAND_tRNS      0x2000000U /* Added to libpng-1.2.9 */
  ------------------
  |  Branch (1965:17): [True: 187, False: 0]
  ------------------
 1966|    187|               info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
  ------------------
  |  |  664|    187|#define PNG_COLOR_MASK_ALPHA      4
  ------------------
 1967|    187|         }
 1968|    298|         if (info_ptr->bit_depth < 8)
  ------------------
  |  Branch (1968:14): [True: 70, False: 228]
  ------------------
 1969|     70|            info_ptr->bit_depth = 8;
 1970|       |
 1971|    298|         info_ptr->num_trans = 0;
 1972|    298|      }
 1973|    382|   }
 1974|  1.01k|#endif
 1975|       |
 1976|  1.01k|#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
 1977|  1.01k|   defined(PNG_READ_ALPHA_MODE_SUPPORTED)
 1978|       |   /* The following is almost certainly wrong unless the background value is in
 1979|       |    * the screen space!
 1980|       |    */
 1981|  1.01k|   if ((png_ptr->transformations & PNG_COMPOSE) != 0)
  ------------------
  |  |  674|  1.01k|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (1981:8): [True: 0, False: 1.01k]
  ------------------
 1982|      0|      info_ptr->background = png_ptr->background;
 1983|  1.01k|#endif
 1984|       |
 1985|  1.01k|#ifdef PNG_READ_GAMMA_SUPPORTED
 1986|       |   /* The following used to be conditional on PNG_GAMMA (prior to 1.5.4),
 1987|       |    * however it seems that the code in png_init_read_transformations, which has
 1988|       |    * been called before this from png_read_update_info->png_read_start_row
 1989|       |    * sometimes does the gamma transform and cancels the flag.
 1990|       |    *
 1991|       |    * TODO: this looks wrong; the info_ptr should end up with a gamma equal to
 1992|       |    * the screen_gamma value.  The following probably results in weirdness if
 1993|       |    * the info_ptr is used by the app after the rows have been read.
 1994|       |    */
 1995|  1.01k|   info_ptr->colorspace.gamma = png_ptr->colorspace.gamma;
 1996|  1.01k|#endif
 1997|       |
 1998|  1.01k|   if (info_ptr->bit_depth == 16)
  ------------------
  |  Branch (1998:8): [True: 670, False: 341]
  ------------------
 1999|    670|   {
 2000|    670|#  ifdef PNG_READ_16BIT_SUPPORTED
 2001|    670|#     ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
 2002|    670|         if ((png_ptr->transformations & PNG_SCALE_16_TO_8) != 0)
  ------------------
  |  |  694|    670|#define PNG_SCALE_16_TO_8    0x4000000U /* Added to libpng-1.5.4 */
  ------------------
  |  Branch (2002:14): [True: 0, False: 670]
  ------------------
 2003|      0|            info_ptr->bit_depth = 8;
 2004|    670|#     endif
 2005|       |
 2006|    670|#     ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
 2007|    670|         if ((png_ptr->transformations & PNG_16_TO_8) != 0)
  ------------------
  |  |  677|    670|#define PNG_16_TO_8             0x0400U    /* Becomes 'chop' in 1.5.4 */
  ------------------
  |  Branch (2007:14): [True: 0, False: 670]
  ------------------
 2008|      0|            info_ptr->bit_depth = 8;
 2009|    670|#     endif
 2010|       |
 2011|       |#  else
 2012|       |      /* No 16-bit support: force chopping 16-bit input down to 8, in this case
 2013|       |       * the app program can chose if both APIs are available by setting the
 2014|       |       * correct scaling to use.
 2015|       |       */
 2016|       |#     ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
 2017|       |         /* For compatibility with previous versions use the strip method by
 2018|       |          * default.  This code works because if PNG_SCALE_16_TO_8 is already
 2019|       |          * set the code below will do that in preference to the chop.
 2020|       |          */
 2021|       |         png_ptr->transformations |= PNG_16_TO_8;
 2022|       |         info_ptr->bit_depth = 8;
 2023|       |#     else
 2024|       |
 2025|       |#        ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
 2026|       |            png_ptr->transformations |= PNG_SCALE_16_TO_8;
 2027|       |            info_ptr->bit_depth = 8;
 2028|       |#        else
 2029|       |
 2030|       |            CONFIGURATION ERROR: you must enable at least one 16 to 8 method
 2031|       |#        endif
 2032|       |#    endif
 2033|       |#endif /* !READ_16BIT */
 2034|    670|   }
 2035|       |
 2036|  1.01k|#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 2037|  1.01k|   if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0)
  ------------------
  |  |  681|  1.01k|#define PNG_GRAY_TO_RGB         0x4000U
  ------------------
  |  Branch (2037:8): [True: 163, False: 848]
  ------------------
 2038|    163|      info_ptr->color_type = (png_byte)(info_ptr->color_type |
 2039|    163|         PNG_COLOR_MASK_COLOR);
  ------------------
  |  |  663|    163|#define PNG_COLOR_MASK_COLOR      2
  ------------------
 2040|  1.01k|#endif
 2041|       |
 2042|  1.01k|#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 2043|  1.01k|   if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
  ------------------
  |  |  690|  1.01k|#define PNG_RGB_TO_GRAY       0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
  ------------------
  |  Branch (2043:8): [True: 0, False: 1.01k]
  ------------------
 2044|      0|      info_ptr->color_type = (png_byte)(info_ptr->color_type &
 2045|      0|         ~PNG_COLOR_MASK_COLOR);
  ------------------
  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  ------------------
 2046|  1.01k|#endif
 2047|       |
 2048|  1.01k|#ifdef PNG_READ_QUANTIZE_SUPPORTED
 2049|  1.01k|   if ((png_ptr->transformations & PNG_QUANTIZE) != 0)
  ------------------
  |  |  673|  1.01k|#define PNG_QUANTIZE            0x0040U
  ------------------
  |  Branch (2049:8): [True: 0, False: 1.01k]
  ------------------
 2050|      0|   {
 2051|      0|      if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
  ------------------
  |  |  669|      0|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (2051:12): [True: 0, False: 0]
  ------------------
 2052|      0|          (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)) &&
  ------------------
  |  |  670|      0|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (2052:11): [True: 0, False: 0]
  ------------------
 2053|      0|          png_ptr->palette_lookup != 0 && info_ptr->bit_depth == 8)
  ------------------
  |  Branch (2053:11): [True: 0, False: 0]
  |  Branch (2053:43): [True: 0, False: 0]
  ------------------
 2054|      0|      {
 2055|      0|         info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
  ------------------
  |  |  668|      0|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|      0|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
 2056|      0|      }
 2057|      0|   }
 2058|  1.01k|#endif
 2059|       |
 2060|  1.01k|#ifdef PNG_READ_EXPAND_16_SUPPORTED
 2061|  1.01k|   if ((png_ptr->transformations & PNG_EXPAND_16) != 0 &&
  ------------------
  |  |  676|  1.01k|#define PNG_EXPAND_16           0x0200U    /* Added to libpng 1.5.2 */
  ------------------
  |  Branch (2061:8): [True: 0, False: 1.01k]
  ------------------
 2062|  1.01k|       info_ptr->bit_depth == 8 &&
  ------------------
  |  Branch (2062:8): [True: 0, False: 0]
  ------------------
 2063|  1.01k|       info_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|      0|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|      0|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (2063:8): [True: 0, False: 0]
  ------------------
 2064|      0|   {
 2065|      0|      info_ptr->bit_depth = 16;
 2066|      0|   }
 2067|  1.01k|#endif
 2068|       |
 2069|  1.01k|#ifdef PNG_READ_PACK_SUPPORTED
 2070|  1.01k|   if ((png_ptr->transformations & PNG_PACK) != 0 &&
  ------------------
  |  |  669|  1.01k|#define PNG_PACK                0x0004U
  ------------------
  |  Branch (2070:8): [True: 134, False: 877]
  ------------------
 2071|  1.01k|       (info_ptr->bit_depth < 8))
  ------------------
  |  Branch (2071:8): [True: 0, False: 134]
  ------------------
 2072|      0|      info_ptr->bit_depth = 8;
 2073|  1.01k|#endif
 2074|       |
 2075|  1.01k|   if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|  1.01k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  1.01k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  1.01k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (2075:8): [True: 0, False: 1.01k]
  ------------------
 2076|      0|      info_ptr->channels = 1;
 2077|       |
 2078|  1.01k|   else if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
  ------------------
  |  |  663|  1.01k|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (2078:13): [True: 1.01k, False: 0]
  ------------------
 2079|  1.01k|      info_ptr->channels = 3;
 2080|       |
 2081|      0|   else
 2082|      0|      info_ptr->channels = 1;
 2083|       |
 2084|  1.01k|#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
 2085|  1.01k|   if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0)
  ------------------
  |  |  685|  1.01k|#define PNG_STRIP_ALPHA        0x40000U
  ------------------
  |  Branch (2085:8): [True: 0, False: 1.01k]
  ------------------
 2086|      0|   {
 2087|      0|      info_ptr->color_type = (png_byte)(info_ptr->color_type &
 2088|      0|         ~PNG_COLOR_MASK_ALPHA);
  ------------------
  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  ------------------
 2089|      0|      info_ptr->num_trans = 0;
 2090|      0|   }
 2091|  1.01k|#endif
 2092|       |
 2093|  1.01k|   if ((info_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)
  ------------------
  |  |  664|  1.01k|#define PNG_COLOR_MASK_ALPHA      4
  ------------------
  |  Branch (2093:8): [True: 295, False: 716]
  ------------------
 2094|    295|      info_ptr->channels++;
 2095|       |
 2096|  1.01k|#ifdef PNG_READ_FILLER_SUPPORTED
 2097|       |   /* STRIP_ALPHA and FILLER allowed:  MASK_ALPHA bit stripped above */
 2098|  1.01k|   if ((png_ptr->transformations & PNG_FILLER) != 0 &&
  ------------------
  |  |  682|  1.01k|#define PNG_FILLER              0x8000U
  ------------------
  |  Branch (2098:8): [True: 1.01k, False: 0]
  ------------------
 2099|  1.01k|       (info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
  ------------------
  |  |  669|  2.02k|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|  1.01k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (2099:9): [True: 716, False: 295]
  ------------------
 2100|  1.01k|       info_ptr->color_type == PNG_COLOR_TYPE_GRAY))
  ------------------
  |  |  667|    295|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (2100:8): [True: 0, False: 295]
  ------------------
 2101|    716|   {
 2102|    716|      info_ptr->channels++;
 2103|       |      /* If adding a true alpha channel not just filler */
 2104|    716|      if ((png_ptr->transformations & PNG_ADD_ALPHA) != 0)
  ------------------
  |  |  692|    716|#define PNG_ADD_ALPHA        0x1000000U /* Added to libpng-1.2.7 */
  ------------------
  |  Branch (2104:11): [True: 0, False: 716]
  ------------------
 2105|      0|         info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
  ------------------
  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  ------------------
 2106|    716|   }
 2107|  1.01k|#endif
 2108|       |
 2109|  1.01k|#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \
 2110|  1.01k|defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
 2111|  1.01k|   if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
  ------------------
  |  |  687|  1.01k|#define PNG_USER_TRANSFORM    0x100000U
  ------------------
  |  Branch (2111:8): [True: 0, False: 1.01k]
  ------------------
 2112|      0|   {
 2113|      0|      if (png_ptr->user_transform_depth != 0)
  ------------------
  |  Branch (2113:11): [True: 0, False: 0]
  ------------------
 2114|      0|         info_ptr->bit_depth = png_ptr->user_transform_depth;
 2115|       |
 2116|      0|      if (png_ptr->user_transform_channels != 0)
  ------------------
  |  Branch (2116:11): [True: 0, False: 0]
  ------------------
 2117|      0|         info_ptr->channels = png_ptr->user_transform_channels;
 2118|      0|   }
 2119|  1.01k|#endif
 2120|       |
 2121|  1.01k|   info_ptr->pixel_depth = (png_byte)(info_ptr->channels *
 2122|  1.01k|       info_ptr->bit_depth);
 2123|       |
 2124|  1.01k|   info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, info_ptr->width);
  ------------------
  |  |  764|  1.01k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 1.01k, False: 0]
  |  |  ------------------
  |  |  765|  1.01k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|  1.01k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
 2125|       |
 2126|       |   /* Adding in 1.5.4: cache the above value in png_struct so that we can later
 2127|       |    * check in png_rowbytes that the user buffer won't get overwritten.  Note
 2128|       |    * that the field is not always set - if png_read_update_info isn't called
 2129|       |    * the application has to either not do any transforms or get the calculation
 2130|       |    * right itself.
 2131|       |    */
 2132|  1.01k|   png_ptr->info_rowbytes = info_ptr->rowbytes;
 2133|       |
 2134|       |#ifndef PNG_READ_EXPAND_SUPPORTED
 2135|       |   if (png_ptr != NULL)
 2136|       |      return;
 2137|       |#endif
 2138|  1.01k|}
png_do_read_transformations:
 4737|   104k|{
 4738|   104k|   png_debug(1, "in png_do_read_transformations");
  ------------------
  |  |  145|   104k|#  define png_debug(l, m) ((void)0)
  ------------------
 4739|       |
 4740|   104k|   if (png_ptr->row_buf == NULL)
  ------------------
  |  Branch (4740:8): [True: 0, False: 104k]
  ------------------
 4741|      0|   {
 4742|       |      /* Prior to 1.5.4 this output row/pass where the NULL pointer is, but this
 4743|       |       * error is incredibly rare and incredibly easy to debug without this
 4744|       |       * information.
 4745|       |       */
 4746|      0|      png_error(png_ptr, "NULL row buffer");
 4747|      0|   }
 4748|       |
 4749|       |   /* The following is debugging; prior to 1.5.4 the code was never compiled in;
 4750|       |    * in 1.5.4 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
 4751|       |    * PNG_WARN_UNINITIALIZED_ROW removed.  In 1.6 the new flag is set only for
 4752|       |    * all transformations, however in practice the ROW_INIT always gets done on
 4753|       |    * demand, if necessary.
 4754|       |    */
 4755|   104k|   if ((png_ptr->flags & PNG_FLAG_DETECT_UNINITIALIZED) != 0 &&
  ------------------
  |  |  718|   104k|#define PNG_FLAG_DETECT_UNINITIALIZED     0x4000U /* Added to libpng-1.5.4 */
  ------------------
  |  Branch (4755:8): [True: 14.6k, False: 89.7k]
  ------------------
 4756|   104k|       (png_ptr->flags & PNG_FLAG_ROW_INIT) == 0)
  ------------------
  |  |  710|  14.6k|#define PNG_FLAG_ROW_INIT                 0x0040U
  ------------------
  |  Branch (4756:8): [True: 0, False: 14.6k]
  ------------------
 4757|      0|   {
 4758|       |      /* Application has failed to call either png_read_start_image() or
 4759|       |       * png_read_update_info() after setting transforms that expand pixels.
 4760|       |       * This check added to libpng-1.2.19 (but not enabled until 1.5.4).
 4761|       |       */
 4762|      0|      png_error(png_ptr, "Uninitialized row");
 4763|      0|   }
 4764|       |
 4765|   104k|#ifdef PNG_READ_EXPAND_SUPPORTED
 4766|   104k|   if ((png_ptr->transformations & PNG_EXPAND) != 0)
  ------------------
  |  |  679|   104k|#define PNG_EXPAND              0x1000U
  ------------------
  |  Branch (4766:8): [True: 14.6k, False: 89.7k]
  ------------------
 4767|  14.6k|   {
 4768|  14.6k|      if (row_info->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|  14.6k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  14.6k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  14.6k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (4768:11): [True: 1.44k, False: 13.1k]
  ------------------
 4769|  1.44k|      {
 4770|       |#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
 4771|       |         if ((png_ptr->num_trans > 0) && (png_ptr->bit_depth == 8))
 4772|       |         {
 4773|       |            if (png_ptr->riffled_palette == NULL)
 4774|       |            {
 4775|       |               /* Initialize the accelerated palette expansion. */
 4776|       |               png_ptr->riffled_palette =
 4777|       |                   (png_bytep)png_malloc(png_ptr, 256 * 4);
 4778|       |               png_riffle_palette_neon(png_ptr);
 4779|       |            }
 4780|       |         }
 4781|       |#endif
 4782|  1.44k|         png_do_expand_palette(png_ptr, row_info, png_ptr->row_buf + 1,
 4783|  1.44k|             png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
 4784|  1.44k|      }
 4785|       |
 4786|  13.1k|      else
 4787|  13.1k|      {
 4788|  13.1k|         if (png_ptr->num_trans != 0 &&
  ------------------
  |  Branch (4788:14): [True: 6.85k, False: 6.34k]
  ------------------
 4789|  13.1k|             (png_ptr->transformations & PNG_EXPAND_tRNS) != 0)
  ------------------
  |  |  693|  6.85k|#define PNG_EXPAND_tRNS      0x2000000U /* Added to libpng-1.2.9 */
  ------------------
  |  Branch (4789:14): [True: 6.85k, False: 0]
  ------------------
 4790|  6.85k|            png_do_expand(row_info, png_ptr->row_buf + 1,
 4791|  6.85k|                &(png_ptr->trans_color));
 4792|       |
 4793|  6.34k|         else
 4794|  6.34k|            png_do_expand(row_info, png_ptr->row_buf + 1, NULL);
 4795|  13.1k|      }
 4796|  14.6k|   }
 4797|   104k|#endif
 4798|       |
 4799|   104k|#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
 4800|   104k|   if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0 &&
  ------------------
  |  |  685|   104k|#define PNG_STRIP_ALPHA        0x40000U
  ------------------
  |  Branch (4800:8): [True: 0, False: 104k]
  ------------------
 4801|   104k|       (png_ptr->transformations & PNG_COMPOSE) == 0 &&
  ------------------
  |  |  674|      0|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (4801:8): [True: 0, False: 0]
  ------------------
 4802|   104k|       (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
  ------------------
  |  |  670|      0|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (4802:9): [True: 0, False: 0]
  ------------------
 4803|      0|       row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
  ------------------
  |  |  671|      0|#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (4803:8): [True: 0, False: 0]
  ------------------
 4804|      0|      png_do_strip_channel(row_info, png_ptr->row_buf + 1,
 4805|      0|          0 /* at_start == false, because SWAP_ALPHA happens later */);
 4806|   104k|#endif
 4807|       |
 4808|   104k|#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 4809|   104k|   if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
  ------------------
  |  |  690|   104k|#define PNG_RGB_TO_GRAY       0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
  ------------------
  |  Branch (4809:8): [True: 0, False: 104k]
  ------------------
 4810|      0|   {
 4811|      0|      int rgb_error =
 4812|      0|          png_do_rgb_to_gray(png_ptr, row_info,
 4813|      0|              png_ptr->row_buf + 1);
 4814|       |
 4815|      0|      if (rgb_error != 0)
  ------------------
  |  Branch (4815:11): [True: 0, False: 0]
  ------------------
 4816|      0|      {
 4817|      0|         png_ptr->rgb_to_gray_status=1;
 4818|      0|         if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
  ------------------
  |  |  690|      0|#define PNG_RGB_TO_GRAY       0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
  ------------------
  |  Branch (4818:14): [True: 0, False: 0]
  ------------------
 4819|      0|             PNG_RGB_TO_GRAY_WARN)
  ------------------
  |  |  689|      0|#define PNG_RGB_TO_GRAY_WARN  0x400000U
  ------------------
 4820|      0|            png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
 4821|       |
 4822|      0|         if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
  ------------------
  |  |  690|      0|#define PNG_RGB_TO_GRAY       0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
  ------------------
  |  Branch (4822:14): [True: 0, False: 0]
  ------------------
 4823|      0|             PNG_RGB_TO_GRAY_ERR)
  ------------------
  |  |  688|      0|#define PNG_RGB_TO_GRAY_ERR   0x200000U
  ------------------
 4824|      0|            png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
 4825|      0|      }
 4826|      0|   }
 4827|   104k|#endif
 4828|       |
 4829|       |/* From Andreas Dilger e-mail to png-implement, 26 March 1998:
 4830|       | *
 4831|       | *   In most cases, the "simple transparency" should be done prior to doing
 4832|       | *   gray-to-RGB, or you will have to test 3x as many bytes to check if a
 4833|       | *   pixel is transparent.  You would also need to make sure that the
 4834|       | *   transparency information is upgraded to RGB.
 4835|       | *
 4836|       | *   To summarize, the current flow is:
 4837|       | *   - Gray + simple transparency -> compare 1 or 2 gray bytes and composite
 4838|       | *                                   with background "in place" if transparent,
 4839|       | *                                   convert to RGB if necessary
 4840|       | *   - Gray + alpha -> composite with gray background and remove alpha bytes,
 4841|       | *                                   convert to RGB if necessary
 4842|       | *
 4843|       | *   To support RGB backgrounds for gray images we need:
 4844|       | *   - Gray + simple transparency -> convert to RGB + simple transparency,
 4845|       | *                                   compare 3 or 6 bytes and composite with
 4846|       | *                                   background "in place" if transparent
 4847|       | *                                   (3x compare/pixel compared to doing
 4848|       | *                                   composite with gray bkgrnd)
 4849|       | *   - Gray + alpha -> convert to RGB + alpha, composite with background and
 4850|       | *                                   remove alpha bytes (3x float
 4851|       | *                                   operations/pixel compared with composite
 4852|       | *                                   on gray background)
 4853|       | *
 4854|       | *  Greg's change will do this.  The reason it wasn't done before is for
 4855|       | *  performance, as this increases the per-pixel operations.  If we would check
 4856|       | *  in advance if the background was gray or RGB, and position the gray-to-RGB
 4857|       | *  transform appropriately, then it would save a lot of work/time.
 4858|       | */
 4859|       |
 4860|   104k|#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 4861|       |   /* If gray -> RGB, do so now only if background is non-gray; else do later
 4862|       |    * for performance reasons
 4863|       |    */
 4864|   104k|   if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0 &&
  ------------------
  |  |  681|   104k|#define PNG_GRAY_TO_RGB         0x4000U
  ------------------
  |  Branch (4864:8): [True: 7.72k, False: 96.7k]
  ------------------
 4865|   104k|       (png_ptr->mode & PNG_BACKGROUND_IS_GRAY) == 0)
  ------------------
  |  |  660|  7.72k|#define PNG_BACKGROUND_IS_GRAY     0x800U
  ------------------
  |  Branch (4865:8): [True: 7.72k, False: 0]
  ------------------
 4866|  7.72k|      png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
 4867|   104k|#endif
 4868|       |
 4869|   104k|#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
 4870|   104k|   defined(PNG_READ_ALPHA_MODE_SUPPORTED)
 4871|   104k|   if ((png_ptr->transformations & PNG_COMPOSE) != 0)
  ------------------
  |  |  674|   104k|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (4871:8): [True: 0, False: 104k]
  ------------------
 4872|      0|      png_do_compose(row_info, png_ptr->row_buf + 1, png_ptr);
 4873|   104k|#endif
 4874|       |
 4875|   104k|#ifdef PNG_READ_GAMMA_SUPPORTED
 4876|   104k|   if ((png_ptr->transformations & PNG_GAMMA) != 0 &&
  ------------------
  |  |  680|   104k|#define PNG_GAMMA               0x2000U
  ------------------
  |  Branch (4876:8): [True: 0, False: 104k]
  ------------------
 4877|   104k|#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 4878|       |      /* Because RGB_TO_GRAY does the gamma transform. */
 4879|   104k|      (png_ptr->transformations & PNG_RGB_TO_GRAY) == 0 &&
  ------------------
  |  |  690|      0|#define PNG_RGB_TO_GRAY       0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
  ------------------
  |  Branch (4879:7): [True: 0, False: 0]
  ------------------
 4880|   104k|#endif
 4881|   104k|#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
 4882|   104k|   defined(PNG_READ_ALPHA_MODE_SUPPORTED)
 4883|       |      /* Because PNG_COMPOSE does the gamma transform if there is something to
 4884|       |       * do (if there is an alpha channel or transparency.)
 4885|       |       */
 4886|   104k|       !((png_ptr->transformations & PNG_COMPOSE) != 0 &&
  ------------------
  |  |  674|      0|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (4886:10): [True: 0, False: 0]
  ------------------
 4887|      0|       ((png_ptr->num_trans != 0) ||
  ------------------
  |  Branch (4887:9): [True: 0, False: 0]
  ------------------
 4888|      0|       (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)) &&
  ------------------
  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  ------------------
  |  Branch (4888:8): [True: 0, False: 0]
  ------------------
 4889|   104k|#endif
 4890|       |      /* Because png_init_read_transformations transforms the palette, unless
 4891|       |       * RGB_TO_GRAY will do the transform.
 4892|       |       */
 4893|   104k|       (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE))
  ------------------
  |  |  668|      0|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|      0|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (4893:8): [True: 0, False: 0]
  ------------------
 4894|      0|      png_do_gamma(row_info, png_ptr->row_buf + 1, png_ptr);
 4895|   104k|#endif
 4896|       |
 4897|   104k|#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
 4898|   104k|   if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0 &&
  ------------------
  |  |  685|   104k|#define PNG_STRIP_ALPHA        0x40000U
  ------------------
  |  Branch (4898:8): [True: 0, False: 104k]
  ------------------
 4899|   104k|       (png_ptr->transformations & PNG_COMPOSE) != 0 &&
  ------------------
  |  |  674|      0|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
  |  Branch (4899:8): [True: 0, False: 0]
  ------------------
 4900|   104k|       (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
  ------------------
  |  |  670|      0|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (4900:9): [True: 0, False: 0]
  ------------------
 4901|      0|       row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
  ------------------
  |  |  671|      0|#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (4901:8): [True: 0, False: 0]
  ------------------
 4902|      0|      png_do_strip_channel(row_info, png_ptr->row_buf + 1,
 4903|      0|          0 /* at_start == false, because SWAP_ALPHA happens later */);
 4904|   104k|#endif
 4905|       |
 4906|   104k|#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
 4907|   104k|   if ((png_ptr->transformations & PNG_ENCODE_ALPHA) != 0 &&
  ------------------
  |  |  691|   104k|#define PNG_ENCODE_ALPHA      0x800000U /* Added to libpng-1.5.4 */
  ------------------
  |  Branch (4907:8): [True: 0, False: 104k]
  ------------------
 4908|   104k|       (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0)
  ------------------
  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  ------------------
  |  Branch (4908:8): [True: 0, False: 0]
  ------------------
 4909|      0|      png_do_encode_alpha(row_info, png_ptr->row_buf + 1, png_ptr);
 4910|   104k|#endif
 4911|       |
 4912|   104k|#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
 4913|   104k|   if ((png_ptr->transformations & PNG_SCALE_16_TO_8) != 0)
  ------------------
  |  |  694|   104k|#define PNG_SCALE_16_TO_8    0x4000000U /* Added to libpng-1.5.4 */
  ------------------
  |  Branch (4913:8): [True: 0, False: 104k]
  ------------------
 4914|      0|      png_do_scale_16_to_8(row_info, png_ptr->row_buf + 1);
 4915|   104k|#endif
 4916|       |
 4917|   104k|#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
 4918|       |   /* There is no harm in doing both of these because only one has any effect,
 4919|       |    * by putting the 'scale' option first if the app asks for scale (either by
 4920|       |    * calling the API or in a TRANSFORM flag) this is what happens.
 4921|       |    */
 4922|   104k|   if ((png_ptr->transformations & PNG_16_TO_8) != 0)
  ------------------
  |  |  677|   104k|#define PNG_16_TO_8             0x0400U    /* Becomes 'chop' in 1.5.4 */
  ------------------
  |  Branch (4922:8): [True: 0, False: 104k]
  ------------------
 4923|      0|      png_do_chop(row_info, png_ptr->row_buf + 1);
 4924|   104k|#endif
 4925|       |
 4926|   104k|#ifdef PNG_READ_QUANTIZE_SUPPORTED
 4927|   104k|   if ((png_ptr->transformations & PNG_QUANTIZE) != 0)
  ------------------
  |  |  673|   104k|#define PNG_QUANTIZE            0x0040U
  ------------------
  |  Branch (4927:8): [True: 0, False: 104k]
  ------------------
 4928|      0|   {
 4929|      0|      png_do_quantize(row_info, png_ptr->row_buf + 1,
 4930|      0|          png_ptr->palette_lookup, png_ptr->quantize_index);
 4931|       |
 4932|      0|      if (row_info->rowbytes == 0)
  ------------------
  |  Branch (4932:11): [True: 0, False: 0]
  ------------------
 4933|      0|         png_error(png_ptr, "png_do_quantize returned rowbytes=0");
 4934|      0|   }
 4935|   104k|#endif /* READ_QUANTIZE */
 4936|       |
 4937|   104k|#ifdef PNG_READ_EXPAND_16_SUPPORTED
 4938|       |   /* Do the expansion now, after all the arithmetic has been done.  Notice
 4939|       |    * that previous transformations can handle the PNG_EXPAND_16 flag if this
 4940|       |    * is efficient (particularly true in the case of gamma correction, where
 4941|       |    * better accuracy results faster!)
 4942|       |    */
 4943|   104k|   if ((png_ptr->transformations & PNG_EXPAND_16) != 0)
  ------------------
  |  |  676|   104k|#define PNG_EXPAND_16           0x0200U    /* Added to libpng 1.5.2 */
  ------------------
  |  Branch (4943:8): [True: 0, False: 104k]
  ------------------
 4944|      0|      png_do_expand_16(row_info, png_ptr->row_buf + 1);
 4945|   104k|#endif
 4946|       |
 4947|   104k|#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 4948|       |   /* NOTE: moved here in 1.5.4 (from much later in this list.) */
 4949|   104k|   if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0 &&
  ------------------
  |  |  681|   104k|#define PNG_GRAY_TO_RGB         0x4000U
  ------------------
  |  Branch (4949:8): [True: 7.72k, False: 96.7k]
  ------------------
 4950|   104k|       (png_ptr->mode & PNG_BACKGROUND_IS_GRAY) != 0)
  ------------------
  |  |  660|  7.72k|#define PNG_BACKGROUND_IS_GRAY     0x800U
  ------------------
  |  Branch (4950:8): [True: 0, False: 7.72k]
  ------------------
 4951|      0|      png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
 4952|   104k|#endif
 4953|       |
 4954|   104k|#ifdef PNG_READ_INVERT_SUPPORTED
 4955|   104k|   if ((png_ptr->transformations & PNG_INVERT_MONO) != 0)
  ------------------
  |  |  672|   104k|#define PNG_INVERT_MONO         0x0020U
  ------------------
  |  Branch (4955:8): [True: 0, False: 104k]
  ------------------
 4956|      0|      png_do_invert(row_info, png_ptr->row_buf + 1);
 4957|   104k|#endif
 4958|       |
 4959|   104k|#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
 4960|   104k|   if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
  ------------------
  |  |  686|   104k|#define PNG_INVERT_ALPHA       0x80000U
  ------------------
  |  Branch (4960:8): [True: 0, False: 104k]
  ------------------
 4961|      0|      png_do_read_invert_alpha(row_info, png_ptr->row_buf + 1);
 4962|   104k|#endif
 4963|       |
 4964|   104k|#ifdef PNG_READ_SHIFT_SUPPORTED
 4965|   104k|   if ((png_ptr->transformations & PNG_SHIFT) != 0)
  ------------------
  |  |  670|   104k|#define PNG_SHIFT               0x0008U
  ------------------
  |  Branch (4965:8): [True: 0, False: 104k]
  ------------------
 4966|      0|      png_do_unshift(row_info, png_ptr->row_buf + 1,
 4967|      0|          &(png_ptr->shift));
 4968|   104k|#endif
 4969|       |
 4970|   104k|#ifdef PNG_READ_PACK_SUPPORTED
 4971|   104k|   if ((png_ptr->transformations & PNG_PACK) != 0)
  ------------------
  |  |  669|   104k|#define PNG_PACK                0x0004U
  ------------------
  |  Branch (4971:8): [True: 2.35k, False: 102k]
  ------------------
 4972|  2.35k|      png_do_unpack(row_info, png_ptr->row_buf + 1);
 4973|   104k|#endif
 4974|       |
 4975|   104k|#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
 4976|       |   /* Added at libpng-1.5.10 */
 4977|   104k|   if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
  ------------------
  |  |  668|   208k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|   104k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|   104k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (4977:8): [True: 0, False: 104k]
  ------------------
 4978|   104k|       png_ptr->num_palette_max >= 0)
  ------------------
  |  Branch (4978:8): [True: 0, False: 0]
  ------------------
 4979|      0|      png_do_check_palette_indexes(png_ptr, row_info);
 4980|   104k|#endif
 4981|       |
 4982|   104k|#ifdef PNG_READ_BGR_SUPPORTED
 4983|   104k|   if ((png_ptr->transformations & PNG_BGR) != 0)
  ------------------
  |  |  667|   104k|#define PNG_BGR                 0x0001U
  ------------------
  |  Branch (4983:8): [True: 0, False: 104k]
  ------------------
 4984|      0|      png_do_bgr(row_info, png_ptr->row_buf + 1);
 4985|   104k|#endif
 4986|       |
 4987|   104k|#ifdef PNG_READ_PACKSWAP_SUPPORTED
 4988|   104k|   if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
  ------------------
  |  |  683|   104k|#define PNG_PACKSWAP           0x10000U
  ------------------
  |  Branch (4988:8): [True: 0, False: 104k]
  ------------------
 4989|      0|      png_do_packswap(row_info, png_ptr->row_buf + 1);
 4990|   104k|#endif
 4991|       |
 4992|   104k|#ifdef PNG_READ_FILLER_SUPPORTED
 4993|   104k|   if ((png_ptr->transformations & PNG_FILLER) != 0)
  ------------------
  |  |  682|   104k|#define PNG_FILLER              0x8000U
  ------------------
  |  Branch (4993:8): [True: 104k, False: 0]
  ------------------
 4994|   104k|      png_do_read_filler(row_info, png_ptr->row_buf + 1,
 4995|   104k|          (png_uint_32)png_ptr->filler, png_ptr->flags);
 4996|   104k|#endif
 4997|       |
 4998|   104k|#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
 4999|   104k|   if ((png_ptr->transformations & PNG_SWAP_ALPHA) != 0)
  ------------------
  |  |  684|   104k|#define PNG_SWAP_ALPHA         0x20000U
  ------------------
  |  Branch (4999:8): [True: 0, False: 104k]
  ------------------
 5000|      0|      png_do_read_swap_alpha(row_info, png_ptr->row_buf + 1);
 5001|   104k|#endif
 5002|       |
 5003|   104k|#ifdef PNG_READ_16BIT_SUPPORTED
 5004|   104k|#ifdef PNG_READ_SWAP_SUPPORTED
 5005|   104k|   if ((png_ptr->transformations & PNG_SWAP_BYTES) != 0)
  ------------------
  |  |  671|   104k|#define PNG_SWAP_BYTES          0x0010U
  ------------------
  |  Branch (5005:8): [True: 20.8k, False: 83.5k]
  ------------------
 5006|  20.8k|      png_do_swap(row_info, png_ptr->row_buf + 1);
 5007|   104k|#endif
 5008|   104k|#endif
 5009|       |
 5010|   104k|#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
 5011|   104k|   if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
  ------------------
  |  |  687|   104k|#define PNG_USER_TRANSFORM    0x100000U
  ------------------
  |  Branch (5011:8): [True: 83.5k, False: 20.8k]
  ------------------
 5012|  83.5k|   {
 5013|  83.5k|      if (png_ptr->read_user_transform_fn != NULL)
  ------------------
  |  Branch (5013:11): [True: 83.5k, False: 0]
  ------------------
 5014|  83.5k|         (*(png_ptr->read_user_transform_fn)) /* User read transform function */
 5015|  83.5k|             (png_ptr,     /* png_ptr */
 5016|  83.5k|             row_info,     /* row_info: */
 5017|       |                /*  png_uint_32 width;       width of row */
 5018|       |                /*  size_t rowbytes;         number of bytes in row */
 5019|       |                /*  png_byte color_type;     color type of pixels */
 5020|       |                /*  png_byte bit_depth;      bit depth of samples */
 5021|       |                /*  png_byte channels;       number of channels (1-4) */
 5022|       |                /*  png_byte pixel_depth;    bits per pixel (depth*channels) */
 5023|  83.5k|             png_ptr->row_buf + 1);    /* start of pixel data for row */
 5024|  83.5k|#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
 5025|  83.5k|      if (png_ptr->user_transform_depth != 0)
  ------------------
  |  Branch (5025:11): [True: 0, False: 83.5k]
  ------------------
 5026|      0|         row_info->bit_depth = png_ptr->user_transform_depth;
 5027|       |
 5028|  83.5k|      if (png_ptr->user_transform_channels != 0)
  ------------------
  |  Branch (5028:11): [True: 0, False: 83.5k]
  ------------------
 5029|      0|         row_info->channels = png_ptr->user_transform_channels;
 5030|  83.5k|#endif
 5031|  83.5k|      row_info->pixel_depth = (png_byte)(row_info->bit_depth *
 5032|  83.5k|          row_info->channels);
 5033|       |
 5034|  83.5k|      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->width);
  ------------------
  |  |  764|  83.5k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 83.5k, False: 0]
  |  |  ------------------
  |  |  765|  83.5k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|  83.5k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
 5035|  83.5k|   }
 5036|   104k|#endif
 5037|   104k|}
pngrtran.c:png_rtran_ok:
  111|    758|{
  112|    758|   if (png_ptr != NULL)
  ------------------
  |  Branch (112:8): [True: 758, False: 0]
  ------------------
  113|    758|   {
  114|    758|      if ((png_ptr->flags & PNG_FLAG_ROW_INIT) != 0)
  ------------------
  |  |  710|    758|#define PNG_FLAG_ROW_INIT                 0x0040U
  ------------------
  |  Branch (114:11): [True: 0, False: 758]
  ------------------
  115|      0|         png_app_error(png_ptr,
  116|      0|             "invalid after png_start_read_image or png_read_update_info");
  117|       |
  118|    758|      else if (need_IHDR && (png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|      0|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (118:16): [True: 0, False: 758]
  |  Branch (118:29): [True: 0, False: 0]
  ------------------
  119|      0|         png_app_error(png_ptr, "invalid before the PNG header has been read");
  120|       |
  121|    758|      else
  122|    758|      {
  123|       |         /* Turn on failure to initialize correctly for all transforms. */
  124|    758|         png_ptr->flags |= PNG_FLAG_DETECT_UNINITIALIZED;
  ------------------
  |  |  718|    758|#define PNG_FLAG_DETECT_UNINITIALIZED     0x4000U /* Added to libpng-1.5.4 */
  ------------------
  125|       |
  126|    758|         return 1; /* Ok */
  127|    758|      }
  128|    758|   }
  129|       |
  130|      0|   return 0; /* no png_error possible! */
  131|    758|}
pngrtran.c:png_init_palette_transformations:
 1114|     84|{
 1115|       |   /* Called to handle the (input) palette case.  In png_do_read_transformations
 1116|       |    * the first step is to expand the palette if requested, so this code must
 1117|       |    * take care to only make changes that are invariant with respect to the
 1118|       |    * palette expansion, or only do them if there is no expansion.
 1119|       |    *
 1120|       |    * STRIP_ALPHA has already been handled in the caller (by setting num_trans
 1121|       |    * to 0.)
 1122|       |    */
 1123|     84|   int input_has_alpha = 0;
 1124|     84|   int input_has_transparency = 0;
 1125|       |
 1126|     84|   if (png_ptr->num_trans > 0)
  ------------------
  |  Branch (1126:8): [True: 29, False: 55]
  ------------------
 1127|     29|   {
 1128|     29|      int i;
 1129|       |
 1130|       |      /* Ignore if all the entries are opaque (unlikely!) */
 1131|    524|      for (i=0; i<png_ptr->num_trans; ++i)
  ------------------
  |  Branch (1131:17): [True: 516, False: 8]
  ------------------
 1132|    516|      {
 1133|    516|         if (png_ptr->trans_alpha[i] == 255)
  ------------------
  |  Branch (1133:14): [True: 238, False: 278]
  ------------------
 1134|    238|            continue;
 1135|    278|         else if (png_ptr->trans_alpha[i] == 0)
  ------------------
  |  Branch (1135:19): [True: 257, False: 21]
  ------------------
 1136|    257|            input_has_transparency = 1;
 1137|     21|         else
 1138|     21|         {
 1139|     21|            input_has_transparency = 1;
 1140|     21|            input_has_alpha = 1;
 1141|     21|            break;
 1142|     21|         }
 1143|    516|      }
 1144|     29|   }
 1145|       |
 1146|       |   /* If no alpha we can optimize. */
 1147|     84|   if (input_has_alpha == 0)
  ------------------
  |  Branch (1147:8): [True: 63, False: 21]
  ------------------
 1148|     63|   {
 1149|       |      /* Any alpha means background and associative alpha processing is
 1150|       |       * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
 1151|       |       * and ENCODE_ALPHA are irrelevant.
 1152|       |       */
 1153|     63|      png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
  ------------------
  |  |  691|     63|#define PNG_ENCODE_ALPHA      0x800000U /* Added to libpng-1.5.4 */
  ------------------
 1154|     63|      png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
  ------------------
  |  |  717|     63|#define PNG_FLAG_OPTIMIZE_ALPHA           0x2000U /* Added to libpng-1.5.4 */
  ------------------
 1155|       |
 1156|     63|      if (input_has_transparency == 0)
  ------------------
  |  Branch (1156:11): [True: 58, False: 5]
  ------------------
 1157|     58|         png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
  ------------------
  |  |  674|     58|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
                       png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
  ------------------
  |  |  675|     58|#define PNG_BACKGROUND_EXPAND   0x0100U
  ------------------
 1158|     63|   }
 1159|       |
 1160|     84|#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
 1161|       |   /* png_set_background handling - deals with the complexity of whether the
 1162|       |    * background color is in the file format or the screen format in the case
 1163|       |    * where an 'expand' will happen.
 1164|       |    */
 1165|       |
 1166|       |   /* The following code cannot be entered in the alpha pre-multiplication case
 1167|       |    * because PNG_BACKGROUND_EXPAND is cancelled below.
 1168|       |    */
 1169|     84|   if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) != 0 &&
  ------------------
  |  |  675|     84|#define PNG_BACKGROUND_EXPAND   0x0100U
  ------------------
  |  Branch (1169:8): [True: 0, False: 84]
  ------------------
 1170|     84|       (png_ptr->transformations & PNG_EXPAND) != 0)
  ------------------
  |  |  679|      0|#define PNG_EXPAND              0x1000U
  ------------------
  |  Branch (1170:8): [True: 0, False: 0]
  ------------------
 1171|      0|   {
 1172|      0|      {
 1173|      0|         png_ptr->background.red   =
 1174|      0|             png_ptr->palette[png_ptr->background.index].red;
 1175|      0|         png_ptr->background.green =
 1176|      0|             png_ptr->palette[png_ptr->background.index].green;
 1177|      0|         png_ptr->background.blue  =
 1178|      0|             png_ptr->palette[png_ptr->background.index].blue;
 1179|       |
 1180|      0|#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
 1181|      0|         if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
  ------------------
  |  |  686|      0|#define PNG_INVERT_ALPHA       0x80000U
  ------------------
  |  Branch (1181:14): [True: 0, False: 0]
  ------------------
 1182|      0|         {
 1183|      0|            if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0)
  ------------------
  |  |  693|      0|#define PNG_EXPAND_tRNS      0x2000000U /* Added to libpng-1.2.9 */
  ------------------
  |  Branch (1183:17): [True: 0, False: 0]
  ------------------
 1184|      0|            {
 1185|       |               /* Invert the alpha channel (in tRNS) unless the pixels are
 1186|       |                * going to be expanded, in which case leave it for later
 1187|       |                */
 1188|      0|               int i, istop = png_ptr->num_trans;
 1189|       |
 1190|      0|               for (i = 0; i < istop; i++)
  ------------------
  |  Branch (1190:28): [True: 0, False: 0]
  ------------------
 1191|      0|                  png_ptr->trans_alpha[i] =
 1192|      0|                      (png_byte)(255 - png_ptr->trans_alpha[i]);
 1193|      0|            }
 1194|      0|         }
 1195|      0|#endif /* READ_INVERT_ALPHA */
 1196|      0|      }
 1197|      0|   } /* background expand and (therefore) no alpha association. */
 1198|     84|#endif /* READ_EXPAND && READ_BACKGROUND */
 1199|     84|}
pngrtran.c:png_init_rgb_transformations:
 1203|    927|{
 1204|       |   /* Added to libpng-1.5.4: check the color type to determine whether there
 1205|       |    * is any alpha or transparency in the image and simply cancel the
 1206|       |    * background and alpha mode stuff if there isn't.
 1207|       |    */
 1208|    927|   int input_has_alpha = (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0;
  ------------------
  |  |  664|    927|#define PNG_COLOR_MASK_ALPHA      4
  ------------------
 1209|    927|   int input_has_transparency = png_ptr->num_trans > 0;
 1210|       |
 1211|       |   /* If no alpha we can optimize. */
 1212|    927|   if (input_has_alpha == 0)
  ------------------
  |  Branch (1212:8): [True: 848, False: 79]
  ------------------
 1213|    848|   {
 1214|       |      /* Any alpha means background and associative alpha processing is
 1215|       |       * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
 1216|       |       * and ENCODE_ALPHA are irrelevant.
 1217|       |       */
 1218|    848|#     ifdef PNG_READ_ALPHA_MODE_SUPPORTED
 1219|    848|         png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
  ------------------
  |  |  691|    848|#define PNG_ENCODE_ALPHA      0x800000U /* Added to libpng-1.5.4 */
  ------------------
 1220|    848|         png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
  ------------------
  |  |  717|    848|#define PNG_FLAG_OPTIMIZE_ALPHA           0x2000U /* Added to libpng-1.5.4 */
  ------------------
 1221|    848|#     endif
 1222|       |
 1223|    848|      if (input_has_transparency == 0)
  ------------------
  |  Branch (1223:11): [True: 661, False: 187]
  ------------------
 1224|    661|         png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
  ------------------
  |  |  674|    661|#define PNG_COMPOSE             0x0080U    /* Was PNG_BACKGROUND */
  ------------------
                       png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
  ------------------
  |  |  675|    661|#define PNG_BACKGROUND_EXPAND   0x0100U
  ------------------
 1225|    848|   }
 1226|       |
 1227|    927|#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
 1228|       |   /* png_set_background handling - deals with the complexity of whether the
 1229|       |    * background color is in the file format or the screen format in the case
 1230|       |    * where an 'expand' will happen.
 1231|       |    */
 1232|       |
 1233|       |   /* The following code cannot be entered in the alpha pre-multiplication case
 1234|       |    * because PNG_BACKGROUND_EXPAND is cancelled below.
 1235|       |    */
 1236|    927|   if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) != 0 &&
  ------------------
  |  |  675|    927|#define PNG_BACKGROUND_EXPAND   0x0100U
  ------------------
  |  Branch (1236:8): [True: 0, False: 927]
  ------------------
 1237|    927|       (png_ptr->transformations & PNG_EXPAND) != 0 &&
  ------------------
  |  |  679|      0|#define PNG_EXPAND              0x1000U
  ------------------
  |  Branch (1237:8): [True: 0, False: 0]
  ------------------
 1238|    927|       (png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
  ------------------
  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (1238:8): [True: 0, False: 0]
  ------------------
 1239|       |       /* i.e., GRAY or GRAY_ALPHA */
 1240|      0|   {
 1241|      0|      {
 1242|       |         /* Expand background and tRNS chunks */
 1243|      0|         int gray = png_ptr->background.gray;
 1244|      0|         int trans_gray = png_ptr->trans_color.gray;
 1245|       |
 1246|      0|         switch (png_ptr->bit_depth)
 1247|      0|         {
 1248|      0|            case 1:
  ------------------
  |  Branch (1248:13): [True: 0, False: 0]
  ------------------
 1249|      0|               gray *= 0xff;
 1250|      0|               trans_gray *= 0xff;
 1251|      0|               break;
 1252|       |
 1253|      0|            case 2:
  ------------------
  |  Branch (1253:13): [True: 0, False: 0]
  ------------------
 1254|      0|               gray *= 0x55;
 1255|      0|               trans_gray *= 0x55;
 1256|      0|               break;
 1257|       |
 1258|      0|            case 4:
  ------------------
  |  Branch (1258:13): [True: 0, False: 0]
  ------------------
 1259|      0|               gray *= 0x11;
 1260|      0|               trans_gray *= 0x11;
 1261|      0|               break;
 1262|       |
 1263|      0|            default:
  ------------------
  |  Branch (1263:13): [True: 0, False: 0]
  ------------------
 1264|       |
 1265|      0|            case 8:
  ------------------
  |  Branch (1265:13): [True: 0, False: 0]
  ------------------
 1266|       |               /* FALLTHROUGH */ /*  (Already 8 bits) */
 1267|       |
 1268|      0|            case 16:
  ------------------
  |  Branch (1268:13): [True: 0, False: 0]
  ------------------
 1269|       |               /* Already a full 16 bits */
 1270|      0|               break;
 1271|      0|         }
 1272|       |
 1273|      0|         png_ptr->background.red = png_ptr->background.green =
 1274|      0|            png_ptr->background.blue = (png_uint_16)gray;
 1275|       |
 1276|      0|         if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0)
  ------------------
  |  |  693|      0|#define PNG_EXPAND_tRNS      0x2000000U /* Added to libpng-1.2.9 */
  ------------------
  |  Branch (1276:14): [True: 0, False: 0]
  ------------------
 1277|      0|         {
 1278|      0|            png_ptr->trans_color.red = png_ptr->trans_color.green =
 1279|      0|               png_ptr->trans_color.blue = (png_uint_16)trans_gray;
 1280|      0|         }
 1281|      0|      }
 1282|      0|   } /* background expand and (therefore) no alpha association. */
 1283|    927|#endif /* READ_EXPAND && READ_BACKGROUND */
 1284|    927|}
pngrtran.c:png_do_expand_palette:
 4208|  1.44k|{
 4209|  1.44k|   int shift, value;
 4210|  1.44k|   png_bytep sp, dp;
 4211|  1.44k|   png_uint_32 i;
 4212|  1.44k|   png_uint_32 row_width=row_info->width;
 4213|       |
 4214|  1.44k|   png_debug(1, "in png_do_expand_palette");
  ------------------
  |  |  145|  1.44k|#  define png_debug(l, m) ((void)0)
  ------------------
 4215|       |
 4216|  1.44k|   if (row_info->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|  1.44k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  1.44k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  1.44k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (4216:8): [True: 1.44k, False: 0]
  ------------------
 4217|  1.44k|   {
 4218|  1.44k|      if (row_info->bit_depth < 8)
  ------------------
  |  Branch (4218:11): [True: 1.20k, False: 242]
  ------------------
 4219|  1.20k|      {
 4220|  1.20k|         switch (row_info->bit_depth)
 4221|  1.20k|         {
 4222|    722|            case 1:
  ------------------
  |  Branch (4222:13): [True: 722, False: 481]
  ------------------
 4223|    722|            {
 4224|    722|               sp = row + (size_t)((row_width - 1) >> 3);
 4225|    722|               dp = row + (size_t)row_width - 1;
 4226|    722|               shift = 7 - (int)((row_width + 7) & 0x07);
 4227|  34.1k|               for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (4227:28): [True: 33.4k, False: 722]
  ------------------
 4228|  33.4k|               {
 4229|  33.4k|                  if ((*sp >> shift) & 0x01)
  ------------------
  |  Branch (4229:23): [True: 10.0k, False: 23.3k]
  ------------------
 4230|  10.0k|                     *dp = 1;
 4231|       |
 4232|  23.3k|                  else
 4233|  23.3k|                     *dp = 0;
 4234|       |
 4235|  33.4k|                  if (shift == 7)
  ------------------
  |  Branch (4235:23): [True: 4.62k, False: 28.7k]
  ------------------
 4236|  4.62k|                  {
 4237|  4.62k|                     shift = 0;
 4238|  4.62k|                     sp--;
 4239|  4.62k|                  }
 4240|       |
 4241|  28.7k|                  else
 4242|  28.7k|                     shift++;
 4243|       |
 4244|  33.4k|                  dp--;
 4245|  33.4k|               }
 4246|    722|               break;
 4247|      0|            }
 4248|       |
 4249|    274|            case 2:
  ------------------
  |  Branch (4249:13): [True: 274, False: 929]
  ------------------
 4250|    274|            {
 4251|    274|               sp = row + (size_t)((row_width - 1) >> 2);
 4252|    274|               dp = row + (size_t)row_width - 1;
 4253|    274|               shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
 4254|  41.5k|               for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (4254:28): [True: 41.2k, False: 274]
  ------------------
 4255|  41.2k|               {
 4256|  41.2k|                  value = (*sp >> shift) & 0x03;
 4257|  41.2k|                  *dp = (png_byte)value;
 4258|  41.2k|                  if (shift == 6)
  ------------------
  |  Branch (4258:23): [True: 10.3k, False: 30.8k]
  ------------------
 4259|  10.3k|                  {
 4260|  10.3k|                     shift = 0;
 4261|  10.3k|                     sp--;
 4262|  10.3k|                  }
 4263|       |
 4264|  30.8k|                  else
 4265|  30.8k|                     shift += 2;
 4266|       |
 4267|  41.2k|                  dp--;
 4268|  41.2k|               }
 4269|    274|               break;
 4270|      0|            }
 4271|       |
 4272|    207|            case 4:
  ------------------
  |  Branch (4272:13): [True: 207, False: 996]
  ------------------
 4273|    207|            {
 4274|    207|               sp = row + (size_t)((row_width - 1) >> 1);
 4275|    207|               dp = row + (size_t)row_width - 1;
 4276|    207|               shift = (int)((row_width & 0x01) << 2);
 4277|  1.28k|               for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (4277:28): [True: 1.07k, False: 207]
  ------------------
 4278|  1.07k|               {
 4279|  1.07k|                  value = (*sp >> shift) & 0x0f;
 4280|  1.07k|                  *dp = (png_byte)value;
 4281|  1.07k|                  if (shift == 4)
  ------------------
  |  Branch (4281:23): [True: 574, False: 499]
  ------------------
 4282|    574|                  {
 4283|    574|                     shift = 0;
 4284|    574|                     sp--;
 4285|    574|                  }
 4286|       |
 4287|    499|                  else
 4288|    499|                     shift += 4;
 4289|       |
 4290|  1.07k|                  dp--;
 4291|  1.07k|               }
 4292|    207|               break;
 4293|      0|            }
 4294|       |
 4295|      0|            default:
  ------------------
  |  Branch (4295:13): [True: 0, False: 1.20k]
  ------------------
 4296|      0|               break;
 4297|  1.20k|         }
 4298|  1.20k|         row_info->bit_depth = 8;
 4299|  1.20k|         row_info->pixel_depth = 8;
 4300|  1.20k|         row_info->rowbytes = row_width;
 4301|  1.20k|      }
 4302|       |
 4303|  1.44k|      if (row_info->bit_depth == 8)
  ------------------
  |  Branch (4303:11): [True: 1.44k, False: 0]
  ------------------
 4304|  1.44k|      {
 4305|  1.44k|         {
 4306|  1.44k|            if (num_trans > 0)
  ------------------
  |  Branch (4306:17): [True: 204, False: 1.24k]
  ------------------
 4307|    204|            {
 4308|    204|               sp = row + (size_t)row_width - 1;
 4309|    204|               dp = row + ((size_t)row_width << 2) - 1;
 4310|       |
 4311|    204|               i = 0;
 4312|       |#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
 4313|       |               if (png_ptr->riffled_palette != NULL)
 4314|       |               {
 4315|       |                  /* The RGBA optimization works with png_ptr->bit_depth == 8
 4316|       |                   * but sometimes row_info->bit_depth has been changed to 8.
 4317|       |                   * In these cases, the palette hasn't been riffled.
 4318|       |                   */
 4319|       |                  i = png_do_expand_palette_rgba8_neon(png_ptr, row_info, row,
 4320|       |                      &sp, &dp);
 4321|       |               }
 4322|       |#else
 4323|    204|               PNG_UNUSED(png_ptr)
  ------------------
  |  |  488|    204|#  define PNG_UNUSED(param) (void)param;
  ------------------
 4324|    204|#endif
 4325|       |
 4326|  2.90k|               for (; i < row_width; i++)
  ------------------
  |  Branch (4326:23): [True: 2.69k, False: 204]
  ------------------
 4327|  2.69k|               {
 4328|  2.69k|                  if ((int)(*sp) >= num_trans)
  ------------------
  |  Branch (4328:23): [True: 809, False: 1.88k]
  ------------------
 4329|    809|                     *dp-- = 0xff;
 4330|  1.88k|                  else
 4331|  1.88k|                     *dp-- = trans_alpha[*sp];
 4332|  2.69k|                  *dp-- = palette[*sp].blue;
 4333|  2.69k|                  *dp-- = palette[*sp].green;
 4334|  2.69k|                  *dp-- = palette[*sp].red;
 4335|  2.69k|                  sp--;
 4336|  2.69k|               }
 4337|    204|               row_info->bit_depth = 8;
 4338|    204|               row_info->pixel_depth = 32;
 4339|    204|               row_info->rowbytes = row_width * 4;
 4340|    204|               row_info->color_type = 6;
 4341|    204|               row_info->channels = 4;
 4342|    204|            }
 4343|       |
 4344|  1.24k|            else
 4345|  1.24k|            {
 4346|  1.24k|               sp = row + (size_t)row_width - 1;
 4347|  1.24k|               dp = row + (size_t)(row_width * 3) - 1;
 4348|  1.24k|               i = 0;
 4349|       |#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
 4350|       |               i = png_do_expand_palette_rgb8_neon(png_ptr, row_info, row,
 4351|       |                   &sp, &dp);
 4352|       |#else
 4353|  1.24k|               PNG_UNUSED(png_ptr)
  ------------------
  |  |  488|  1.24k|#  define PNG_UNUSED(param) (void)param;
  ------------------
 4354|  1.24k|#endif
 4355|       |
 4356|  87.2k|               for (; i < row_width; i++)
  ------------------
  |  Branch (4356:23): [True: 86.0k, False: 1.24k]
  ------------------
 4357|  86.0k|               {
 4358|  86.0k|                  *dp-- = palette[*sp].blue;
 4359|  86.0k|                  *dp-- = palette[*sp].green;
 4360|  86.0k|                  *dp-- = palette[*sp].red;
 4361|  86.0k|                  sp--;
 4362|  86.0k|               }
 4363|       |
 4364|  1.24k|               row_info->bit_depth = 8;
 4365|  1.24k|               row_info->pixel_depth = 24;
 4366|  1.24k|               row_info->rowbytes = row_width * 3;
 4367|  1.24k|               row_info->color_type = 2;
 4368|  1.24k|               row_info->channels = 3;
 4369|  1.24k|            }
 4370|  1.44k|         }
 4371|  1.44k|      }
 4372|  1.44k|   }
 4373|  1.44k|}
pngrtran.c:png_do_expand:
 4381|  13.1k|{
 4382|  13.1k|   int shift, value;
 4383|  13.1k|   png_bytep sp, dp;
 4384|  13.1k|   png_uint_32 i;
 4385|  13.1k|   png_uint_32 row_width=row_info->width;
 4386|       |
 4387|  13.1k|   png_debug(1, "in png_do_expand");
  ------------------
  |  |  145|  13.1k|#  define png_debug(l, m) ((void)0)
  ------------------
 4388|       |
 4389|  13.1k|   if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
  ------------------
  |  |  667|  13.1k|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (4389:8): [True: 6.57k, False: 6.62k]
  ------------------
 4390|  6.57k|   {
 4391|  6.57k|      unsigned int gray = trans_color != NULL ? trans_color->gray : 0;
  ------------------
  |  Branch (4391:27): [True: 1.38k, False: 5.19k]
  ------------------
 4392|       |
 4393|  6.57k|      if (row_info->bit_depth < 8)
  ------------------
  |  Branch (4393:11): [True: 1.15k, False: 5.42k]
  ------------------
 4394|  1.15k|      {
 4395|  1.15k|         switch (row_info->bit_depth)
 4396|  1.15k|         {
 4397|    335|            case 1:
  ------------------
  |  Branch (4397:13): [True: 335, False: 817]
  ------------------
 4398|    335|            {
 4399|    335|               gray = (gray & 0x01) * 0xff;
 4400|    335|               sp = row + (size_t)((row_width - 1) >> 3);
 4401|    335|               dp = row + (size_t)row_width - 1;
 4402|    335|               shift = 7 - (int)((row_width + 7) & 0x07);
 4403|  4.49M|               for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (4403:28): [True: 4.49M, False: 335]
  ------------------
 4404|  4.49M|               {
 4405|  4.49M|                  if ((*sp >> shift) & 0x01)
  ------------------
  |  Branch (4405:23): [True: 553k, False: 3.93M]
  ------------------
 4406|   553k|                     *dp = 0xff;
 4407|       |
 4408|  3.93M|                  else
 4409|  3.93M|                     *dp = 0;
 4410|       |
 4411|  4.49M|                  if (shift == 7)
  ------------------
  |  Branch (4411:23): [True: 561k, False: 3.92M]
  ------------------
 4412|   561k|                  {
 4413|   561k|                     shift = 0;
 4414|   561k|                     sp--;
 4415|   561k|                  }
 4416|       |
 4417|  3.92M|                  else
 4418|  3.92M|                     shift++;
 4419|       |
 4420|  4.49M|                  dp--;
 4421|  4.49M|               }
 4422|    335|               break;
 4423|      0|            }
 4424|       |
 4425|    308|            case 2:
  ------------------
  |  Branch (4425:13): [True: 308, False: 844]
  ------------------
 4426|    308|            {
 4427|    308|               gray = (gray & 0x03) * 0x55;
 4428|    308|               sp = row + (size_t)((row_width - 1) >> 2);
 4429|    308|               dp = row + (size_t)row_width - 1;
 4430|    308|               shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
 4431|   915k|               for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (4431:28): [True: 914k, False: 308]
  ------------------
 4432|   914k|               {
 4433|   914k|                  value = (*sp >> shift) & 0x03;
 4434|   914k|                  *dp = (png_byte)(value | (value << 2) | (value << 4) |
 4435|   914k|                     (value << 6));
 4436|   914k|                  if (shift == 6)
  ------------------
  |  Branch (4436:23): [True: 228k, False: 685k]
  ------------------
 4437|   228k|                  {
 4438|   228k|                     shift = 0;
 4439|   228k|                     sp--;
 4440|   228k|                  }
 4441|       |
 4442|   685k|                  else
 4443|   685k|                     shift += 2;
 4444|       |
 4445|   914k|                  dp--;
 4446|   914k|               }
 4447|    308|               break;
 4448|      0|            }
 4449|       |
 4450|    509|            case 4:
  ------------------
  |  Branch (4450:13): [True: 509, False: 643]
  ------------------
 4451|    509|            {
 4452|    509|               gray = (gray & 0x0f) * 0x11;
 4453|    509|               sp = row + (size_t)((row_width - 1) >> 1);
 4454|    509|               dp = row + (size_t)row_width - 1;
 4455|    509|               shift = (int)((1 - ((row_width + 1) & 0x01)) << 2);
 4456|   102k|               for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (4456:28): [True: 101k, False: 509]
  ------------------
 4457|   101k|               {
 4458|   101k|                  value = (*sp >> shift) & 0x0f;
 4459|   101k|                  *dp = (png_byte)(value | (value << 4));
 4460|   101k|                  if (shift == 4)
  ------------------
  |  Branch (4460:23): [True: 50.8k, False: 50.8k]
  ------------------
 4461|  50.8k|                  {
 4462|  50.8k|                     shift = 0;
 4463|  50.8k|                     sp--;
 4464|  50.8k|                  }
 4465|       |
 4466|  50.8k|                  else
 4467|  50.8k|                     shift = 4;
 4468|       |
 4469|   101k|                  dp--;
 4470|   101k|               }
 4471|    509|               break;
 4472|      0|            }
 4473|       |
 4474|      0|            default:
  ------------------
  |  Branch (4474:13): [True: 0, False: 1.15k]
  ------------------
 4475|      0|               break;
 4476|  1.15k|         }
 4477|       |
 4478|  1.15k|         row_info->bit_depth = 8;
 4479|  1.15k|         row_info->pixel_depth = 8;
 4480|  1.15k|         row_info->rowbytes = row_width;
 4481|  1.15k|      }
 4482|       |
 4483|  6.57k|      if (trans_color != NULL)
  ------------------
  |  Branch (4483:11): [True: 1.38k, False: 5.19k]
  ------------------
 4484|  1.38k|      {
 4485|  1.38k|         if (row_info->bit_depth == 8)
  ------------------
  |  Branch (4485:14): [True: 265, False: 1.11k]
  ------------------
 4486|    265|         {
 4487|    265|            gray = gray & 0xff;
 4488|    265|            sp = row + (size_t)row_width - 1;
 4489|    265|            dp = row + ((size_t)row_width << 1) - 1;
 4490|       |
 4491|  3.99k|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (4491:25): [True: 3.73k, False: 265]
  ------------------
 4492|  3.73k|            {
 4493|  3.73k|               if ((*sp & 0xffU) == gray)
  ------------------
  |  Branch (4493:20): [True: 1.63k, False: 2.09k]
  ------------------
 4494|  1.63k|                  *dp-- = 0;
 4495|       |
 4496|  2.09k|               else
 4497|  2.09k|                  *dp-- = 0xff;
 4498|       |
 4499|  3.73k|               *dp-- = *sp--;
 4500|  3.73k|            }
 4501|    265|         }
 4502|       |
 4503|  1.11k|         else if (row_info->bit_depth == 16)
  ------------------
  |  Branch (4503:19): [True: 1.11k, False: 0]
  ------------------
 4504|  1.11k|         {
 4505|  1.11k|            unsigned int gray_high = (gray >> 8) & 0xff;
 4506|  1.11k|            unsigned int gray_low = gray & 0xff;
 4507|  1.11k|            sp = row + row_info->rowbytes - 1;
 4508|  1.11k|            dp = row + (row_info->rowbytes << 1) - 1;
 4509|  3.43k|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (4509:25): [True: 2.31k, False: 1.11k]
  ------------------
 4510|  2.31k|            {
 4511|  2.31k|               if ((*(sp - 1) & 0xffU) == gray_high &&
  ------------------
  |  Branch (4511:20): [True: 683, False: 1.63k]
  ------------------
 4512|  2.31k|                   (*(sp) & 0xffU) == gray_low)
  ------------------
  |  Branch (4512:20): [True: 483, False: 200]
  ------------------
 4513|    483|               {
 4514|    483|                  *dp-- = 0;
 4515|    483|                  *dp-- = 0;
 4516|    483|               }
 4517|       |
 4518|  1.83k|               else
 4519|  1.83k|               {
 4520|  1.83k|                  *dp-- = 0xff;
 4521|  1.83k|                  *dp-- = 0xff;
 4522|  1.83k|               }
 4523|       |
 4524|  2.31k|               *dp-- = *sp--;
 4525|  2.31k|               *dp-- = *sp--;
 4526|  2.31k|            }
 4527|  1.11k|         }
 4528|       |
 4529|  1.38k|         row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
  ------------------
  |  |  671|  1.38k|#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|  1.38k|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
 4530|  1.38k|         row_info->channels = 2;
 4531|  1.38k|         row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1);
 4532|  1.38k|         row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
  ------------------
  |  |  764|  1.38k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 1.38k, False: 0]
  |  |  ------------------
  |  |  765|  1.38k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|  1.38k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
 4533|  1.38k|             row_width);
 4534|  1.38k|      }
 4535|  6.57k|   }
 4536|  6.62k|   else if (row_info->color_type == PNG_COLOR_TYPE_RGB &&
  ------------------
  |  |  669|  13.2k|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|  6.62k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (4536:13): [True: 5.47k, False: 1.14k]
  ------------------
 4537|  6.62k|       trans_color != NULL)
  ------------------
  |  Branch (4537:8): [True: 5.47k, False: 0]
  ------------------
 4538|  5.47k|   {
 4539|  5.47k|      if (row_info->bit_depth == 8)
  ------------------
  |  Branch (4539:11): [True: 929, False: 4.54k]
  ------------------
 4540|    929|      {
 4541|    929|         png_byte red = (png_byte)(trans_color->red & 0xff);
 4542|    929|         png_byte green = (png_byte)(trans_color->green & 0xff);
 4543|    929|         png_byte blue = (png_byte)(trans_color->blue & 0xff);
 4544|    929|         sp = row + (size_t)row_info->rowbytes - 1;
 4545|    929|         dp = row + ((size_t)row_width << 2) - 1;
 4546|   110k|         for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (4546:22): [True: 109k, False: 929]
  ------------------
 4547|   109k|         {
 4548|   109k|            if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue)
  ------------------
  |  Branch (4548:17): [True: 1.68k, False: 107k]
  |  Branch (4548:37): [True: 775, False: 910]
  |  Branch (4548:59): [True: 322, False: 453]
  ------------------
 4549|    322|               *dp-- = 0;
 4550|       |
 4551|   109k|            else
 4552|   109k|               *dp-- = 0xff;
 4553|       |
 4554|   109k|            *dp-- = *sp--;
 4555|   109k|            *dp-- = *sp--;
 4556|   109k|            *dp-- = *sp--;
 4557|   109k|         }
 4558|    929|      }
 4559|  4.54k|      else if (row_info->bit_depth == 16)
  ------------------
  |  Branch (4559:16): [True: 4.54k, False: 0]
  ------------------
 4560|  4.54k|      {
 4561|  4.54k|         png_byte red_high = (png_byte)((trans_color->red >> 8) & 0xff);
 4562|  4.54k|         png_byte green_high = (png_byte)((trans_color->green >> 8) & 0xff);
 4563|  4.54k|         png_byte blue_high = (png_byte)((trans_color->blue >> 8) & 0xff);
 4564|  4.54k|         png_byte red_low = (png_byte)(trans_color->red & 0xff);
 4565|  4.54k|         png_byte green_low = (png_byte)(trans_color->green & 0xff);
 4566|  4.54k|         png_byte blue_low = (png_byte)(trans_color->blue & 0xff);
 4567|  4.54k|         sp = row + row_info->rowbytes - 1;
 4568|  4.54k|         dp = row + ((size_t)row_width << 3) - 1;
 4569|   202k|         for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (4569:22): [True: 197k, False: 4.54k]
  ------------------
 4570|   197k|         {
 4571|   197k|            if (*(sp - 5) == red_high &&
  ------------------
  |  Branch (4571:17): [True: 8.96k, False: 188k]
  ------------------
 4572|   197k|                *(sp - 4) == red_low &&
  ------------------
  |  Branch (4572:17): [True: 3.77k, False: 5.18k]
  ------------------
 4573|   197k|                *(sp - 3) == green_high &&
  ------------------
  |  Branch (4573:17): [True: 2.90k, False: 869]
  ------------------
 4574|   197k|                *(sp - 2) == green_low &&
  ------------------
  |  Branch (4574:17): [True: 2.51k, False: 391]
  ------------------
 4575|   197k|                *(sp - 1) == blue_high &&
  ------------------
  |  Branch (4575:17): [True: 1.35k, False: 1.15k]
  ------------------
 4576|   197k|                *(sp    ) == blue_low)
  ------------------
  |  Branch (4576:17): [True: 920, False: 438]
  ------------------
 4577|    920|            {
 4578|    920|               *dp-- = 0;
 4579|    920|               *dp-- = 0;
 4580|    920|            }
 4581|       |
 4582|   196k|            else
 4583|   196k|            {
 4584|   196k|               *dp-- = 0xff;
 4585|   196k|               *dp-- = 0xff;
 4586|   196k|            }
 4587|       |
 4588|   197k|            *dp-- = *sp--;
 4589|   197k|            *dp-- = *sp--;
 4590|   197k|            *dp-- = *sp--;
 4591|   197k|            *dp-- = *sp--;
 4592|   197k|            *dp-- = *sp--;
 4593|   197k|            *dp-- = *sp--;
 4594|   197k|         }
 4595|  4.54k|      }
 4596|  5.47k|      row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
  ------------------
  |  |  670|  5.47k|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|  5.47k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|  5.47k|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
 4597|  5.47k|      row_info->channels = 4;
 4598|  5.47k|      row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2);
 4599|  5.47k|      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
  ------------------
  |  |  764|  5.47k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 5.47k, False: 0]
  |  |  ------------------
  |  |  765|  5.47k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|  5.47k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
 4600|  5.47k|   }
 4601|  13.1k|}
pngrtran.c:png_do_gray_to_rgb:
 2857|  7.72k|{
 2858|  7.72k|   png_uint_32 i;
 2859|  7.72k|   png_uint_32 row_width = row_info->width;
 2860|       |
 2861|  7.72k|   png_debug(1, "in png_do_gray_to_rgb");
  ------------------
  |  |  145|  7.72k|#  define png_debug(l, m) ((void)0)
  ------------------
 2862|       |
 2863|  7.72k|   if (row_info->bit_depth >= 8 &&
  ------------------
  |  Branch (2863:8): [True: 7.72k, False: 0]
  ------------------
 2864|  7.72k|       (row_info->color_type & PNG_COLOR_MASK_COLOR) == 0)
  ------------------
  |  |  663|  7.72k|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (2864:8): [True: 7.72k, False: 0]
  ------------------
 2865|  7.72k|   {
 2866|  7.72k|      if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
  ------------------
  |  |  667|  7.72k|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (2866:11): [True: 5.19k, False: 2.53k]
  ------------------
 2867|  5.19k|      {
 2868|  5.19k|         if (row_info->bit_depth == 8)
  ------------------
  |  Branch (2868:14): [True: 2.92k, False: 2.27k]
  ------------------
 2869|  2.92k|         {
 2870|       |            /* This changes G to RGB */
 2871|  2.92k|            png_bytep sp = row + (size_t)row_width - 1;
 2872|  2.92k|            png_bytep dp = sp  + (size_t)row_width * 2;
 2873|  5.50M|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2873:25): [True: 5.50M, False: 2.92k]
  ------------------
 2874|  5.50M|            {
 2875|  5.50M|               *(dp--) = *sp;
 2876|  5.50M|               *(dp--) = *sp;
 2877|  5.50M|               *(dp--) = *(sp--);
 2878|  5.50M|            }
 2879|  2.92k|         }
 2880|       |
 2881|  2.27k|         else
 2882|  2.27k|         {
 2883|       |            /* This changes GG to RRGGBB */
 2884|  2.27k|            png_bytep sp = row + (size_t)row_width * 2 - 1;
 2885|  2.27k|            png_bytep dp = sp  + (size_t)row_width * 4;
 2886|  32.9k|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2886:25): [True: 30.6k, False: 2.27k]
  ------------------
 2887|  30.6k|            {
 2888|  30.6k|               *(dp--) = *sp;
 2889|  30.6k|               *(dp--) = *(sp - 1);
 2890|  30.6k|               *(dp--) = *sp;
 2891|  30.6k|               *(dp--) = *(sp - 1);
 2892|  30.6k|               *(dp--) = *(sp--);
 2893|  30.6k|               *(dp--) = *(sp--);
 2894|  30.6k|            }
 2895|  2.27k|         }
 2896|  5.19k|      }
 2897|       |
 2898|  2.53k|      else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
  ------------------
  |  |  671|  2.53k|#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|  2.53k|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (2898:16): [True: 2.53k, False: 0]
  ------------------
 2899|  2.53k|      {
 2900|  2.53k|         if (row_info->bit_depth == 8)
  ------------------
  |  Branch (2900:14): [True: 312, False: 2.21k]
  ------------------
 2901|    312|         {
 2902|       |            /* This changes GA to RGBA */
 2903|    312|            png_bytep sp = row + (size_t)row_width * 2 - 1;
 2904|    312|            png_bytep dp = sp  + (size_t)row_width * 2;
 2905|  4.24k|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2905:25): [True: 3.92k, False: 312]
  ------------------
 2906|  3.92k|            {
 2907|  3.92k|               *(dp--) = *(sp--);
 2908|  3.92k|               *(dp--) = *sp;
 2909|  3.92k|               *(dp--) = *sp;
 2910|  3.92k|               *(dp--) = *(sp--);
 2911|  3.92k|            }
 2912|    312|         }
 2913|       |
 2914|  2.21k|         else
 2915|  2.21k|         {
 2916|       |            /* This changes GGAA to RRGGBBAA */
 2917|  2.21k|            png_bytep sp = row + (size_t)row_width * 4 - 1;
 2918|  2.21k|            png_bytep dp = sp  + (size_t)row_width * 4;
 2919|  8.91k|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2919:25): [True: 6.69k, False: 2.21k]
  ------------------
 2920|  6.69k|            {
 2921|  6.69k|               *(dp--) = *(sp--);
 2922|  6.69k|               *(dp--) = *(sp--);
 2923|  6.69k|               *(dp--) = *sp;
 2924|  6.69k|               *(dp--) = *(sp - 1);
 2925|  6.69k|               *(dp--) = *sp;
 2926|  6.69k|               *(dp--) = *(sp - 1);
 2927|  6.69k|               *(dp--) = *(sp--);
 2928|  6.69k|               *(dp--) = *(sp--);
 2929|  6.69k|            }
 2930|  2.21k|         }
 2931|  2.53k|      }
 2932|  7.72k|      row_info->channels = (png_byte)(row_info->channels + 2);
 2933|  7.72k|      row_info->color_type |= PNG_COLOR_MASK_COLOR;
  ------------------
  |  |  663|  7.72k|#define PNG_COLOR_MASK_COLOR      2
  ------------------
 2934|  7.72k|      row_info->pixel_depth = (png_byte)(row_info->channels *
 2935|  7.72k|          row_info->bit_depth);
 2936|  7.72k|      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
  ------------------
  |  |  764|  7.72k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 7.72k, False: 0]
  |  |  ------------------
  |  |  765|  7.72k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|  7.72k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
 2937|  7.72k|   }
 2938|  7.72k|}
pngrtran.c:png_do_unpack:
 2149|  2.35k|{
 2150|  2.35k|   png_debug(1, "in png_do_unpack");
  ------------------
  |  |  145|  2.35k|#  define png_debug(l, m) ((void)0)
  ------------------
 2151|       |
 2152|  2.35k|   if (row_info->bit_depth < 8)
  ------------------
  |  Branch (2152:8): [True: 0, False: 2.35k]
  ------------------
 2153|      0|   {
 2154|      0|      png_uint_32 i;
 2155|      0|      png_uint_32 row_width=row_info->width;
 2156|       |
 2157|      0|      switch (row_info->bit_depth)
 2158|      0|      {
 2159|      0|         case 1:
  ------------------
  |  Branch (2159:10): [True: 0, False: 0]
  ------------------
 2160|      0|         {
 2161|      0|            png_bytep sp = row + (size_t)((row_width - 1) >> 3);
 2162|      0|            png_bytep dp = row + (size_t)row_width - 1;
 2163|      0|            png_uint_32 shift = 7U - ((row_width + 7U) & 0x07);
 2164|      0|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2164:25): [True: 0, False: 0]
  ------------------
 2165|      0|            {
 2166|      0|               *dp = (png_byte)((*sp >> shift) & 0x01);
 2167|       |
 2168|      0|               if (shift == 7)
  ------------------
  |  Branch (2168:20): [True: 0, False: 0]
  ------------------
 2169|      0|               {
 2170|      0|                  shift = 0;
 2171|      0|                  sp--;
 2172|      0|               }
 2173|       |
 2174|      0|               else
 2175|      0|                  shift++;
 2176|       |
 2177|      0|               dp--;
 2178|      0|            }
 2179|      0|            break;
 2180|      0|         }
 2181|       |
 2182|      0|         case 2:
  ------------------
  |  Branch (2182:10): [True: 0, False: 0]
  ------------------
 2183|      0|         {
 2184|       |
 2185|      0|            png_bytep sp = row + (size_t)((row_width - 1) >> 2);
 2186|      0|            png_bytep dp = row + (size_t)row_width - 1;
 2187|      0|            png_uint_32 shift = ((3U - ((row_width + 3U) & 0x03)) << 1);
 2188|      0|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2188:25): [True: 0, False: 0]
  ------------------
 2189|      0|            {
 2190|      0|               *dp = (png_byte)((*sp >> shift) & 0x03);
 2191|       |
 2192|      0|               if (shift == 6)
  ------------------
  |  Branch (2192:20): [True: 0, False: 0]
  ------------------
 2193|      0|               {
 2194|      0|                  shift = 0;
 2195|      0|                  sp--;
 2196|      0|               }
 2197|       |
 2198|      0|               else
 2199|      0|                  shift += 2;
 2200|       |
 2201|      0|               dp--;
 2202|      0|            }
 2203|      0|            break;
 2204|      0|         }
 2205|       |
 2206|      0|         case 4:
  ------------------
  |  Branch (2206:10): [True: 0, False: 0]
  ------------------
 2207|      0|         {
 2208|      0|            png_bytep sp = row + (size_t)((row_width - 1) >> 1);
 2209|      0|            png_bytep dp = row + (size_t)row_width - 1;
 2210|      0|            png_uint_32 shift = ((1U - ((row_width + 1U) & 0x01)) << 2);
 2211|      0|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2211:25): [True: 0, False: 0]
  ------------------
 2212|      0|            {
 2213|      0|               *dp = (png_byte)((*sp >> shift) & 0x0f);
 2214|       |
 2215|      0|               if (shift == 4)
  ------------------
  |  Branch (2215:20): [True: 0, False: 0]
  ------------------
 2216|      0|               {
 2217|      0|                  shift = 0;
 2218|      0|                  sp--;
 2219|      0|               }
 2220|       |
 2221|      0|               else
 2222|      0|                  shift = 4;
 2223|       |
 2224|      0|               dp--;
 2225|      0|            }
 2226|      0|            break;
 2227|      0|         }
 2228|       |
 2229|      0|         default:
  ------------------
  |  Branch (2229:10): [True: 0, False: 0]
  ------------------
 2230|      0|            break;
 2231|      0|      }
 2232|      0|      row_info->bit_depth = 8;
 2233|      0|      row_info->pixel_depth = (png_byte)(8 * row_info->channels);
 2234|      0|      row_info->rowbytes = row_width * row_info->channels;
 2235|      0|   }
 2236|  2.35k|}
pngrtran.c:png_do_read_filler:
 2671|   104k|{
 2672|   104k|   png_uint_32 i;
 2673|   104k|   png_uint_32 row_width = row_info->width;
 2674|       |
 2675|   104k|#ifdef PNG_READ_16BIT_SUPPORTED
 2676|   104k|   png_byte hi_filler = (png_byte)(filler>>8);
 2677|   104k|#endif
 2678|   104k|   png_byte lo_filler = (png_byte)filler;
 2679|       |
 2680|   104k|   png_debug(1, "in png_do_read_filler");
  ------------------
  |  |  145|   104k|#  define png_debug(l, m) ((void)0)
  ------------------
 2681|       |
 2682|   104k|   if (
 2683|   104k|       row_info->color_type == PNG_COLOR_TYPE_GRAY)
  ------------------
  |  |  667|   104k|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (2683:8): [True: 0, False: 104k]
  ------------------
 2684|      0|   {
 2685|      0|      if (row_info->bit_depth == 8)
  ------------------
  |  Branch (2685:11): [True: 0, False: 0]
  ------------------
 2686|      0|      {
 2687|      0|         if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
  ------------------
  |  |  711|      0|#define PNG_FLAG_FILLER_AFTER             0x0080U
  ------------------
  |  Branch (2687:14): [True: 0, False: 0]
  ------------------
 2688|      0|         {
 2689|       |            /* This changes the data from G to GX */
 2690|      0|            png_bytep sp = row + (size_t)row_width;
 2691|      0|            png_bytep dp =  sp + (size_t)row_width;
 2692|      0|            for (i = 1; i < row_width; i++)
  ------------------
  |  Branch (2692:25): [True: 0, False: 0]
  ------------------
 2693|      0|            {
 2694|      0|               *(--dp) = lo_filler;
 2695|      0|               *(--dp) = *(--sp);
 2696|      0|            }
 2697|      0|            *(--dp) = lo_filler;
 2698|      0|            row_info->channels = 2;
 2699|      0|            row_info->pixel_depth = 16;
 2700|      0|            row_info->rowbytes = row_width * 2;
 2701|      0|         }
 2702|       |
 2703|      0|         else
 2704|      0|         {
 2705|       |            /* This changes the data from G to XG */
 2706|      0|            png_bytep sp = row + (size_t)row_width;
 2707|      0|            png_bytep dp = sp  + (size_t)row_width;
 2708|      0|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2708:25): [True: 0, False: 0]
  ------------------
 2709|      0|            {
 2710|      0|               *(--dp) = *(--sp);
 2711|      0|               *(--dp) = lo_filler;
 2712|      0|            }
 2713|      0|            row_info->channels = 2;
 2714|      0|            row_info->pixel_depth = 16;
 2715|      0|            row_info->rowbytes = row_width * 2;
 2716|      0|         }
 2717|      0|      }
 2718|       |
 2719|      0|#ifdef PNG_READ_16BIT_SUPPORTED
 2720|      0|      else if (row_info->bit_depth == 16)
  ------------------
  |  Branch (2720:16): [True: 0, False: 0]
  ------------------
 2721|      0|      {
 2722|      0|         if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
  ------------------
  |  |  711|      0|#define PNG_FLAG_FILLER_AFTER             0x0080U
  ------------------
  |  Branch (2722:14): [True: 0, False: 0]
  ------------------
 2723|      0|         {
 2724|       |            /* This changes the data from GG to GGXX */
 2725|      0|            png_bytep sp = row + (size_t)row_width * 2;
 2726|      0|            png_bytep dp = sp  + (size_t)row_width * 2;
 2727|      0|            for (i = 1; i < row_width; i++)
  ------------------
  |  Branch (2727:25): [True: 0, False: 0]
  ------------------
 2728|      0|            {
 2729|      0|               *(--dp) = lo_filler;
 2730|      0|               *(--dp) = hi_filler;
 2731|      0|               *(--dp) = *(--sp);
 2732|      0|               *(--dp) = *(--sp);
 2733|      0|            }
 2734|      0|            *(--dp) = lo_filler;
 2735|      0|            *(--dp) = hi_filler;
 2736|      0|            row_info->channels = 2;
 2737|      0|            row_info->pixel_depth = 32;
 2738|      0|            row_info->rowbytes = row_width * 4;
 2739|      0|         }
 2740|       |
 2741|      0|         else
 2742|      0|         {
 2743|       |            /* This changes the data from GG to XXGG */
 2744|      0|            png_bytep sp = row + (size_t)row_width * 2;
 2745|      0|            png_bytep dp = sp  + (size_t)row_width * 2;
 2746|      0|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2746:25): [True: 0, False: 0]
  ------------------
 2747|      0|            {
 2748|      0|               *(--dp) = *(--sp);
 2749|      0|               *(--dp) = *(--sp);
 2750|      0|               *(--dp) = lo_filler;
 2751|      0|               *(--dp) = hi_filler;
 2752|      0|            }
 2753|      0|            row_info->channels = 2;
 2754|      0|            row_info->pixel_depth = 32;
 2755|      0|            row_info->rowbytes = row_width * 4;
 2756|      0|         }
 2757|      0|      }
 2758|      0|#endif
 2759|      0|   } /* COLOR_TYPE == GRAY */
 2760|   104k|   else if (row_info->color_type == PNG_COLOR_TYPE_RGB)
  ------------------
  |  |  669|   104k|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|   104k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (2760:13): [True: 29.4k, False: 75.0k]
  ------------------
 2761|  29.4k|   {
 2762|  29.4k|      if (row_info->bit_depth == 8)
  ------------------
  |  Branch (2762:11): [True: 15.3k, False: 14.0k]
  ------------------
 2763|  15.3k|      {
 2764|  15.3k|         if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
  ------------------
  |  |  711|  15.3k|#define PNG_FLAG_FILLER_AFTER             0x0080U
  ------------------
  |  Branch (2764:14): [True: 15.3k, False: 0]
  ------------------
 2765|  15.3k|         {
 2766|       |            /* This changes the data from RGB to RGBX */
 2767|  15.3k|            png_bytep sp = row + (size_t)row_width * 3;
 2768|  15.3k|            png_bytep dp = sp  + (size_t)row_width;
 2769|  12.9M|            for (i = 1; i < row_width; i++)
  ------------------
  |  Branch (2769:25): [True: 12.9M, False: 15.3k]
  ------------------
 2770|  12.9M|            {
 2771|  12.9M|               *(--dp) = lo_filler;
 2772|  12.9M|               *(--dp) = *(--sp);
 2773|  12.9M|               *(--dp) = *(--sp);
 2774|  12.9M|               *(--dp) = *(--sp);
 2775|  12.9M|            }
 2776|  15.3k|            *(--dp) = lo_filler;
 2777|  15.3k|            row_info->channels = 4;
 2778|  15.3k|            row_info->pixel_depth = 32;
 2779|  15.3k|            row_info->rowbytes = row_width * 4;
 2780|  15.3k|         }
 2781|       |
 2782|      0|         else
 2783|      0|         {
 2784|       |            /* This changes the data from RGB to XRGB */
 2785|      0|            png_bytep sp = row + (size_t)row_width * 3;
 2786|      0|            png_bytep dp = sp + (size_t)row_width;
 2787|      0|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2787:25): [True: 0, False: 0]
  ------------------
 2788|      0|            {
 2789|      0|               *(--dp) = *(--sp);
 2790|      0|               *(--dp) = *(--sp);
 2791|      0|               *(--dp) = *(--sp);
 2792|      0|               *(--dp) = lo_filler;
 2793|      0|            }
 2794|      0|            row_info->channels = 4;
 2795|      0|            row_info->pixel_depth = 32;
 2796|      0|            row_info->rowbytes = row_width * 4;
 2797|      0|         }
 2798|  15.3k|      }
 2799|       |
 2800|  14.0k|#ifdef PNG_READ_16BIT_SUPPORTED
 2801|  14.0k|      else if (row_info->bit_depth == 16)
  ------------------
  |  Branch (2801:16): [True: 14.0k, False: 0]
  ------------------
 2802|  14.0k|      {
 2803|  14.0k|         if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
  ------------------
  |  |  711|  14.0k|#define PNG_FLAG_FILLER_AFTER             0x0080U
  ------------------
  |  Branch (2803:14): [True: 14.0k, False: 0]
  ------------------
 2804|  14.0k|         {
 2805|       |            /* This changes the data from RRGGBB to RRGGBBXX */
 2806|  14.0k|            png_bytep sp = row + (size_t)row_width * 6;
 2807|  14.0k|            png_bytep dp = sp  + (size_t)row_width * 2;
 2808|  45.9k|            for (i = 1; i < row_width; i++)
  ------------------
  |  Branch (2808:25): [True: 31.9k, False: 14.0k]
  ------------------
 2809|  31.9k|            {
 2810|  31.9k|               *(--dp) = lo_filler;
 2811|  31.9k|               *(--dp) = hi_filler;
 2812|  31.9k|               *(--dp) = *(--sp);
 2813|  31.9k|               *(--dp) = *(--sp);
 2814|  31.9k|               *(--dp) = *(--sp);
 2815|  31.9k|               *(--dp) = *(--sp);
 2816|  31.9k|               *(--dp) = *(--sp);
 2817|  31.9k|               *(--dp) = *(--sp);
 2818|  31.9k|            }
 2819|  14.0k|            *(--dp) = lo_filler;
 2820|  14.0k|            *(--dp) = hi_filler;
 2821|  14.0k|            row_info->channels = 4;
 2822|  14.0k|            row_info->pixel_depth = 64;
 2823|  14.0k|            row_info->rowbytes = row_width * 8;
 2824|  14.0k|         }
 2825|       |
 2826|      0|         else
 2827|      0|         {
 2828|       |            /* This changes the data from RRGGBB to XXRRGGBB */
 2829|      0|            png_bytep sp = row + (size_t)row_width * 6;
 2830|      0|            png_bytep dp = sp  + (size_t)row_width * 2;
 2831|      0|            for (i = 0; i < row_width; i++)
  ------------------
  |  Branch (2831:25): [True: 0, False: 0]
  ------------------
 2832|      0|            {
 2833|      0|               *(--dp) = *(--sp);
 2834|      0|               *(--dp) = *(--sp);
 2835|      0|               *(--dp) = *(--sp);
 2836|      0|               *(--dp) = *(--sp);
 2837|      0|               *(--dp) = *(--sp);
 2838|      0|               *(--dp) = *(--sp);
 2839|      0|               *(--dp) = lo_filler;
 2840|      0|               *(--dp) = hi_filler;
 2841|      0|            }
 2842|       |
 2843|      0|            row_info->channels = 4;
 2844|      0|            row_info->pixel_depth = 64;
 2845|      0|            row_info->rowbytes = row_width * 8;
 2846|      0|         }
 2847|  14.0k|      }
 2848|  29.4k|#endif
 2849|  29.4k|   } /* COLOR_TYPE == RGB */
 2850|   104k|}

png_get_uint_31:
   23|   111k|{
   24|   111k|   png_uint_32 uval = png_get_uint_32(buf);
  ------------------
  |  | 2594|   111k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|   111k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|   111k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|   111k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|   111k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
   25|       |
   26|   111k|   if (uval > PNG_UINT_31_MAX)
  ------------------
  |  |  648|   111k|#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  ------------------
  |  Branch (26:8): [True: 27, False: 111k]
  ------------------
   27|     27|      png_error(png_ptr, "PNG unsigned integer out of range");
   28|       |
   29|   111k|   return uval;
   30|   111k|}
png_read_sig:
  122|  4.74k|{
  123|  4.74k|   size_t num_checked, num_to_check;
  124|       |
  125|       |   /* Exit if the user application does not expect a signature. */
  126|  4.74k|   if (png_ptr->sig_bytes >= 8)
  ------------------
  |  Branch (126:8): [True: 0, False: 4.74k]
  ------------------
  127|      0|      return;
  128|       |
  129|  4.74k|   num_checked = png_ptr->sig_bytes;
  130|  4.74k|   num_to_check = 8 - num_checked;
  131|       |
  132|  4.74k|#ifdef PNG_IO_STATE_SUPPORTED
  133|  4.74k|   png_ptr->io_state = PNG_IO_READING | PNG_IO_SIGNATURE;
  ------------------
  |  | 2419|  4.74k|#  define PNG_IO_READING     0x0001   /* currently reading */
  ------------------
                 png_ptr->io_state = PNG_IO_READING | PNG_IO_SIGNATURE;
  ------------------
  |  | 2421|  4.74k|#  define PNG_IO_SIGNATURE   0x0010   /* currently at the file signature */
  ------------------
  134|  4.74k|#endif
  135|       |
  136|       |   /* The signature must be serialized in a single I/O call. */
  137|  4.74k|   png_read_data(png_ptr, &(info_ptr->signature[num_checked]), num_to_check);
  138|  4.74k|   png_ptr->sig_bytes = 8;
  139|       |
  140|  4.74k|   if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
  ------------------
  |  Branch (140:8): [True: 0, False: 4.74k]
  ------------------
  141|      0|   {
  142|      0|      if (num_checked < 4 &&
  ------------------
  |  Branch (142:11): [True: 0, False: 0]
  ------------------
  143|      0|          png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4) != 0)
  ------------------
  |  Branch (143:11): [True: 0, False: 0]
  ------------------
  144|      0|         png_error(png_ptr, "Not a PNG file");
  145|      0|      else
  146|      0|         png_error(png_ptr, "PNG file corrupted by ASCII conversion");
  147|      0|   }
  148|  4.74k|   if (num_checked < 3)
  ------------------
  |  Branch (148:8): [True: 4.74k, False: 0]
  ------------------
  149|  4.74k|      png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
  ------------------
  |  |  661|  4.74k|#define PNG_HAVE_PNG_SIGNATURE    0x1000U
  ------------------
  150|  4.74k|}
png_read_chunk_header:
  157|   104k|{
  158|   104k|   png_byte buf[8];
  159|   104k|   png_uint_32 length;
  160|       |
  161|   104k|#ifdef PNG_IO_STATE_SUPPORTED
  162|   104k|   png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_HDR;
  ------------------
  |  | 2419|   104k|#  define PNG_IO_READING     0x0001   /* currently reading */
  ------------------
                 png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_HDR;
  ------------------
  |  | 2422|   104k|#  define PNG_IO_CHUNK_HDR   0x0020   /* currently at the chunk header */
  ------------------
  163|   104k|#endif
  164|       |
  165|       |   /* Read the length and the chunk name.
  166|       |    * This must be performed in a single I/O call.
  167|       |    */
  168|   104k|   png_read_data(png_ptr, buf, 8);
  169|   104k|   length = png_get_uint_31(png_ptr, buf);
  170|       |
  171|       |   /* Put the chunk name into png_ptr->chunk_name. */
  172|   104k|   png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(buf+4);
  ------------------
  |  |  905|   104k|   PNG_U32(0xff & (s)[0], 0xff & (s)[1], 0xff & (s)[2], 0xff & (s)[3])
  |  |  ------------------
  |  |  |  |  848|   104k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|   104k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|   104k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|   104k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|   104k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  173|       |
  174|   104k|   png_debug2(0, "Reading chunk typeid = 0x%lx, length = %lu",
  ------------------
  |  |  151|   104k|#  define png_debug2(l, m, p1, p2) ((void)0)
  ------------------
  175|   104k|       (unsigned long)png_ptr->chunk_name, (unsigned long)length);
  176|       |
  177|       |   /* Reset the crc and run it over the chunk name. */
  178|   104k|   png_reset_crc(png_ptr);
  179|   104k|   png_calculate_crc(png_ptr, buf + 4, 4);
  180|       |
  181|       |   /* Check to see if chunk name is valid. */
  182|   104k|   png_check_chunk_name(png_ptr, png_ptr->chunk_name);
  183|       |
  184|       |   /* Check for too-large chunk length */
  185|   104k|   png_check_chunk_length(png_ptr, length);
  186|       |
  187|   104k|#ifdef PNG_IO_STATE_SUPPORTED
  188|   104k|   png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA;
  ------------------
  |  | 2419|   104k|#  define PNG_IO_READING     0x0001   /* currently reading */
  ------------------
                 png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA;
  ------------------
  |  | 2423|   104k|#  define PNG_IO_CHUNK_DATA  0x0040   /* currently at the chunk data */
  ------------------
  189|   104k|#endif
  190|       |
  191|   104k|   return length;
  192|   104k|}
png_crc_read:
  197|  1.13M|{
  198|  1.13M|   if (png_ptr == NULL)
  ------------------
  |  Branch (198:8): [True: 0, False: 1.13M]
  ------------------
  199|      0|      return;
  200|       |
  201|  1.13M|   png_read_data(png_ptr, buf, length);
  202|  1.13M|   png_calculate_crc(png_ptr, buf, length);
  203|  1.13M|}
png_crc_finish:
  212|   101k|{
  213|       |   /* The size of the local buffer for inflate is a good guess as to a
  214|       |    * reasonable size to use for buffering reads from the application.
  215|       |    */
  216|   107k|   while (skip > 0)
  ------------------
  |  Branch (216:11): [True: 6.17k, False: 101k]
  ------------------
  217|  6.17k|   {
  218|  6.17k|      png_uint_32 len;
  219|  6.17k|      png_byte tmpbuf[PNG_INFLATE_BUF_SIZE];
  220|       |
  221|  6.17k|      len = (sizeof tmpbuf);
  222|  6.17k|      if (len > skip)
  ------------------
  |  Branch (222:11): [True: 4.87k, False: 1.30k]
  ------------------
  223|  4.87k|         len = skip;
  224|  6.17k|      skip -= len;
  225|       |
  226|  6.17k|      png_crc_read(png_ptr, tmpbuf, len);
  227|  6.17k|   }
  228|       |
  229|   101k|   if (png_crc_error(png_ptr) != 0)
  ------------------
  |  Branch (229:8): [True: 51.8k, False: 49.9k]
  ------------------
  230|  51.8k|   {
  231|  51.8k|      if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0 ?
  ------------------
  |  |  922|  51.8k|#define PNG_CHUNK_ANCILLARY(c)   (1 & ((c) >> 29))
  ------------------
  |  Branch (231:11): [True: 51.8k, False: 28]
  |  Branch (231:11): [True: 51.8k, False: 28]
  ------------------
  232|  51.8k|          (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) == 0 :
  ------------------
  |  |  713|  51.8k|#define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200U
  ------------------
  233|  51.8k|          (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_USE) != 0)
  ------------------
  |  |  714|     28|#define PNG_FLAG_CRC_CRITICAL_USE         0x0400U
  ------------------
  234|  51.8k|      {
  235|  51.8k|         png_chunk_warning(png_ptr, "CRC error");
  236|  51.8k|      }
  237|       |
  238|     28|      else
  239|     28|         png_chunk_error(png_ptr, "CRC error");
  240|       |
  241|  51.8k|      return 1;
  242|  51.8k|   }
  243|       |
  244|  49.9k|   return 0;
  245|   101k|}
png_crc_error:
  252|   100k|{
  253|   100k|   png_byte crc_bytes[4];
  254|   100k|   png_uint_32 crc;
  255|   100k|   int need_crc = 1;
  256|       |
  257|   100k|   if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0)
  ------------------
  |  |  922|   100k|#define PNG_CHUNK_ANCILLARY(c)   (1 & ((c) >> 29))
  ------------------
  |  Branch (257:8): [True: 91.7k, False: 8.75k]
  ------------------
  258|  91.7k|   {
  259|  91.7k|      if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
  ------------------
  |  |  736|  91.7k|#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
  |  |  ------------------
  |  |  |  |  712|  91.7k|#define PNG_FLAG_CRC_ANCILLARY_USE        0x0100U
  |  |  ------------------
  |  |  737|  91.7k|                                     PNG_FLAG_CRC_ANCILLARY_NOWARN)
  |  |  ------------------
  |  |  |  |  713|  91.7k|#define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200U
  |  |  ------------------
  ------------------
  |  Branch (259:11): [True: 0, False: 91.7k]
  ------------------
  260|  91.7k|          (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
  ------------------
  |  |  712|  91.7k|#define PNG_FLAG_CRC_ANCILLARY_USE        0x0100U
  ------------------
                        (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
  ------------------
  |  |  713|  91.7k|#define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200U
  ------------------
  261|      0|         need_crc = 0;
  262|  91.7k|   }
  263|       |
  264|  8.75k|   else /* critical */
  265|  8.75k|   {
  266|  8.75k|      if ((png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) != 0)
  ------------------
  |  |  715|  8.75k|#define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800U
  ------------------
  |  Branch (266:11): [True: 0, False: 8.75k]
  ------------------
  267|      0|         need_crc = 0;
  268|  8.75k|   }
  269|       |
  270|   100k|#ifdef PNG_IO_STATE_SUPPORTED
  271|   100k|   png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_CRC;
  ------------------
  |  | 2419|   100k|#  define PNG_IO_READING     0x0001   /* currently reading */
  ------------------
                 png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_CRC;
  ------------------
  |  | 2424|   100k|#  define PNG_IO_CHUNK_CRC   0x0080   /* currently at the chunk crc */
  ------------------
  272|   100k|#endif
  273|       |
  274|       |   /* The chunk CRC must be serialized in a single I/O call. */
  275|   100k|   png_read_data(png_ptr, crc_bytes, 4);
  276|       |
  277|   100k|   if (need_crc != 0)
  ------------------
  |  Branch (277:8): [True: 99.6k, False: 818]
  ------------------
  278|  99.6k|   {
  279|  99.6k|      crc = png_get_uint_32(crc_bytes);
  ------------------
  |  | 2594|  99.6k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  99.6k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  99.6k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  99.6k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  99.6k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
  280|  99.6k|      return crc != png_ptr->crc;
  281|  99.6k|   }
  282|       |
  283|    818|   else
  284|    818|      return 0;
  285|   100k|}
png_zlib_inflate:
  453|   154k|{
  454|   154k|   if (png_ptr->zstream_start && png_ptr->zstream.avail_in > 0)
  ------------------
  |  Branch (454:8): [True: 9.89k, False: 144k]
  |  Branch (454:34): [True: 9.89k, False: 0]
  ------------------
  455|  9.89k|   {
  456|  9.89k|      if ((*png_ptr->zstream.next_in >> 4) > 7)
  ------------------
  |  Branch (456:11): [True: 331, False: 9.56k]
  ------------------
  457|    331|      {
  458|    331|         png_ptr->zstream.msg = "invalid window size (libpng)";
  459|    331|         return Z_DATA_ERROR;
  460|    331|      }
  461|       |
  462|  9.56k|      png_ptr->zstream_start = 0;
  463|  9.56k|   }
  464|       |
  465|   153k|   return inflate(&png_ptr->zstream, flush);
  466|   154k|}
png_handle_IHDR:
  838|  4.71k|{
  839|  4.71k|   png_byte buf[13];
  840|  4.71k|   png_uint_32 width, height;
  841|  4.71k|   int bit_depth, color_type, compression_type, filter_type;
  842|  4.71k|   int interlace_type;
  843|       |
  844|  4.71k|   png_debug(1, "in png_handle_IHDR");
  ------------------
  |  |  145|  4.71k|#  define png_debug(l, m) ((void)0)
  ------------------
  845|       |
  846|  4.71k|   if ((png_ptr->mode & PNG_HAVE_IHDR) != 0)
  ------------------
  |  |  643|  4.71k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (846:8): [True: 2, False: 4.71k]
  ------------------
  847|      2|      png_chunk_error(png_ptr, "out of place");
  848|       |
  849|       |   /* Check the length */
  850|  4.71k|   if (length != 13)
  ------------------
  |  Branch (850:8): [True: 0, False: 4.71k]
  ------------------
  851|      0|      png_chunk_error(png_ptr, "invalid");
  852|       |
  853|  4.71k|   png_ptr->mode |= PNG_HAVE_IHDR;
  ------------------
  |  |  643|  4.71k|#define PNG_HAVE_IHDR  0x01
  ------------------
  854|       |
  855|  4.71k|   png_crc_read(png_ptr, buf, 13);
  856|  4.71k|   png_crc_finish(png_ptr, 0);
  857|       |
  858|  4.71k|   width = png_get_uint_31(png_ptr, buf);
  859|  4.71k|   height = png_get_uint_31(png_ptr, buf + 4);
  860|  4.71k|   bit_depth = buf[8];
  861|  4.71k|   color_type = buf[9];
  862|  4.71k|   compression_type = buf[10];
  863|  4.71k|   filter_type = buf[11];
  864|  4.71k|   interlace_type = buf[12];
  865|       |
  866|       |   /* Set internal variables */
  867|  4.71k|   png_ptr->width = width;
  868|  4.71k|   png_ptr->height = height;
  869|  4.71k|   png_ptr->bit_depth = (png_byte)bit_depth;
  870|  4.71k|   png_ptr->interlaced = (png_byte)interlace_type;
  871|  4.71k|   png_ptr->color_type = (png_byte)color_type;
  872|  4.71k|#ifdef PNG_MNG_FEATURES_SUPPORTED
  873|  4.71k|   png_ptr->filter_type = (png_byte)filter_type;
  874|  4.71k|#endif
  875|  4.71k|   png_ptr->compression_type = (png_byte)compression_type;
  876|       |
  877|       |   /* Find number of channels */
  878|  4.71k|   switch (png_ptr->color_type)
  879|  4.71k|   {
  880|      0|      default: /* invalid, png_set_IHDR calls png_error */
  ------------------
  |  Branch (880:7): [True: 0, False: 4.71k]
  ------------------
  881|  1.38k|      case PNG_COLOR_TYPE_GRAY:
  ------------------
  |  |  667|  1.38k|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (881:7): [True: 1.38k, False: 3.32k]
  ------------------
  882|  2.62k|      case PNG_COLOR_TYPE_PALETTE:
  ------------------
  |  |  668|  2.62k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  2.62k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  2.62k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (882:7): [True: 1.24k, False: 3.46k]
  ------------------
  883|  2.62k|         png_ptr->channels = 1;
  884|  2.62k|         break;
  885|       |
  886|  1.64k|      case PNG_COLOR_TYPE_RGB:
  ------------------
  |  |  669|  1.64k|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|  1.64k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (886:7): [True: 1.64k, False: 3.06k]
  ------------------
  887|  1.64k|         png_ptr->channels = 3;
  888|  1.64k|         break;
  889|       |
  890|     76|      case PNG_COLOR_TYPE_GRAY_ALPHA:
  ------------------
  |  |  671|     76|#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|     76|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (890:7): [True: 76, False: 4.63k]
  ------------------
  891|     76|         png_ptr->channels = 2;
  892|     76|         break;
  893|       |
  894|    361|      case PNG_COLOR_TYPE_RGB_ALPHA:
  ------------------
  |  |  670|    361|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|    361|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|    361|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (894:7): [True: 361, False: 4.34k]
  ------------------
  895|    361|         png_ptr->channels = 4;
  896|    361|         break;
  897|  4.71k|   }
  898|       |
  899|       |   /* Set up other useful info */
  900|  4.71k|   png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * png_ptr->channels);
  901|  4.71k|   png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width);
  ------------------
  |  |  764|  4.71k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 2.98k, False: 1.72k]
  |  |  ------------------
  |  |  765|  4.71k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|  4.71k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
  902|  4.71k|   png_debug1(3, "bit_depth = %d", png_ptr->bit_depth);
  ------------------
  |  |  148|  4.71k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  903|  4.71k|   png_debug1(3, "channels = %d", png_ptr->channels);
  ------------------
  |  |  148|  4.71k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  904|  4.71k|   png_debug1(3, "rowbytes = %lu", (unsigned long)png_ptr->rowbytes);
  ------------------
  |  |  148|  4.71k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  905|  4.71k|   png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth,
  906|  4.71k|       color_type, interlace_type, compression_type, filter_type);
  907|  4.71k|}
png_handle_PLTE:
  912|    531|{
  913|    531|   png_color palette[PNG_MAX_PALETTE_LENGTH];
  914|    531|   int max_palette_length, num, i;
  915|    531|#ifdef PNG_POINTER_INDEXING_SUPPORTED
  916|    531|   png_colorp pal_ptr;
  917|    531|#endif
  918|       |
  919|    531|   png_debug(1, "in png_handle_PLTE");
  ------------------
  |  |  145|    531|#  define png_debug(l, m) ((void)0)
  ------------------
  920|       |
  921|    531|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|    531|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (921:8): [True: 0, False: 531]
  ------------------
  922|      0|      png_chunk_error(png_ptr, "missing IHDR");
  923|       |
  924|       |   /* Moved to before the 'after IDAT' check below because otherwise duplicate
  925|       |    * PLTE chunks are potentially ignored (the spec says there shall not be more
  926|       |    * than one PLTE, the error is not treated as benign, so this check trumps
  927|       |    * the requirement that PLTE appears before IDAT.)
  928|       |    */
  929|    531|   else if ((png_ptr->mode & PNG_HAVE_PLTE) != 0)
  ------------------
  |  |  644|    531|#define PNG_HAVE_PLTE  0x02
  ------------------
  |  Branch (929:13): [True: 0, False: 531]
  ------------------
  930|      0|      png_chunk_error(png_ptr, "duplicate");
  931|       |
  932|    531|   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|    531|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (932:13): [True: 242, False: 289]
  ------------------
  933|    242|   {
  934|       |      /* This is benign because the non-benign error happened before, when an
  935|       |       * IDAT was encountered in a color-mapped image with no PLTE.
  936|       |       */
  937|    242|      png_crc_finish(png_ptr, length);
  938|    242|      png_chunk_benign_error(png_ptr, "out of place");
  939|    242|      return;
  940|    242|   }
  941|       |
  942|    289|   png_ptr->mode |= PNG_HAVE_PLTE;
  ------------------
  |  |  644|    289|#define PNG_HAVE_PLTE  0x02
  ------------------
  943|       |
  944|    289|   if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
  ------------------
  |  |  663|    289|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (944:8): [True: 41, False: 248]
  ------------------
  945|     41|   {
  946|     41|      png_crc_finish(png_ptr, length);
  947|     41|      png_chunk_benign_error(png_ptr, "ignored in grayscale PNG");
  948|     41|      return;
  949|     41|   }
  950|       |
  951|       |#ifndef PNG_READ_OPT_PLTE_SUPPORTED
  952|       |   if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
  953|       |   {
  954|       |      png_crc_finish(png_ptr, length);
  955|       |      return;
  956|       |   }
  957|       |#endif
  958|       |
  959|    248|   if (length > 3*PNG_MAX_PALETTE_LENGTH || length % 3)
  ------------------
  |  |  724|    496|#define PNG_MAX_PALETTE_LENGTH    256
  ------------------
  |  Branch (959:8): [True: 0, False: 248]
  |  Branch (959:45): [True: 1, False: 247]
  ------------------
  960|      1|   {
  961|      1|      png_crc_finish(png_ptr, length);
  962|       |
  963|      1|      if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|      1|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|      1|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|      1|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (963:11): [True: 0, False: 1]
  ------------------
  964|      0|         png_chunk_benign_error(png_ptr, "invalid");
  965|       |
  966|      1|      else
  967|      1|         png_chunk_error(png_ptr, "invalid");
  968|       |
  969|      0|      return;
  970|      1|   }
  971|       |
  972|       |   /* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */
  973|    247|   num = (int)length / 3;
  974|       |
  975|       |   /* If the palette has 256 or fewer entries but is too large for the bit
  976|       |    * depth, we don't issue an error, to preserve the behavior of previous
  977|       |    * libpng versions. We silently truncate the unused extra palette entries
  978|       |    * here.
  979|       |    */
  980|    247|   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|    247|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|    247|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|    247|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (980:8): [True: 240, False: 7]
  ------------------
  981|    240|      max_palette_length = (1 << png_ptr->bit_depth);
  982|      7|   else
  983|      7|      max_palette_length = PNG_MAX_PALETTE_LENGTH;
  ------------------
  |  |  724|      7|#define PNG_MAX_PALETTE_LENGTH    256
  ------------------
  984|       |
  985|    247|   if (num > max_palette_length)
  ------------------
  |  Branch (985:8): [True: 3, False: 244]
  ------------------
  986|      3|      num = max_palette_length;
  987|       |
  988|    247|#ifdef PNG_POINTER_INDEXING_SUPPORTED
  989|  3.97k|   for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
  ------------------
  |  Branch (989:35): [True: 3.72k, False: 247]
  ------------------
  990|  3.72k|   {
  991|  3.72k|      png_byte buf[3];
  992|       |
  993|  3.72k|      png_crc_read(png_ptr, buf, 3);
  994|  3.72k|      pal_ptr->red = buf[0];
  995|  3.72k|      pal_ptr->green = buf[1];
  996|  3.72k|      pal_ptr->blue = buf[2];
  997|  3.72k|   }
  998|       |#else
  999|       |   for (i = 0; i < num; i++)
 1000|       |   {
 1001|       |      png_byte buf[3];
 1002|       |
 1003|       |      png_crc_read(png_ptr, buf, 3);
 1004|       |      /* Don't depend upon png_color being any order */
 1005|       |      palette[i].red = buf[0];
 1006|       |      palette[i].green = buf[1];
 1007|       |      palette[i].blue = buf[2];
 1008|       |   }
 1009|       |#endif
 1010|       |
 1011|       |   /* If we actually need the PLTE chunk (ie for a paletted image), we do
 1012|       |    * whatever the normal CRC configuration tells us.  However, if we
 1013|       |    * have an RGB image, the PLTE can be considered ancillary, so
 1014|       |    * we will act as though it is.
 1015|       |    */
 1016|       |#ifndef PNG_READ_OPT_PLTE_SUPPORTED
 1017|       |   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
 1018|       |#endif
 1019|    247|   {
 1020|    247|      png_crc_finish(png_ptr, (png_uint_32) (length - (unsigned int)num * 3));
 1021|    247|   }
 1022|       |
 1023|       |#ifndef PNG_READ_OPT_PLTE_SUPPORTED
 1024|       |   else if (png_crc_error(png_ptr) != 0)  /* Only if we have a CRC error */
 1025|       |   {
 1026|       |      /* If we don't want to use the data from an ancillary chunk,
 1027|       |       * we have two options: an error abort, or a warning and we
 1028|       |       * ignore the data in this chunk (which should be OK, since
 1029|       |       * it's considered ancillary for a RGB or RGBA image).
 1030|       |       *
 1031|       |       * IMPLEMENTATION NOTE: this is only here because png_crc_finish uses the
 1032|       |       * chunk type to determine whether to check the ancillary or the critical
 1033|       |       * flags.
 1034|       |       */
 1035|       |      if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE) == 0)
 1036|       |      {
 1037|       |         if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) != 0)
 1038|       |            return;
 1039|       |
 1040|       |         else
 1041|       |            png_chunk_error(png_ptr, "CRC error");
 1042|       |      }
 1043|       |
 1044|       |      /* Otherwise, we (optionally) emit a warning and use the chunk. */
 1045|       |      else if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) == 0)
 1046|       |         png_chunk_warning(png_ptr, "CRC error");
 1047|       |   }
 1048|       |#endif
 1049|       |
 1050|       |   /* TODO: png_set_PLTE has the side effect of setting png_ptr->palette to its
 1051|       |    * own copy of the palette.  This has the side effect that when png_start_row
 1052|       |    * is called (this happens after any call to png_read_update_info) the
 1053|       |    * info_ptr palette gets changed.  This is extremely unexpected and
 1054|       |    * confusing.
 1055|       |    *
 1056|       |    * Fix this by not sharing the palette in this way.
 1057|       |    */
 1058|    247|   png_set_PLTE(png_ptr, info_ptr, palette, num);
 1059|       |
 1060|       |   /* The three chunks, bKGD, hIST and tRNS *must* appear after PLTE and before
 1061|       |    * IDAT.  Prior to 1.6.0 this was not checked; instead the code merely
 1062|       |    * checked the apparent validity of a tRNS chunk inserted before PLTE on a
 1063|       |    * palette PNG.  1.6.0 attempts to rigorously follow the standard and
 1064|       |    * therefore does a benign error if the erroneous condition is detected *and*
 1065|       |    * cancels the tRNS if the benign error returns.  The alternative is to
 1066|       |    * amend the standard since it would be rather hypocritical of the standards
 1067|       |    * maintainers to ignore it.
 1068|       |    */
 1069|    247|#ifdef PNG_READ_tRNS_SUPPORTED
 1070|    247|   if (png_ptr->num_trans > 0 ||
  ------------------
  |  Branch (1070:8): [True: 14, False: 233]
  ------------------
 1071|    247|       (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0))
  ------------------
  |  |  735|    233|#define PNG_INFO_tRNS 0x0010U
  ------------------
  |  Branch (1071:9): [True: 233, False: 0]
  |  Branch (1071:29): [True: 0, False: 233]
  ------------------
 1072|      1|   {
 1073|       |      /* Cancel this because otherwise it would be used if the transforms
 1074|       |       * require it.  Don't cancel the 'valid' flag because this would prevent
 1075|       |       * detection of duplicate chunks.
 1076|       |       */
 1077|      1|      png_ptr->num_trans = 0;
 1078|       |
 1079|      1|      if (info_ptr != NULL)
  ------------------
  |  Branch (1079:11): [True: 1, False: 0]
  ------------------
 1080|      1|         info_ptr->num_trans = 0;
 1081|       |
 1082|      1|      png_chunk_benign_error(png_ptr, "tRNS must be after");
 1083|      1|   }
 1084|    247|#endif
 1085|       |
 1086|    247|#ifdef PNG_READ_hIST_SUPPORTED
 1087|    247|   if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) != 0)
  ------------------
  |  |  737|    234|#define PNG_INFO_hIST 0x0040U
  ------------------
  |  Branch (1087:8): [True: 234, False: 13]
  |  Branch (1087:28): [True: 0, False: 234]
  ------------------
 1088|      0|      png_chunk_benign_error(png_ptr, "hIST must be after");
 1089|    247|#endif
 1090|       |
 1091|    247|#ifdef PNG_READ_bKGD_SUPPORTED
 1092|    247|   if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) != 0)
  ------------------
  |  |  736|    234|#define PNG_INFO_bKGD 0x0020U
  ------------------
  |  Branch (1092:8): [True: 234, False: 13]
  |  Branch (1092:28): [True: 1, False: 233]
  ------------------
 1093|      1|      png_chunk_benign_error(png_ptr, "bKGD must be after");
 1094|    247|#endif
 1095|    247|}
png_handle_IEND:
 1099|     84|{
 1100|     84|   png_debug(1, "in png_handle_IEND");
  ------------------
  |  |  145|     84|#  define png_debug(l, m) ((void)0)
  ------------------
 1101|       |
 1102|     84|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0 ||
  ------------------
  |  |  643|     84|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (1102:8): [True: 0, False: 84]
  ------------------
 1103|     84|       (png_ptr->mode & PNG_HAVE_IDAT) == 0)
  ------------------
  |  |  651|     84|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (1103:8): [True: 12, False: 72]
  ------------------
 1104|     12|      png_chunk_error(png_ptr, "out of place");
 1105|       |
 1106|     72|   png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND);
  ------------------
  |  |  645|     72|#define PNG_AFTER_IDAT 0x08
  ------------------
                 png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND);
  ------------------
  |  |  653|     72|#define PNG_HAVE_IEND               0x10U
  ------------------
 1107|       |
 1108|     72|   png_crc_finish(png_ptr, length);
 1109|       |
 1110|     72|   if (length != 0)
  ------------------
  |  Branch (1110:8): [True: 3, False: 69]
  ------------------
 1111|      3|      png_chunk_benign_error(png_ptr, "invalid");
 1112|       |
 1113|     72|   PNG_UNUSED(info_ptr)
  ------------------
  |  |  488|     72|#  define PNG_UNUSED(param) (void)param;
  ------------------
 1114|     72|}
png_handle_gAMA:
 1119|  2.08k|{
 1120|  2.08k|   png_fixed_point igamma;
 1121|  2.08k|   png_byte buf[4];
 1122|       |
 1123|  2.08k|   png_debug(1, "in png_handle_gAMA");
  ------------------
  |  |  145|  2.08k|#  define png_debug(l, m) ((void)0)
  ------------------
 1124|       |
 1125|  2.08k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  2.08k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (1125:8): [True: 0, False: 2.08k]
  ------------------
 1126|      0|      png_chunk_error(png_ptr, "missing IHDR");
 1127|       |
 1128|  2.08k|   else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
  ------------------
  |  |  651|  2.08k|#define PNG_HAVE_IDAT               0x04U
  ------------------
                 else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
  ------------------
  |  |  644|  2.08k|#define PNG_HAVE_PLTE  0x02
  ------------------
  |  Branch (1128:13): [True: 210, False: 1.87k]
  ------------------
 1129|    210|   {
 1130|    210|      png_crc_finish(png_ptr, length);
 1131|    210|      png_chunk_benign_error(png_ptr, "out of place");
 1132|    210|      return;
 1133|    210|   }
 1134|       |
 1135|  1.87k|   if (length != 4)
  ------------------
  |  Branch (1135:8): [True: 195, False: 1.67k]
  ------------------
 1136|    195|   {
 1137|    195|      png_crc_finish(png_ptr, length);
 1138|    195|      png_chunk_benign_error(png_ptr, "invalid");
 1139|    195|      return;
 1140|    195|   }
 1141|       |
 1142|  1.67k|   png_crc_read(png_ptr, buf, 4);
 1143|       |
 1144|  1.67k|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (1144:8): [True: 86, False: 1.59k]
  ------------------
 1145|     86|      return;
 1146|       |
 1147|  1.59k|   igamma = png_get_fixed_point(NULL, buf);
 1148|       |
 1149|  1.59k|   png_colorspace_set_gamma(png_ptr, &png_ptr->colorspace, igamma);
 1150|  1.59k|   png_colorspace_sync(png_ptr, info_ptr);
 1151|  1.59k|}
png_handle_sBIT:
 1157|  1.46k|{
 1158|  1.46k|   unsigned int truelen, i;
 1159|  1.46k|   png_byte sample_depth;
 1160|  1.46k|   png_byte buf[4];
 1161|       |
 1162|  1.46k|   png_debug(1, "in png_handle_sBIT");
  ------------------
  |  |  145|  1.46k|#  define png_debug(l, m) ((void)0)
  ------------------
 1163|       |
 1164|  1.46k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  1.46k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (1164:8): [True: 0, False: 1.46k]
  ------------------
 1165|      0|      png_chunk_error(png_ptr, "missing IHDR");
 1166|       |
 1167|  1.46k|   else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
  ------------------
  |  |  651|  1.46k|#define PNG_HAVE_IDAT               0x04U
  ------------------
                 else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
  ------------------
  |  |  644|  1.46k|#define PNG_HAVE_PLTE  0x02
  ------------------
  |  Branch (1167:13): [True: 271, False: 1.19k]
  ------------------
 1168|    271|   {
 1169|    271|      png_crc_finish(png_ptr, length);
 1170|    271|      png_chunk_benign_error(png_ptr, "out of place");
 1171|    271|      return;
 1172|    271|   }
 1173|       |
 1174|  1.19k|   if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) != 0)
  ------------------
  |  |  732|  1.19k|#define PNG_INFO_sBIT 0x0002U
  ------------------
  |  Branch (1174:8): [True: 1.19k, False: 0]
  |  Branch (1174:28): [True: 193, False: 999]
  ------------------
 1175|    193|   {
 1176|    193|      png_crc_finish(png_ptr, length);
 1177|    193|      png_chunk_benign_error(png_ptr, "duplicate");
 1178|    193|      return;
 1179|    193|   }
 1180|       |
 1181|    999|   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|    999|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|    999|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|    999|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1181:8): [True: 63, False: 936]
  ------------------
 1182|     63|   {
 1183|     63|      truelen = 3;
 1184|     63|      sample_depth = 8;
 1185|     63|   }
 1186|       |
 1187|    936|   else
 1188|    936|   {
 1189|    936|      truelen = png_ptr->channels;
 1190|    936|      sample_depth = png_ptr->bit_depth;
 1191|    936|   }
 1192|       |
 1193|    999|   if (length != truelen || length > 4)
  ------------------
  |  Branch (1193:8): [True: 257, False: 742]
  |  Branch (1193:29): [True: 0, False: 742]
  ------------------
 1194|    257|   {
 1195|    257|      png_chunk_benign_error(png_ptr, "invalid");
 1196|    257|      png_crc_finish(png_ptr, length);
 1197|    257|      return;
 1198|    257|   }
 1199|       |
 1200|    742|   buf[0] = buf[1] = buf[2] = buf[3] = sample_depth;
 1201|    742|   png_crc_read(png_ptr, buf, truelen);
 1202|       |
 1203|    742|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (1203:8): [True: 248, False: 494]
  ------------------
 1204|    248|      return;
 1205|       |
 1206|    689|   for (i=0; i<truelen; ++i)
  ------------------
  |  Branch (1206:14): [True: 676, False: 13]
  ------------------
 1207|    676|   {
 1208|    676|      if (buf[i] == 0 || buf[i] > sample_depth)
  ------------------
  |  Branch (1208:11): [True: 287, False: 389]
  |  Branch (1208:26): [True: 194, False: 195]
  ------------------
 1209|    481|      {
 1210|    481|         png_chunk_benign_error(png_ptr, "invalid");
 1211|    481|         return;
 1212|    481|      }
 1213|    676|   }
 1214|       |
 1215|     13|   if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
  ------------------
  |  |  663|     13|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (1215:8): [True: 0, False: 13]
  ------------------
 1216|      0|   {
 1217|      0|      png_ptr->sig_bit.red = buf[0];
 1218|      0|      png_ptr->sig_bit.green = buf[1];
 1219|      0|      png_ptr->sig_bit.blue = buf[2];
 1220|      0|      png_ptr->sig_bit.alpha = buf[3];
 1221|      0|   }
 1222|       |
 1223|     13|   else
 1224|     13|   {
 1225|     13|      png_ptr->sig_bit.gray = buf[0];
 1226|     13|      png_ptr->sig_bit.red = buf[0];
 1227|     13|      png_ptr->sig_bit.green = buf[0];
 1228|     13|      png_ptr->sig_bit.blue = buf[0];
 1229|     13|      png_ptr->sig_bit.alpha = buf[1];
 1230|     13|   }
 1231|       |
 1232|     13|   png_set_sBIT(png_ptr, info_ptr, &(png_ptr->sig_bit));
 1233|     13|}
png_handle_cHRM:
 1239|  3.07k|{
 1240|  3.07k|   png_byte buf[32];
 1241|  3.07k|   png_xy xy;
 1242|       |
 1243|  3.07k|   png_debug(1, "in png_handle_cHRM");
  ------------------
  |  |  145|  3.07k|#  define png_debug(l, m) ((void)0)
  ------------------
 1244|       |
 1245|  3.07k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  3.07k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (1245:8): [True: 0, False: 3.07k]
  ------------------
 1246|      0|      png_chunk_error(png_ptr, "missing IHDR");
 1247|       |
 1248|  3.07k|   else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
  ------------------
  |  |  651|  3.07k|#define PNG_HAVE_IDAT               0x04U
  ------------------
                 else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
  ------------------
  |  |  644|  3.07k|#define PNG_HAVE_PLTE  0x02
  ------------------
  |  Branch (1248:13): [True: 218, False: 2.86k]
  ------------------
 1249|    218|   {
 1250|    218|      png_crc_finish(png_ptr, length);
 1251|    218|      png_chunk_benign_error(png_ptr, "out of place");
 1252|    218|      return;
 1253|    218|   }
 1254|       |
 1255|  2.86k|   if (length != 32)
  ------------------
  |  Branch (1255:8): [True: 193, False: 2.66k]
  ------------------
 1256|    193|   {
 1257|    193|      png_crc_finish(png_ptr, length);
 1258|    193|      png_chunk_benign_error(png_ptr, "invalid");
 1259|    193|      return;
 1260|    193|   }
 1261|       |
 1262|  2.66k|   png_crc_read(png_ptr, buf, 32);
 1263|       |
 1264|  2.66k|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (1264:8): [True: 305, False: 2.36k]
  ------------------
 1265|    305|      return;
 1266|       |
 1267|  2.36k|   xy.whitex = png_get_fixed_point(NULL, buf);
 1268|  2.36k|   xy.whitey = png_get_fixed_point(NULL, buf + 4);
 1269|  2.36k|   xy.redx   = png_get_fixed_point(NULL, buf + 8);
 1270|  2.36k|   xy.redy   = png_get_fixed_point(NULL, buf + 12);
 1271|  2.36k|   xy.greenx = png_get_fixed_point(NULL, buf + 16);
 1272|  2.36k|   xy.greeny = png_get_fixed_point(NULL, buf + 20);
 1273|  2.36k|   xy.bluex  = png_get_fixed_point(NULL, buf + 24);
 1274|  2.36k|   xy.bluey  = png_get_fixed_point(NULL, buf + 28);
 1275|       |
 1276|  2.36k|   if (xy.whitex == PNG_FIXED_ERROR ||
  ------------------
  |  |   38|  4.72k|#define PNG_FIXED_ERROR (-1)
  ------------------
  |  Branch (1276:8): [True: 221, False: 2.14k]
  ------------------
 1277|  2.36k|       xy.whitey == PNG_FIXED_ERROR ||
  ------------------
  |  |   38|  4.50k|#define PNG_FIXED_ERROR (-1)
  ------------------
  |  Branch (1277:8): [True: 216, False: 1.92k]
  ------------------
 1278|  2.36k|       xy.redx   == PNG_FIXED_ERROR ||
  ------------------
  |  |   38|  4.28k|#define PNG_FIXED_ERROR (-1)
  ------------------
  |  Branch (1278:8): [True: 206, False: 1.71k]
  ------------------
 1279|  2.36k|       xy.redy   == PNG_FIXED_ERROR ||
  ------------------
  |  |   38|  4.08k|#define PNG_FIXED_ERROR (-1)
  ------------------
  |  Branch (1279:8): [True: 324, False: 1.39k]
  ------------------
 1280|  2.36k|       xy.greenx == PNG_FIXED_ERROR ||
  ------------------
  |  |   38|  3.75k|#define PNG_FIXED_ERROR (-1)
  ------------------
  |  Branch (1280:8): [True: 197, False: 1.19k]
  ------------------
 1281|  2.36k|       xy.greeny == PNG_FIXED_ERROR ||
  ------------------
  |  |   38|  3.56k|#define PNG_FIXED_ERROR (-1)
  ------------------
  |  Branch (1281:8): [True: 215, False: 983]
  ------------------
 1282|  2.36k|       xy.bluex  == PNG_FIXED_ERROR ||
  ------------------
  |  |   38|  3.34k|#define PNG_FIXED_ERROR (-1)
  ------------------
  |  Branch (1282:8): [True: 197, False: 786]
  ------------------
 1283|  2.36k|       xy.bluey  == PNG_FIXED_ERROR)
  ------------------
  |  |   38|    786|#define PNG_FIXED_ERROR (-1)
  ------------------
  |  Branch (1283:8): [True: 228, False: 558]
  ------------------
 1284|  1.79k|   {
 1285|  1.79k|      png_chunk_benign_error(png_ptr, "invalid values");
 1286|  1.79k|      return;
 1287|  1.79k|   }
 1288|       |
 1289|       |   /* If a colorspace error has already been output skip this chunk */
 1290|    570|   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
  ------------------
  |  |  139|    570|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
  |  Branch (1290:8): [True: 194, False: 376]
  ------------------
 1291|    194|      return;
 1292|       |
 1293|    376|   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0)
  ------------------
  |  |  135|    376|#define PNG_COLORSPACE_FROM_cHRM            0x0010
  ------------------
  |  Branch (1293:8): [True: 2, False: 374]
  ------------------
 1294|      2|   {
 1295|      2|      png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
  ------------------
  |  |  139|      2|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
 1296|      2|      png_colorspace_sync(png_ptr, info_ptr);
 1297|      2|      png_chunk_benign_error(png_ptr, "duplicate");
 1298|      2|      return;
 1299|      2|   }
 1300|       |
 1301|    374|   png_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
  ------------------
  |  |  135|    374|#define PNG_COLORSPACE_FROM_cHRM            0x0010
  ------------------
 1302|    374|   (void)png_colorspace_set_chromaticities(png_ptr, &png_ptr->colorspace, &xy,
 1303|    374|       1/*prefer cHRM values*/);
 1304|    374|   png_colorspace_sync(png_ptr, info_ptr);
 1305|    374|}
png_handle_sRGB:
 1311|  1.09k|{
 1312|  1.09k|   png_byte intent;
 1313|       |
 1314|  1.09k|   png_debug(1, "in png_handle_sRGB");
  ------------------
  |  |  145|  1.09k|#  define png_debug(l, m) ((void)0)
  ------------------
 1315|       |
 1316|  1.09k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  1.09k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (1316:8): [True: 0, False: 1.09k]
  ------------------
 1317|      0|      png_chunk_error(png_ptr, "missing IHDR");
 1318|       |
 1319|  1.09k|   else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
  ------------------
  |  |  651|  1.09k|#define PNG_HAVE_IDAT               0x04U
  ------------------
                 else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
  ------------------
  |  |  644|  1.09k|#define PNG_HAVE_PLTE  0x02
  ------------------
  |  Branch (1319:13): [True: 229, False: 866]
  ------------------
 1320|    229|   {
 1321|    229|      png_crc_finish(png_ptr, length);
 1322|    229|      png_chunk_benign_error(png_ptr, "out of place");
 1323|    229|      return;
 1324|    229|   }
 1325|       |
 1326|    866|   if (length != 1)
  ------------------
  |  Branch (1326:8): [True: 74, False: 792]
  ------------------
 1327|     74|   {
 1328|     74|      png_crc_finish(png_ptr, length);
 1329|     74|      png_chunk_benign_error(png_ptr, "invalid");
 1330|     74|      return;
 1331|     74|   }
 1332|       |
 1333|    792|   png_crc_read(png_ptr, &intent, 1);
 1334|       |
 1335|    792|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (1335:8): [True: 216, False: 576]
  ------------------
 1336|    216|      return;
 1337|       |
 1338|       |   /* If a colorspace error has already been output skip this chunk */
 1339|    576|   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
  ------------------
  |  |  139|    576|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
  |  Branch (1339:8): [True: 455, False: 121]
  ------------------
 1340|    455|      return;
 1341|       |
 1342|       |   /* Only one sRGB or iCCP chunk is allowed, use the HAVE_INTENT flag to detect
 1343|       |    * this.
 1344|       |    */
 1345|    121|   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_INTENT) != 0)
  ------------------
  |  |  133|    121|#define PNG_COLORSPACE_HAVE_INTENT          0x0004
  ------------------
  |  Branch (1345:8): [True: 7, False: 114]
  ------------------
 1346|      7|   {
 1347|      7|      png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
  ------------------
  |  |  139|      7|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
 1348|      7|      png_colorspace_sync(png_ptr, info_ptr);
 1349|      7|      png_chunk_benign_error(png_ptr, "too many profiles");
 1350|      7|      return;
 1351|      7|   }
 1352|       |
 1353|    114|   (void)png_colorspace_set_sRGB(png_ptr, &png_ptr->colorspace, intent);
 1354|    114|   png_colorspace_sync(png_ptr, info_ptr);
 1355|    114|}
png_handle_iCCP:
 1362|  6.80k|{
 1363|  6.80k|   png_const_charp errmsg = NULL; /* error message output, or no error */
 1364|  6.80k|   int finished = 0; /* crc checked */
 1365|       |
 1366|  6.80k|   png_debug(1, "in png_handle_iCCP");
  ------------------
  |  |  145|  6.80k|#  define png_debug(l, m) ((void)0)
  ------------------
 1367|       |
 1368|  6.80k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  6.80k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (1368:8): [True: 0, False: 6.80k]
  ------------------
 1369|      0|      png_chunk_error(png_ptr, "missing IHDR");
 1370|       |
 1371|  6.80k|   else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
  ------------------
  |  |  651|  6.80k|#define PNG_HAVE_IDAT               0x04U
  ------------------
                 else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
  ------------------
  |  |  644|  6.80k|#define PNG_HAVE_PLTE  0x02
  ------------------
  |  Branch (1371:13): [True: 202, False: 6.60k]
  ------------------
 1372|    202|   {
 1373|    202|      png_crc_finish(png_ptr, length);
 1374|    202|      png_chunk_benign_error(png_ptr, "out of place");
 1375|    202|      return;
 1376|    202|   }
 1377|       |
 1378|       |   /* Consistent with all the above colorspace handling an obviously *invalid*
 1379|       |    * chunk is just ignored, so does not invalidate the color space.  An
 1380|       |    * alternative is to set the 'invalid' flags at the start of this routine
 1381|       |    * and only clear them in they were not set before and all the tests pass.
 1382|       |    */
 1383|       |
 1384|       |   /* The keyword must be at least one character and there is a
 1385|       |    * terminator (0) byte and the compression method byte, and the
 1386|       |    * 'zlib' datastream is at least 11 bytes.
 1387|       |    */
 1388|  6.60k|   if (length < 14)
  ------------------
  |  Branch (1388:8): [True: 68, False: 6.53k]
  ------------------
 1389|     68|   {
 1390|     68|      png_crc_finish(png_ptr, length);
 1391|     68|      png_chunk_benign_error(png_ptr, "too short");
 1392|     68|      return;
 1393|     68|   }
 1394|       |
 1395|       |   /* If a colorspace error has already been output skip this chunk */
 1396|  6.53k|   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
  ------------------
  |  |  139|  6.53k|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
  |  Branch (1396:8): [True: 383, False: 6.15k]
  ------------------
 1397|    383|   {
 1398|    383|      png_crc_finish(png_ptr, length);
 1399|    383|      return;
 1400|    383|   }
 1401|       |
 1402|       |   /* Only one sRGB or iCCP chunk is allowed, use the HAVE_INTENT flag to detect
 1403|       |    * this.
 1404|       |    */
 1405|  6.15k|   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_INTENT) == 0)
  ------------------
  |  |  133|  6.15k|#define PNG_COLORSPACE_HAVE_INTENT          0x0004
  ------------------
  |  Branch (1405:8): [True: 6.15k, False: 2]
  ------------------
 1406|  6.15k|   {
 1407|  6.15k|      uInt read_length, keyword_length;
 1408|  6.15k|      char keyword[81];
 1409|       |
 1410|       |      /* Find the keyword; the keyword plus separator and compression method
 1411|       |       * bytes can be at most 81 characters long.
 1412|       |       */
 1413|  6.15k|      read_length = 81; /* maximum */
 1414|  6.15k|      if (read_length > length)
  ------------------
  |  Branch (1414:11): [True: 302, False: 5.84k]
  ------------------
 1415|    302|         read_length = (uInt)length;
 1416|       |
 1417|  6.15k|      png_crc_read(png_ptr, (png_bytep)keyword, read_length);
 1418|  6.15k|      length -= read_length;
 1419|       |
 1420|       |      /* The minimum 'zlib' stream is assumed to be just the 2 byte header,
 1421|       |       * 5 bytes minimum 'deflate' stream, and the 4 byte checksum.
 1422|       |       */
 1423|  6.15k|      if (length < 11)
  ------------------
  |  Branch (1423:11): [True: 306, False: 5.84k]
  ------------------
 1424|    306|      {
 1425|    306|         png_crc_finish(png_ptr, length);
 1426|    306|         png_chunk_benign_error(png_ptr, "too short");
 1427|    306|         return;
 1428|    306|      }
 1429|       |
 1430|  5.84k|      keyword_length = 0;
 1431|  18.2k|      while (keyword_length < 80 && keyword_length < read_length &&
  ------------------
  |  Branch (1431:14): [True: 18.1k, False: 49]
  |  Branch (1431:37): [True: 18.1k, False: 0]
  ------------------
 1432|  18.2k|         keyword[keyword_length] != 0)
  ------------------
  |  Branch (1432:10): [True: 12.3k, False: 5.79k]
  ------------------
 1433|  12.3k|         ++keyword_length;
 1434|       |
 1435|       |      /* TODO: make the keyword checking common */
 1436|  5.84k|      if (keyword_length >= 1 && keyword_length <= 79)
  ------------------
  |  Branch (1436:11): [True: 5.79k, False: 47]
  |  Branch (1436:34): [True: 5.79k, False: 3]
  ------------------
 1437|  5.79k|      {
 1438|       |         /* We only understand '0' compression - deflate - so if we get a
 1439|       |          * different value we can't safely decode the chunk.
 1440|       |          */
 1441|  5.79k|         if (keyword_length+1 < read_length &&
  ------------------
  |  Branch (1441:14): [True: 5.79k, False: 0]
  ------------------
 1442|  5.79k|            keyword[keyword_length+1] == PNG_COMPRESSION_TYPE_BASE)
  ------------------
  |  |  677|  5.79k|#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
  ------------------
  |  Branch (1442:13): [True: 5.78k, False: 5]
  ------------------
 1443|  5.78k|         {
 1444|  5.78k|            read_length -= keyword_length+2;
 1445|       |
 1446|  5.78k|            if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK)
  ------------------
  |  |  886|  5.78k|#define png_iCCP PNG_U32(105,  67,  67,  80)
  |  |  ------------------
  |  |  |  |  848|  5.78k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.78k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.78k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.78k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  5.78k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1446:17): [True: 5.78k, False: 0]
  ------------------
 1447|  5.78k|            {
 1448|  5.78k|               Byte profile_header[132]={0};
 1449|  5.78k|               Byte local_buffer[PNG_INFLATE_BUF_SIZE];
 1450|  5.78k|               png_alloc_size_t size = (sizeof profile_header);
 1451|       |
 1452|  5.78k|               png_ptr->zstream.next_in = (Bytef*)keyword + (keyword_length+2);
 1453|  5.78k|               png_ptr->zstream.avail_in = read_length;
 1454|  5.78k|               (void)png_inflate_read(png_ptr, local_buffer,
 1455|  5.78k|                   (sizeof local_buffer), &length, profile_header, &size,
 1456|  5.78k|                   0/*finish: don't, because the output is too small*/);
 1457|       |
 1458|  5.78k|               if (size == 0)
  ------------------
  |  Branch (1458:20): [True: 5.74k, False: 46]
  ------------------
 1459|  5.74k|               {
 1460|       |                  /* We have the ICC profile header; do the basic header checks.
 1461|       |                   */
 1462|  5.74k|                  png_uint_32 profile_length = png_get_uint_32(profile_header);
  ------------------
  |  | 2594|  5.74k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  5.74k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  5.74k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  5.74k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  5.74k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 1463|       |
 1464|  5.74k|                  if (png_icc_check_length(png_ptr, &png_ptr->colorspace,
  ------------------
  |  Branch (1464:23): [True: 5.71k, False: 33]
  ------------------
 1465|  5.74k|                      keyword, profile_length) != 0)
 1466|  5.71k|                  {
 1467|       |                     /* The length is apparently ok, so we can check the 132
 1468|       |                      * byte header.
 1469|       |                      */
 1470|  5.71k|                     if (png_icc_check_header(png_ptr, &png_ptr->colorspace,
  ------------------
  |  Branch (1470:26): [True: 5.09k, False: 613]
  ------------------
 1471|  5.71k|                         keyword, profile_length, profile_header,
 1472|  5.71k|                         png_ptr->color_type) != 0)
 1473|  5.09k|                     {
 1474|       |                        /* Now read the tag table; a variable size buffer is
 1475|       |                         * needed at this point, allocate one for the whole
 1476|       |                         * profile.  The header check has already validated
 1477|       |                         * that none of this stuff will overflow.
 1478|       |                         */
 1479|  5.09k|                        png_uint_32 tag_count =
 1480|  5.09k|                           png_get_uint_32(profile_header + 128);
  ------------------
  |  | 2594|  5.09k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  5.09k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  5.09k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  5.09k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  5.09k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 1481|  5.09k|                        png_bytep profile = png_read_buffer(png_ptr,
 1482|  5.09k|                            profile_length, 2/*silent*/);
 1483|       |
 1484|  5.09k|                        if (profile != NULL)
  ------------------
  |  Branch (1484:29): [True: 5.09k, False: 0]
  ------------------
 1485|  5.09k|                        {
 1486|  5.09k|                           memcpy(profile, profile_header,
 1487|  5.09k|                               (sizeof profile_header));
 1488|       |
 1489|  5.09k|                           size = 12 * tag_count;
 1490|       |
 1491|  5.09k|                           (void)png_inflate_read(png_ptr, local_buffer,
 1492|  5.09k|                               (sizeof local_buffer), &length,
 1493|  5.09k|                               profile + (sizeof profile_header), &size, 0);
 1494|       |
 1495|       |                           /* Still expect a buffer error because we expect
 1496|       |                            * there to be some tag data!
 1497|       |                            */
 1498|  5.09k|                           if (size == 0)
  ------------------
  |  Branch (1498:32): [True: 5.04k, False: 50]
  ------------------
 1499|  5.04k|                           {
 1500|  5.04k|                              if (png_icc_check_tag_table(png_ptr,
  ------------------
  |  Branch (1500:35): [True: 4.90k, False: 144]
  ------------------
 1501|  5.04k|                                  &png_ptr->colorspace, keyword, profile_length,
 1502|  5.04k|                                  profile) != 0)
 1503|  4.90k|                              {
 1504|       |                                 /* The profile has been validated for basic
 1505|       |                                  * security issues, so read the whole thing in.
 1506|       |                                  */
 1507|  4.90k|                                 size = profile_length - (sizeof profile_header)
 1508|  4.90k|                                     - 12 * tag_count;
 1509|       |
 1510|  4.90k|                                 (void)png_inflate_read(png_ptr, local_buffer,
 1511|  4.90k|                                     (sizeof local_buffer), &length,
 1512|  4.90k|                                     profile + (sizeof profile_header) +
 1513|  4.90k|                                     12 * tag_count, &size, 1/*finish*/);
 1514|       |
 1515|  4.90k|                                 if (length > 0 && !(png_ptr->flags &
  ------------------
  |  Branch (1515:38): [True: 1.93k, False: 2.97k]
  |  Branch (1515:52): [True: 0, False: 1.93k]
  ------------------
 1516|  1.93k|                                     PNG_FLAG_BENIGN_ERRORS_WARN))
  ------------------
  |  |  724|  1.93k|#define PNG_FLAG_BENIGN_ERRORS_WARN     0x100000U /* Added to libpng-1.4.0 */
  ------------------
 1517|      0|                                    errmsg = "extra compressed data";
 1518|       |
 1519|       |                                 /* But otherwise allow extra data: */
 1520|  4.90k|                                 else if (size == 0)
  ------------------
  |  Branch (1520:43): [True: 4.71k, False: 188]
  ------------------
 1521|  4.71k|                                 {
 1522|  4.71k|                                    if (length > 0)
  ------------------
  |  Branch (1522:41): [True: 1.83k, False: 2.88k]
  ------------------
 1523|  1.83k|                                    {
 1524|       |                                       /* This can be handled completely, so
 1525|       |                                        * keep going.
 1526|       |                                        */
 1527|  1.83k|                                       png_chunk_warning(png_ptr,
 1528|  1.83k|                                           "extra compressed data");
 1529|  1.83k|                                    }
 1530|       |
 1531|  4.71k|                                    png_crc_finish(png_ptr, length);
 1532|  4.71k|                                    finished = 1;
 1533|       |
 1534|  4.71k|# if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
 1535|       |                                    /* Check for a match against sRGB */
 1536|  4.71k|                                    png_icc_set_sRGB(png_ptr,
 1537|  4.71k|                                        &png_ptr->colorspace, profile,
 1538|  4.71k|                                        png_ptr->zstream.adler);
 1539|  4.71k|# endif
 1540|       |
 1541|       |                                    /* Steal the profile for info_ptr. */
 1542|  4.71k|                                    if (info_ptr != NULL)
  ------------------
  |  Branch (1542:41): [True: 4.66k, False: 51]
  ------------------
 1543|  4.66k|                                    {
 1544|  4.66k|                                       png_free_data(png_ptr, info_ptr,
 1545|  4.66k|                                           PNG_FREE_ICCP, 0);
  ------------------
  |  | 1745|  4.66k|#define PNG_FREE_ICCP 0x0010U
  ------------------
 1546|       |
 1547|  4.66k|                                       info_ptr->iccp_name = png_voidcast(char*,
  ------------------
  |  |  544|  4.66k|#  define png_voidcast(type, value) (value)
  ------------------
 1548|  4.66k|                                           png_malloc_base(png_ptr,
 1549|  4.66k|                                           keyword_length+1));
 1550|  4.66k|                                       if (info_ptr->iccp_name != NULL)
  ------------------
  |  Branch (1550:44): [True: 4.66k, False: 0]
  ------------------
 1551|  4.66k|                                       {
 1552|  4.66k|                                          memcpy(info_ptr->iccp_name, keyword,
 1553|  4.66k|                                              keyword_length+1);
 1554|  4.66k|                                          info_ptr->iccp_proflen =
 1555|  4.66k|                                              profile_length;
 1556|  4.66k|                                          info_ptr->iccp_profile = profile;
 1557|  4.66k|                                          png_ptr->read_buffer = NULL; /*steal*/
 1558|  4.66k|                                          info_ptr->free_me |= PNG_FREE_ICCP;
  ------------------
  |  | 1745|  4.66k|#define PNG_FREE_ICCP 0x0010U
  ------------------
 1559|  4.66k|                                          info_ptr->valid |= PNG_INFO_iCCP;
  ------------------
  |  |  743|  4.66k|#define PNG_INFO_iCCP 0x1000U  /* ESR, 1.0.6 */
  ------------------
 1560|  4.66k|                                       }
 1561|       |
 1562|      0|                                       else
 1563|      0|                                       {
 1564|      0|                                          png_ptr->colorspace.flags |=
 1565|      0|                                             PNG_COLORSPACE_INVALID;
  ------------------
  |  |  139|      0|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
 1566|      0|                                          errmsg = "out of memory";
 1567|      0|                                       }
 1568|  4.66k|                                    }
 1569|       |
 1570|       |                                    /* else the profile remains in the read
 1571|       |                                     * buffer which gets reused for subsequent
 1572|       |                                     * chunks.
 1573|       |                                     */
 1574|       |
 1575|  4.71k|                                    if (info_ptr != NULL)
  ------------------
  |  Branch (1575:41): [True: 4.66k, False: 51]
  ------------------
 1576|  4.66k|                                       png_colorspace_sync(png_ptr, info_ptr);
 1577|       |
 1578|  4.71k|                                    if (errmsg == NULL)
  ------------------
  |  Branch (1578:41): [True: 4.66k, False: 51]
  ------------------
 1579|  4.66k|                                    {
 1580|  4.66k|                                       png_ptr->zowner = 0;
 1581|  4.66k|                                       return;
 1582|  4.66k|                                    }
 1583|  4.71k|                                 }
 1584|    239|                                 if (errmsg == NULL)
  ------------------
  |  Branch (1584:38): [True: 144, False: 95]
  ------------------
 1585|    144|                                    errmsg = png_ptr->zstream.msg;
 1586|    239|                              }
 1587|       |                              /* else png_icc_check_tag_table output an error */
 1588|  5.04k|                           }
 1589|     50|                           else /* profile truncated */
 1590|     50|                              errmsg = png_ptr->zstream.msg;
 1591|  5.09k|                        }
 1592|       |
 1593|      0|                        else
 1594|      0|                           errmsg = "out of memory";
 1595|  5.09k|                     }
 1596|       |
 1597|       |                     /* else png_icc_check_header output an error */
 1598|  5.71k|                  }
 1599|       |
 1600|       |                  /* else png_icc_check_length output an error */
 1601|  5.74k|               }
 1602|       |
 1603|     46|               else /* profile truncated */
 1604|     46|                  errmsg = png_ptr->zstream.msg;
 1605|       |
 1606|       |               /* Release the stream */
 1607|  1.12k|               png_ptr->zowner = 0;
 1608|  1.12k|            }
 1609|       |
 1610|      0|            else /* png_inflate_claim failed */
 1611|      0|               errmsg = png_ptr->zstream.msg;
 1612|  5.78k|         }
 1613|       |
 1614|      5|         else
 1615|      5|            errmsg = "bad compression method"; /* or missing */
 1616|  5.79k|      }
 1617|       |
 1618|     50|      else
 1619|     50|         errmsg = "bad keyword";
 1620|  5.84k|   }
 1621|       |
 1622|      2|   else
 1623|      2|      errmsg = "too many profiles";
 1624|       |
 1625|       |   /* Failure: the reason is in 'errmsg' */
 1626|  1.18k|   if (finished == 0)
  ------------------
  |  Branch (1626:8): [True: 1.02k, False: 161]
  ------------------
 1627|  1.02k|      png_crc_finish(png_ptr, length);
 1628|       |
 1629|  1.18k|   png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
  ------------------
  |  |  139|  1.18k|#define PNG_COLORSPACE_INVALID              0x8000
  ------------------
 1630|  1.18k|   png_colorspace_sync(png_ptr, info_ptr);
 1631|  1.18k|   if (errmsg != NULL) /* else already output */
  ------------------
  |  Branch (1631:8): [True: 113, False: 1.06k]
  ------------------
 1632|    113|      png_chunk_benign_error(png_ptr, errmsg);
 1633|  1.18k|}
png_handle_sPLT:
 1640|  8.15k|{
 1641|  8.15k|   png_bytep entry_start, buffer;
 1642|  8.15k|   png_sPLT_t new_palette;
 1643|  8.15k|   png_sPLT_entryp pp;
 1644|  8.15k|   png_uint_32 data_length;
 1645|  8.15k|   int entry_size, i;
 1646|  8.15k|   png_uint_32 skip = 0;
 1647|  8.15k|   png_uint_32 dl;
 1648|  8.15k|   size_t max_dl;
 1649|       |
 1650|  8.15k|   png_debug(1, "in png_handle_sPLT");
  ------------------
  |  |  145|  8.15k|#  define png_debug(l, m) ((void)0)
  ------------------
 1651|       |
 1652|  8.15k|#ifdef PNG_USER_LIMITS_SUPPORTED
 1653|  8.15k|   if (png_ptr->user_chunk_cache_max != 0)
  ------------------
  |  Branch (1653:8): [True: 8.15k, False: 0]
  ------------------
 1654|  8.15k|   {
 1655|  8.15k|      if (png_ptr->user_chunk_cache_max == 1)
  ------------------
  |  Branch (1655:11): [True: 210, False: 7.94k]
  ------------------
 1656|    210|      {
 1657|    210|         png_crc_finish(png_ptr, length);
 1658|    210|         return;
 1659|    210|      }
 1660|       |
 1661|  7.94k|      if (--png_ptr->user_chunk_cache_max == 1)
  ------------------
  |  Branch (1661:11): [True: 7, False: 7.93k]
  ------------------
 1662|      7|      {
 1663|      7|         png_warning(png_ptr, "No space in chunk cache for sPLT");
 1664|      7|         png_crc_finish(png_ptr, length);
 1665|      7|         return;
 1666|      7|      }
 1667|  7.94k|   }
 1668|  7.93k|#endif
 1669|       |
 1670|  7.93k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  7.93k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (1670:8): [True: 0, False: 7.93k]
  ------------------
 1671|      0|      png_chunk_error(png_ptr, "missing IHDR");
 1672|       |
 1673|  7.93k|   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|  7.93k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (1673:13): [True: 201, False: 7.73k]
  ------------------
 1674|    201|   {
 1675|    201|      png_crc_finish(png_ptr, length);
 1676|    201|      png_chunk_benign_error(png_ptr, "out of place");
 1677|    201|      return;
 1678|    201|   }
 1679|       |
 1680|       |#ifdef PNG_MAX_MALLOC_64K
 1681|       |   if (length > 65535U)
 1682|       |   {
 1683|       |      png_crc_finish(png_ptr, length);
 1684|       |      png_chunk_benign_error(png_ptr, "too large to fit in memory");
 1685|       |      return;
 1686|       |   }
 1687|       |#endif
 1688|       |
 1689|  7.73k|   buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
 1690|  7.73k|   if (buffer == NULL)
  ------------------
  |  Branch (1690:8): [True: 0, False: 7.73k]
  ------------------
 1691|      0|   {
 1692|      0|      png_crc_finish(png_ptr, length);
 1693|      0|      png_chunk_benign_error(png_ptr, "out of memory");
 1694|      0|      return;
 1695|      0|   }
 1696|       |
 1697|       |
 1698|       |   /* WARNING: this may break if size_t is less than 32 bits; it is assumed
 1699|       |    * that the PNG_MAX_MALLOC_64K test is enabled in this case, but this is a
 1700|       |    * potential breakage point if the types in pngconf.h aren't exactly right.
 1701|       |    */
 1702|  7.73k|   png_crc_read(png_ptr, buffer, length);
 1703|       |
 1704|  7.73k|   if (png_crc_finish(png_ptr, skip) != 0)
  ------------------
  |  Branch (1704:8): [True: 4.67k, False: 3.06k]
  ------------------
 1705|  4.67k|      return;
 1706|       |
 1707|  3.06k|   buffer[length] = 0;
 1708|       |
 1709|  3.74k|   for (entry_start = buffer; *entry_start; entry_start++)
  ------------------
  |  Branch (1709:31): [True: 687, False: 3.06k]
  ------------------
 1710|    687|      /* Empty loop to find end of name */ ;
 1711|       |
 1712|  3.06k|   ++entry_start;
 1713|       |
 1714|       |   /* A sample depth should follow the separator, and we should be on it  */
 1715|  3.06k|   if (length < 2U || entry_start > buffer + (length - 2U))
  ------------------
  |  Branch (1715:8): [True: 816, False: 2.24k]
  |  Branch (1715:23): [True: 195, False: 2.05k]
  ------------------
 1716|    975|   {
 1717|    975|      png_warning(png_ptr, "malformed sPLT chunk");
 1718|    975|      return;
 1719|    975|   }
 1720|       |
 1721|  2.08k|   new_palette.depth = *entry_start++;
 1722|  2.08k|   entry_size = (new_palette.depth == 8 ? 6 : 10);
  ------------------
  |  Branch (1722:18): [True: 1.91k, False: 167]
  ------------------
 1723|       |   /* This must fit in a png_uint_32 because it is derived from the original
 1724|       |    * chunk data length.
 1725|       |    */
 1726|  2.08k|   data_length = length - (png_uint_32)(entry_start - buffer);
 1727|       |
 1728|       |   /* Integrity-check the data length */
 1729|  2.08k|   if ((data_length % (unsigned int)entry_size) != 0)
  ------------------
  |  Branch (1729:8): [True: 511, False: 1.57k]
  ------------------
 1730|    511|   {
 1731|    511|      png_warning(png_ptr, "sPLT chunk has bad length");
 1732|    511|      return;
 1733|    511|   }
 1734|       |
 1735|  1.57k|   dl = (png_uint_32)(data_length / (unsigned int)entry_size);
 1736|  1.57k|   max_dl = PNG_SIZE_MAX / (sizeof (png_sPLT_entry));
  ------------------
  |  |  650|  1.57k|#define PNG_SIZE_MAX ((size_t)(-1))
  ------------------
 1737|       |
 1738|  1.57k|   if (dl > max_dl)
  ------------------
  |  Branch (1738:8): [True: 0, False: 1.57k]
  ------------------
 1739|      0|   {
 1740|      0|      png_warning(png_ptr, "sPLT chunk too long");
 1741|      0|      return;
 1742|      0|   }
 1743|       |
 1744|  1.57k|   new_palette.nentries = (png_int_32)(data_length / (unsigned int)entry_size);
 1745|       |
 1746|  1.57k|   new_palette.entries = (png_sPLT_entryp)png_malloc_warn(png_ptr,
 1747|  1.57k|       (png_alloc_size_t) new_palette.nentries * (sizeof (png_sPLT_entry)));
 1748|       |
 1749|  1.57k|   if (new_palette.entries == NULL)
  ------------------
  |  Branch (1749:8): [True: 0, False: 1.57k]
  ------------------
 1750|      0|   {
 1751|      0|      png_warning(png_ptr, "sPLT chunk requires too much memory");
 1752|      0|      return;
 1753|      0|   }
 1754|       |
 1755|  1.57k|#ifdef PNG_POINTER_INDEXING_SUPPORTED
 1756|  5.94k|   for (i = 0; i < new_palette.nentries; i++)
  ------------------
  |  Branch (1756:16): [True: 4.36k, False: 1.57k]
  ------------------
 1757|  4.36k|   {
 1758|  4.36k|      pp = new_palette.entries + i;
 1759|       |
 1760|  4.36k|      if (new_palette.depth == 8)
  ------------------
  |  Branch (1760:11): [True: 3.87k, False: 496]
  ------------------
 1761|  3.87k|      {
 1762|  3.87k|         pp->red = *entry_start++;
 1763|  3.87k|         pp->green = *entry_start++;
 1764|  3.87k|         pp->blue = *entry_start++;
 1765|  3.87k|         pp->alpha = *entry_start++;
 1766|  3.87k|      }
 1767|       |
 1768|    496|      else
 1769|    496|      {
 1770|    496|         pp->red   = png_get_uint_16(entry_start); entry_start += 2;
  ------------------
  |  | 2595|    496|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|    496|   ((png_uint_16) \
  |  |  |  | 2582|    496|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|    496|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 1771|    496|         pp->green = png_get_uint_16(entry_start); entry_start += 2;
  ------------------
  |  | 2595|    496|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|    496|   ((png_uint_16) \
  |  |  |  | 2582|    496|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|    496|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 1772|    496|         pp->blue  = png_get_uint_16(entry_start); entry_start += 2;
  ------------------
  |  | 2595|    496|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|    496|   ((png_uint_16) \
  |  |  |  | 2582|    496|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|    496|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 1773|    496|         pp->alpha = png_get_uint_16(entry_start); entry_start += 2;
  ------------------
  |  | 2595|    496|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|    496|   ((png_uint_16) \
  |  |  |  | 2582|    496|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|    496|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 1774|    496|      }
 1775|       |
 1776|  4.36k|      pp->frequency = png_get_uint_16(entry_start); entry_start += 2;
  ------------------
  |  | 2595|  4.36k|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|  4.36k|   ((png_uint_16) \
  |  |  |  | 2582|  4.36k|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|  4.36k|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 1777|  4.36k|   }
 1778|       |#else
 1779|       |   pp = new_palette.entries;
 1780|       |
 1781|       |   for (i = 0; i < new_palette.nentries; i++)
 1782|       |   {
 1783|       |
 1784|       |      if (new_palette.depth == 8)
 1785|       |      {
 1786|       |         pp[i].red   = *entry_start++;
 1787|       |         pp[i].green = *entry_start++;
 1788|       |         pp[i].blue  = *entry_start++;
 1789|       |         pp[i].alpha = *entry_start++;
 1790|       |      }
 1791|       |
 1792|       |      else
 1793|       |      {
 1794|       |         pp[i].red   = png_get_uint_16(entry_start); entry_start += 2;
 1795|       |         pp[i].green = png_get_uint_16(entry_start); entry_start += 2;
 1796|       |         pp[i].blue  = png_get_uint_16(entry_start); entry_start += 2;
 1797|       |         pp[i].alpha = png_get_uint_16(entry_start); entry_start += 2;
 1798|       |      }
 1799|       |
 1800|       |      pp[i].frequency = png_get_uint_16(entry_start); entry_start += 2;
 1801|       |   }
 1802|       |#endif
 1803|       |
 1804|       |   /* Discard all chunk data except the name and stash that */
 1805|  1.57k|   new_palette.name = (png_charp)buffer;
 1806|       |
 1807|  1.57k|   png_set_sPLT(png_ptr, info_ptr, &new_palette, 1);
 1808|       |
 1809|  1.57k|   png_free(png_ptr, new_palette.entries);
 1810|  1.57k|}
png_handle_tRNS:
 1816|  2.25k|{
 1817|  2.25k|   png_byte readbuf[PNG_MAX_PALETTE_LENGTH];
 1818|       |
 1819|  2.25k|   png_debug(1, "in png_handle_tRNS");
  ------------------
  |  |  145|  2.25k|#  define png_debug(l, m) ((void)0)
  ------------------
 1820|       |
 1821|  2.25k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  2.25k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (1821:8): [True: 0, False: 2.25k]
  ------------------
 1822|      0|      png_chunk_error(png_ptr, "missing IHDR");
 1823|       |
 1824|  2.25k|   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|  2.25k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (1824:13): [True: 196, False: 2.05k]
  ------------------
 1825|    196|   {
 1826|    196|      png_crc_finish(png_ptr, length);
 1827|    196|      png_chunk_benign_error(png_ptr, "out of place");
 1828|    196|      return;
 1829|    196|   }
 1830|       |
 1831|  2.05k|   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0)
  ------------------
  |  |  735|  2.05k|#define PNG_INFO_tRNS 0x0010U
  ------------------
  |  Branch (1831:13): [True: 2.05k, False: 0]
  |  Branch (1831:33): [True: 67, False: 1.98k]
  ------------------
 1832|     67|   {
 1833|     67|      png_crc_finish(png_ptr, length);
 1834|     67|      png_chunk_benign_error(png_ptr, "duplicate");
 1835|     67|      return;
 1836|     67|   }
 1837|       |
 1838|  1.98k|   if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
  ------------------
  |  |  667|  1.98k|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (1838:8): [True: 508, False: 1.47k]
  ------------------
 1839|    508|   {
 1840|    508|      png_byte buf[2];
 1841|       |
 1842|    508|      if (length != 2)
  ------------------
  |  Branch (1842:11): [True: 296, False: 212]
  ------------------
 1843|    296|      {
 1844|    296|         png_crc_finish(png_ptr, length);
 1845|    296|         png_chunk_benign_error(png_ptr, "invalid");
 1846|    296|         return;
 1847|    296|      }
 1848|       |
 1849|    212|      png_crc_read(png_ptr, buf, 2);
 1850|    212|      png_ptr->num_trans = 1;
 1851|    212|      png_ptr->trans_color.gray = png_get_uint_16(buf);
  ------------------
  |  | 2595|    212|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|    212|   ((png_uint_16) \
  |  |  |  | 2582|    212|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|    212|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 1852|    212|   }
 1853|       |
 1854|  1.47k|   else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
  ------------------
  |  |  669|  1.47k|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|  1.47k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (1854:13): [True: 564, False: 915]
  ------------------
 1855|    564|   {
 1856|    564|      png_byte buf[6];
 1857|       |
 1858|    564|      if (length != 6)
  ------------------
  |  Branch (1858:11): [True: 211, False: 353]
  ------------------
 1859|    211|      {
 1860|    211|         png_crc_finish(png_ptr, length);
 1861|    211|         png_chunk_benign_error(png_ptr, "invalid");
 1862|    211|         return;
 1863|    211|      }
 1864|       |
 1865|    353|      png_crc_read(png_ptr, buf, length);
 1866|    353|      png_ptr->num_trans = 1;
 1867|    353|      png_ptr->trans_color.red = png_get_uint_16(buf);
  ------------------
  |  | 2595|    353|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|    353|   ((png_uint_16) \
  |  |  |  | 2582|    353|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|    353|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 1868|    353|      png_ptr->trans_color.green = png_get_uint_16(buf + 2);
  ------------------
  |  | 2595|    353|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|    353|   ((png_uint_16) \
  |  |  |  | 2582|    353|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|    353|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 1869|    353|      png_ptr->trans_color.blue = png_get_uint_16(buf + 4);
  ------------------
  |  | 2595|    353|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|    353|   ((png_uint_16) \
  |  |  |  | 2582|    353|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|    353|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 1870|    353|   }
 1871|       |
 1872|    915|   else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|    915|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|    915|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|    915|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1872:13): [True: 723, False: 192]
  ------------------
 1873|    723|   {
 1874|    723|      if ((png_ptr->mode & PNG_HAVE_PLTE) == 0)
  ------------------
  |  |  644|    723|#define PNG_HAVE_PLTE  0x02
  ------------------
  |  Branch (1874:11): [True: 191, False: 532]
  ------------------
 1875|    191|      {
 1876|       |         /* TODO: is this actually an error in the ISO spec? */
 1877|    191|         png_crc_finish(png_ptr, length);
 1878|    191|         png_chunk_benign_error(png_ptr, "out of place");
 1879|    191|         return;
 1880|    191|      }
 1881|       |
 1882|    532|      if (length > (unsigned int) png_ptr->num_palette ||
  ------------------
  |  Branch (1882:11): [True: 221, False: 311]
  ------------------
 1883|    532|         length > (unsigned int) PNG_MAX_PALETTE_LENGTH ||
  ------------------
  |  |  724|    843|#define PNG_MAX_PALETTE_LENGTH    256
  ------------------
  |  Branch (1883:10): [True: 0, False: 311]
  ------------------
 1884|    532|         length == 0)
  ------------------
  |  Branch (1884:10): [True: 200, False: 111]
  ------------------
 1885|    421|      {
 1886|    421|         png_crc_finish(png_ptr, length);
 1887|    421|         png_chunk_benign_error(png_ptr, "invalid");
 1888|    421|         return;
 1889|    421|      }
 1890|       |
 1891|    111|      png_crc_read(png_ptr, readbuf, length);
 1892|    111|      png_ptr->num_trans = (png_uint_16)length;
 1893|    111|   }
 1894|       |
 1895|    192|   else
 1896|    192|   {
 1897|    192|      png_crc_finish(png_ptr, length);
 1898|    192|      png_chunk_benign_error(png_ptr, "invalid with alpha channel");
 1899|    192|      return;
 1900|    192|   }
 1901|       |
 1902|    676|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (1902:8): [True: 416, False: 260]
  ------------------
 1903|    416|   {
 1904|    416|      png_ptr->num_trans = 0;
 1905|    416|      return;
 1906|    416|   }
 1907|       |
 1908|       |   /* TODO: this is a horrible side effect in the palette case because the
 1909|       |    * png_struct ends up with a pointer to the tRNS buffer owned by the
 1910|       |    * png_info.  Fix this.
 1911|       |    */
 1912|    260|   png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans,
 1913|    260|       &(png_ptr->trans_color));
 1914|    260|}
png_handle_bKGD:
 1920|  2.20k|{
 1921|  2.20k|   unsigned int truelen;
 1922|  2.20k|   png_byte buf[6];
 1923|  2.20k|   png_color_16 background;
 1924|       |
 1925|  2.20k|   png_debug(1, "in png_handle_bKGD");
  ------------------
  |  |  145|  2.20k|#  define png_debug(l, m) ((void)0)
  ------------------
 1926|       |
 1927|  2.20k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  2.20k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (1927:8): [True: 0, False: 2.20k]
  ------------------
 1928|      0|      png_chunk_error(png_ptr, "missing IHDR");
 1929|       |
 1930|  2.20k|   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0 ||
  ------------------
  |  |  651|  2.20k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (1930:13): [True: 66, False: 2.13k]
  ------------------
 1931|  2.20k|       (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
  ------------------
  |  |  668|  4.27k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  2.13k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  2.13k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1931:9): [True: 554, False: 1.58k]
  ------------------
 1932|  2.13k|       (png_ptr->mode & PNG_HAVE_PLTE) == 0))
  ------------------
  |  |  644|    554|#define PNG_HAVE_PLTE  0x02
  ------------------
  |  Branch (1932:8): [True: 63, False: 491]
  ------------------
 1933|    129|   {
 1934|    129|      png_crc_finish(png_ptr, length);
 1935|    129|      png_chunk_benign_error(png_ptr, "out of place");
 1936|    129|      return;
 1937|    129|   }
 1938|       |
 1939|  2.07k|   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) != 0)
  ------------------
  |  |  736|  2.07k|#define PNG_INFO_bKGD 0x0020U
  ------------------
  |  Branch (1939:13): [True: 2.07k, False: 0]
  |  Branch (1939:33): [True: 200, False: 1.87k]
  ------------------
 1940|    200|   {
 1941|    200|      png_crc_finish(png_ptr, length);
 1942|    200|      png_chunk_benign_error(png_ptr, "duplicate");
 1943|    200|      return;
 1944|    200|   }
 1945|       |
 1946|  1.87k|   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|  1.87k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  1.87k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  1.87k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1946:8): [True: 491, False: 1.38k]
  ------------------
 1947|    491|      truelen = 1;
 1948|       |
 1949|  1.38k|   else if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
  ------------------
  |  |  663|  1.38k|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (1949:13): [True: 708, False: 675]
  ------------------
 1950|    708|      truelen = 6;
 1951|       |
 1952|    675|   else
 1953|    675|      truelen = 2;
 1954|       |
 1955|  1.87k|   if (length != truelen)
  ------------------
  |  Branch (1955:8): [True: 196, False: 1.67k]
  ------------------
 1956|    196|   {
 1957|    196|      png_crc_finish(png_ptr, length);
 1958|    196|      png_chunk_benign_error(png_ptr, "invalid");
 1959|    196|      return;
 1960|    196|   }
 1961|       |
 1962|  1.67k|   png_crc_read(png_ptr, buf, truelen);
 1963|       |
 1964|  1.67k|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (1964:8): [True: 267, False: 1.41k]
  ------------------
 1965|    267|      return;
 1966|       |
 1967|       |   /* We convert the index value into RGB components so that we can allow
 1968|       |    * arbitrary RGB values for background when we have transparency, and
 1969|       |    * so it is easy to determine the RGB values of the background color
 1970|       |    * from the info_ptr struct.
 1971|       |    */
 1972|  1.41k|   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|  1.41k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  1.41k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  1.41k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (1972:8): [True: 280, False: 1.13k]
  ------------------
 1973|    280|   {
 1974|    280|      background.index = buf[0];
 1975|       |
 1976|    280|      if (info_ptr != NULL && info_ptr->num_palette != 0)
  ------------------
  |  Branch (1976:11): [True: 280, False: 0]
  |  Branch (1976:31): [True: 280, False: 0]
  ------------------
 1977|    280|      {
 1978|    280|         if (buf[0] >= info_ptr->num_palette)
  ------------------
  |  Branch (1978:14): [True: 275, False: 5]
  ------------------
 1979|    275|         {
 1980|    275|            png_chunk_benign_error(png_ptr, "invalid index");
 1981|    275|            return;
 1982|    275|         }
 1983|       |
 1984|      5|         background.red = (png_uint_16)png_ptr->palette[buf[0]].red;
 1985|      5|         background.green = (png_uint_16)png_ptr->palette[buf[0]].green;
 1986|      5|         background.blue = (png_uint_16)png_ptr->palette[buf[0]].blue;
 1987|      5|      }
 1988|       |
 1989|      0|      else
 1990|      0|         background.red = background.green = background.blue = 0;
 1991|       |
 1992|      5|      background.gray = 0;
 1993|      5|   }
 1994|       |
 1995|  1.13k|   else if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0) /* GRAY */
  ------------------
  |  |  663|  1.13k|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (1995:13): [True: 483, False: 648]
  ------------------
 1996|    483|   {
 1997|    483|      if (png_ptr->bit_depth <= 8)
  ------------------
  |  Branch (1997:11): [True: 476, False: 7]
  ------------------
 1998|    476|      {
 1999|    476|         if (buf[0] != 0 || buf[1] >= (unsigned int)(1 << png_ptr->bit_depth))
  ------------------
  |  Branch (1999:14): [True: 193, False: 283]
  |  Branch (1999:29): [True: 283, False: 0]
  ------------------
 2000|    476|         {
 2001|    476|            png_chunk_benign_error(png_ptr, "invalid gray level");
 2002|    476|            return;
 2003|    476|         }
 2004|    476|      }
 2005|       |
 2006|      7|      background.index = 0;
 2007|      7|      background.red =
 2008|      7|      background.green =
 2009|      7|      background.blue =
 2010|      7|      background.gray = png_get_uint_16(buf);
  ------------------
  |  | 2595|      7|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|      7|   ((png_uint_16) \
  |  |  |  | 2582|      7|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|      7|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 2011|      7|   }
 2012|       |
 2013|    648|   else
 2014|    648|   {
 2015|    648|      if (png_ptr->bit_depth <= 8)
  ------------------
  |  Branch (2015:11): [True: 640, False: 8]
  ------------------
 2016|    640|      {
 2017|    640|         if (buf[0] != 0 || buf[2] != 0 || buf[4] != 0)
  ------------------
  |  Branch (2017:14): [True: 193, False: 447]
  |  Branch (2017:29): [True: 209, False: 238]
  |  Branch (2017:44): [True: 194, False: 44]
  ------------------
 2018|    596|         {
 2019|    596|            png_chunk_benign_error(png_ptr, "invalid color");
 2020|    596|            return;
 2021|    596|         }
 2022|    640|      }
 2023|       |
 2024|     52|      background.index = 0;
 2025|     52|      background.red = png_get_uint_16(buf);
  ------------------
  |  | 2595|     52|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|     52|   ((png_uint_16) \
  |  |  |  | 2582|     52|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|     52|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 2026|     52|      background.green = png_get_uint_16(buf + 2);
  ------------------
  |  | 2595|     52|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|     52|   ((png_uint_16) \
  |  |  |  | 2582|     52|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|     52|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 2027|     52|      background.blue = png_get_uint_16(buf + 4);
  ------------------
  |  | 2595|     52|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|     52|   ((png_uint_16) \
  |  |  |  | 2582|     52|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|     52|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 2028|     52|      background.gray = 0;
 2029|     52|   }
 2030|       |
 2031|     64|   png_set_bKGD(png_ptr, info_ptr, &background);
 2032|     64|}
png_handle_eXIf:
 2038|  1.68k|{
 2039|  1.68k|   unsigned int i;
 2040|       |
 2041|  1.68k|   png_debug(1, "in png_handle_eXIf");
  ------------------
  |  |  145|  1.68k|#  define png_debug(l, m) ((void)0)
  ------------------
 2042|       |
 2043|  1.68k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  1.68k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (2043:8): [True: 0, False: 1.68k]
  ------------------
 2044|      0|      png_chunk_error(png_ptr, "missing IHDR");
 2045|       |
 2046|  1.68k|   if (length < 2)
  ------------------
  |  Branch (2046:8): [True: 397, False: 1.28k]
  ------------------
 2047|    397|   {
 2048|    397|      png_crc_finish(png_ptr, length);
 2049|    397|      png_chunk_benign_error(png_ptr, "too short");
 2050|    397|      return;
 2051|    397|   }
 2052|       |
 2053|  1.28k|   else if (info_ptr == NULL || (info_ptr->valid & PNG_INFO_eXIf) != 0)
  ------------------
  |  |  747|  1.28k|#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
  ------------------
  |  Branch (2053:13): [True: 0, False: 1.28k]
  |  Branch (2053:33): [True: 200, False: 1.08k]
  ------------------
 2054|    200|   {
 2055|    200|      png_crc_finish(png_ptr, length);
 2056|    200|      png_chunk_benign_error(png_ptr, "duplicate");
 2057|    200|      return;
 2058|    200|   }
 2059|       |
 2060|  1.08k|   info_ptr->free_me |= PNG_FREE_EXIF;
  ------------------
  |  | 1757|  1.08k|#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */
  ------------------
 2061|       |
 2062|  1.08k|   info_ptr->eXIf_buf = png_voidcast(png_bytep,
  ------------------
  |  |  544|  1.08k|#  define png_voidcast(type, value) (value)
  ------------------
 2063|  1.08k|             png_malloc_warn(png_ptr, length));
 2064|       |
 2065|  1.08k|   if (info_ptr->eXIf_buf == NULL)
  ------------------
  |  Branch (2065:8): [True: 0, False: 1.08k]
  ------------------
 2066|      0|   {
 2067|      0|      png_crc_finish(png_ptr, length);
 2068|      0|      png_chunk_benign_error(png_ptr, "out of memory");
 2069|      0|      return;
 2070|      0|   }
 2071|       |
 2072|  1.03M|   for (i = 0; i < length; i++)
  ------------------
  |  Branch (2072:16): [True: 1.03M, False: 318]
  ------------------
 2073|  1.03M|   {
 2074|  1.03M|      png_byte buf[1];
 2075|  1.03M|      png_crc_read(png_ptr, buf, 1);
 2076|  1.03M|      info_ptr->eXIf_buf[i] = buf[0];
 2077|  1.03M|      if (i == 1)
  ------------------
  |  Branch (2077:11): [True: 1.07k, False: 1.03M]
  ------------------
 2078|  1.07k|      {
 2079|  1.07k|         if ((buf[0] != 'M' && buf[0] != 'I') ||
  ------------------
  |  Branch (2079:15): [True: 741, False: 334]
  |  Branch (2079:32): [True: 270, False: 471]
  ------------------
 2080|  1.07k|             (info_ptr->eXIf_buf[0] != buf[0]))
  ------------------
  |  Branch (2080:14): [True: 496, False: 309]
  ------------------
 2081|    766|         {
 2082|    766|            png_crc_finish(png_ptr, length - 2);
 2083|    766|            png_chunk_benign_error(png_ptr, "incorrect byte-order specifier");
 2084|    766|            png_free(png_ptr, info_ptr->eXIf_buf);
 2085|    766|            info_ptr->eXIf_buf = NULL;
 2086|    766|            return;
 2087|    766|         }
 2088|  1.07k|      }
 2089|  1.03M|   }
 2090|       |
 2091|    318|   if (png_crc_finish(png_ptr, 0) == 0)
  ------------------
  |  Branch (2091:8): [True: 8, False: 310]
  ------------------
 2092|      8|      png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
 2093|       |
 2094|    318|   png_free(png_ptr, info_ptr->eXIf_buf);
 2095|    318|   info_ptr->eXIf_buf = NULL;
 2096|    318|}
png_handle_hIST:
 2102|    821|{
 2103|    821|   unsigned int num, i;
 2104|    821|   png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH];
 2105|       |
 2106|    821|   png_debug(1, "in png_handle_hIST");
  ------------------
  |  |  145|    821|#  define png_debug(l, m) ((void)0)
  ------------------
 2107|       |
 2108|    821|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|    821|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (2108:8): [True: 0, False: 821]
  ------------------
 2109|      0|      png_chunk_error(png_ptr, "missing IHDR");
 2110|       |
 2111|    821|   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0 ||
  ------------------
  |  |  651|    821|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (2111:13): [True: 68, False: 753]
  ------------------
 2112|    821|       (png_ptr->mode & PNG_HAVE_PLTE) == 0)
  ------------------
  |  |  644|    753|#define PNG_HAVE_PLTE  0x02
  ------------------
  |  Branch (2112:8): [True: 191, False: 562]
  ------------------
 2113|    259|   {
 2114|    259|      png_crc_finish(png_ptr, length);
 2115|    259|      png_chunk_benign_error(png_ptr, "out of place");
 2116|    259|      return;
 2117|    259|   }
 2118|       |
 2119|    562|   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) != 0)
  ------------------
  |  |  737|    562|#define PNG_INFO_hIST 0x0040U
  ------------------
  |  Branch (2119:13): [True: 562, False: 0]
  |  Branch (2119:33): [True: 66, False: 496]
  ------------------
 2120|     66|   {
 2121|     66|      png_crc_finish(png_ptr, length);
 2122|     66|      png_chunk_benign_error(png_ptr, "duplicate");
 2123|     66|      return;
 2124|     66|   }
 2125|       |
 2126|    496|   num = length / 2 ;
 2127|       |
 2128|    496|   if (length != num * 2 ||
  ------------------
  |  Branch (2128:8): [True: 9, False: 487]
  ------------------
 2129|    496|       num != (unsigned int)png_ptr->num_palette ||
  ------------------
  |  Branch (2129:8): [True: 87, False: 400]
  ------------------
 2130|    496|       num > (unsigned int)PNG_MAX_PALETTE_LENGTH)
  ------------------
  |  |  724|    400|#define PNG_MAX_PALETTE_LENGTH    256
  ------------------
  |  Branch (2130:8): [True: 0, False: 400]
  ------------------
 2131|     96|   {
 2132|     96|      png_crc_finish(png_ptr, length);
 2133|     96|      png_chunk_benign_error(png_ptr, "invalid");
 2134|     96|      return;
 2135|     96|   }
 2136|       |
 2137|  1.02k|   for (i = 0; i < num; i++)
  ------------------
  |  Branch (2137:16): [True: 622, False: 400]
  ------------------
 2138|    622|   {
 2139|    622|      png_byte buf[2];
 2140|       |
 2141|    622|      png_crc_read(png_ptr, buf, 2);
 2142|    622|      readbuf[i] = png_get_uint_16(buf);
  ------------------
  |  | 2595|    622|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|    622|   ((png_uint_16) \
  |  |  |  | 2582|    622|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|    622|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 2143|    622|   }
 2144|       |
 2145|    400|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (2145:8): [True: 159, False: 241]
  ------------------
 2146|    159|      return;
 2147|       |
 2148|    241|   png_set_hIST(png_ptr, info_ptr, readbuf);
 2149|    241|}
png_handle_pHYs:
 2155|    437|{
 2156|    437|   png_byte buf[9];
 2157|    437|   png_uint_32 res_x, res_y;
 2158|    437|   int unit_type;
 2159|       |
 2160|    437|   png_debug(1, "in png_handle_pHYs");
  ------------------
  |  |  145|    437|#  define png_debug(l, m) ((void)0)
  ------------------
 2161|       |
 2162|    437|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|    437|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (2162:8): [True: 0, False: 437]
  ------------------
 2163|      0|      png_chunk_error(png_ptr, "missing IHDR");
 2164|       |
 2165|    437|   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|    437|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (2165:13): [True: 67, False: 370]
  ------------------
 2166|     67|   {
 2167|     67|      png_crc_finish(png_ptr, length);
 2168|     67|      png_chunk_benign_error(png_ptr, "out of place");
 2169|     67|      return;
 2170|     67|   }
 2171|       |
 2172|    370|   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) != 0)
  ------------------
  |  |  738|    370|#define PNG_INFO_pHYs 0x0080U
  ------------------
  |  Branch (2172:13): [True: 370, False: 0]
  |  Branch (2172:33): [True: 81, False: 289]
  ------------------
 2173|     81|   {
 2174|     81|      png_crc_finish(png_ptr, length);
 2175|     81|      png_chunk_benign_error(png_ptr, "duplicate");
 2176|     81|      return;
 2177|     81|   }
 2178|       |
 2179|    289|   if (length != 9)
  ------------------
  |  Branch (2179:8): [True: 63, False: 226]
  ------------------
 2180|     63|   {
 2181|     63|      png_crc_finish(png_ptr, length);
 2182|     63|      png_chunk_benign_error(png_ptr, "invalid");
 2183|     63|      return;
 2184|     63|   }
 2185|       |
 2186|    226|   png_crc_read(png_ptr, buf, 9);
 2187|       |
 2188|    226|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (2188:8): [True: 208, False: 18]
  ------------------
 2189|    208|      return;
 2190|       |
 2191|     18|   res_x = png_get_uint_32(buf);
  ------------------
  |  | 2594|     18|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|     18|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|     18|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|     18|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|     18|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2192|     18|   res_y = png_get_uint_32(buf + 4);
  ------------------
  |  | 2594|     18|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|     18|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|     18|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|     18|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|     18|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
 2193|     18|   unit_type = buf[8];
 2194|     18|   png_set_pHYs(png_ptr, info_ptr, res_x, res_y, unit_type);
 2195|     18|}
png_handle_oFFs:
 2201|    537|{
 2202|    537|   png_byte buf[9];
 2203|    537|   png_int_32 offset_x, offset_y;
 2204|    537|   int unit_type;
 2205|       |
 2206|    537|   png_debug(1, "in png_handle_oFFs");
  ------------------
  |  |  145|    537|#  define png_debug(l, m) ((void)0)
  ------------------
 2207|       |
 2208|    537|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|    537|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (2208:8): [True: 0, False: 537]
  ------------------
 2209|      0|      png_chunk_error(png_ptr, "missing IHDR");
 2210|       |
 2211|    537|   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|    537|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (2211:13): [True: 194, False: 343]
  ------------------
 2212|    194|   {
 2213|    194|      png_crc_finish(png_ptr, length);
 2214|    194|      png_chunk_benign_error(png_ptr, "out of place");
 2215|    194|      return;
 2216|    194|   }
 2217|       |
 2218|    343|   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) != 0)
  ------------------
  |  |  739|    343|#define PNG_INFO_oFFs 0x0100U
  ------------------
  |  Branch (2218:13): [True: 343, False: 0]
  |  Branch (2218:33): [True: 66, False: 277]
  ------------------
 2219|     66|   {
 2220|     66|      png_crc_finish(png_ptr, length);
 2221|     66|      png_chunk_benign_error(png_ptr, "duplicate");
 2222|     66|      return;
 2223|     66|   }
 2224|       |
 2225|    277|   if (length != 9)
  ------------------
  |  Branch (2225:8): [True: 73, False: 204]
  ------------------
 2226|     73|   {
 2227|     73|      png_crc_finish(png_ptr, length);
 2228|     73|      png_chunk_benign_error(png_ptr, "invalid");
 2229|     73|      return;
 2230|     73|   }
 2231|       |
 2232|    204|   png_crc_read(png_ptr, buf, 9);
 2233|       |
 2234|    204|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (2234:8): [True: 196, False: 8]
  ------------------
 2235|    196|      return;
 2236|       |
 2237|      8|   offset_x = png_get_int_32(buf);
  ------------------
  |  | 2596|      8|#    define png_get_int_32(buf)  PNG_get_int_32(buf)
  |  |  ------------------
  |  |  |  | 2586|      8|   ((png_int_32)((*(buf) & 0x80) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (2586:18): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  |  | 2587|      8|    ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2594|      0|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 2572|      0|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  |  |  |  |  | 2573|      0|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  |  |  |  |  | 2574|      0|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  |  |  |  |  | 2575|      0|    ((png_uint_32)(*((buf) + 3))))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 2588|      8|    : (png_int_32)png_get_uint_32(buf)))
  |  |  |  |  ------------------
  |  |  |  |  |  | 2594|      8|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 2572|      8|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  |  |  |  |  | 2573|      8|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  |  |  |  |  | 2574|      8|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  |  |  |  |  | 2575|      8|    ((png_uint_32)(*((buf) + 3))))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2238|      8|   offset_y = png_get_int_32(buf + 4);
  ------------------
  |  | 2596|      8|#    define png_get_int_32(buf)  PNG_get_int_32(buf)
  |  |  ------------------
  |  |  |  | 2586|      8|   ((png_int_32)((*(buf) & 0x80) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (2586:18): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  |  | 2587|      8|    ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2594|      0|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 2572|      0|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  |  |  |  |  | 2573|      0|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  |  |  |  |  | 2574|      0|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  |  |  |  |  | 2575|      0|    ((png_uint_32)(*((buf) + 3))))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 2588|      8|    : (png_int_32)png_get_uint_32(buf)))
  |  |  |  |  ------------------
  |  |  |  |  |  | 2594|      8|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 2572|      8|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  |  |  |  |  | 2573|      8|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  |  |  |  |  | 2574|      8|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  |  |  |  |  | 2575|      8|    ((png_uint_32)(*((buf) + 3))))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2239|      8|   unit_type = buf[8];
 2240|      8|   png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, unit_type);
 2241|      8|}
png_handle_pCAL:
 2248|  5.39k|{
 2249|  5.39k|   png_int_32 X0, X1;
 2250|  5.39k|   png_byte type, nparams;
 2251|  5.39k|   png_bytep buffer, buf, units, endptr;
 2252|  5.39k|   png_charpp params;
 2253|  5.39k|   int i;
 2254|       |
 2255|  5.39k|   png_debug(1, "in png_handle_pCAL");
  ------------------
  |  |  145|  5.39k|#  define png_debug(l, m) ((void)0)
  ------------------
 2256|       |
 2257|  5.39k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  5.39k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (2257:8): [True: 0, False: 5.39k]
  ------------------
 2258|      0|      png_chunk_error(png_ptr, "missing IHDR");
 2259|       |
 2260|  5.39k|   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|  5.39k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (2260:13): [True: 204, False: 5.19k]
  ------------------
 2261|    204|   {
 2262|    204|      png_crc_finish(png_ptr, length);
 2263|    204|      png_chunk_benign_error(png_ptr, "out of place");
 2264|    204|      return;
 2265|    204|   }
 2266|       |
 2267|  5.19k|   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL) != 0)
  ------------------
  |  |  741|  5.19k|#define PNG_INFO_pCAL 0x0400U
  ------------------
  |  Branch (2267:13): [True: 5.19k, False: 0]
  |  Branch (2267:33): [True: 210, False: 4.98k]
  ------------------
 2268|    210|   {
 2269|    210|      png_crc_finish(png_ptr, length);
 2270|    210|      png_chunk_benign_error(png_ptr, "duplicate");
 2271|    210|      return;
 2272|    210|   }
 2273|       |
 2274|  4.98k|   png_debug1(2, "Allocating and reading pCAL chunk data (%u bytes)",
  ------------------
  |  |  148|  4.98k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
 2275|  4.98k|       length + 1);
 2276|       |
 2277|  4.98k|   buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
 2278|       |
 2279|  4.98k|   if (buffer == NULL)
  ------------------
  |  Branch (2279:8): [True: 0, False: 4.98k]
  ------------------
 2280|      0|   {
 2281|      0|      png_crc_finish(png_ptr, length);
 2282|      0|      png_chunk_benign_error(png_ptr, "out of memory");
 2283|      0|      return;
 2284|      0|   }
 2285|       |
 2286|  4.98k|   png_crc_read(png_ptr, buffer, length);
 2287|       |
 2288|  4.98k|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (2288:8): [True: 1.85k, False: 3.12k]
  ------------------
 2289|  1.85k|      return;
 2290|       |
 2291|  3.12k|   buffer[length] = 0; /* Null terminate the last string */
 2292|       |
 2293|  3.12k|   png_debug(3, "Finding end of pCAL purpose string");
  ------------------
  |  |  145|  3.12k|#  define png_debug(l, m) ((void)0)
  ------------------
 2294|  3.63k|   for (buf = buffer; *buf; buf++)
  ------------------
  |  Branch (2294:23): [True: 507, False: 3.12k]
  ------------------
 2295|    507|      /* Empty loop */ ;
 2296|       |
 2297|  3.12k|   endptr = buffer + length;
 2298|       |
 2299|       |   /* We need to have at least 12 bytes after the purpose string
 2300|       |    * in order to get the parameter information.
 2301|       |    */
 2302|  3.12k|   if (endptr - buf <= 12)
  ------------------
  |  Branch (2302:8): [True: 1.06k, False: 2.05k]
  ------------------
 2303|  1.06k|   {
 2304|  1.06k|      png_chunk_benign_error(png_ptr, "invalid");
 2305|  1.06k|      return;
 2306|  1.06k|   }
 2307|       |
 2308|  2.05k|   png_debug(3, "Reading pCAL X0, X1, type, nparams, and units");
  ------------------
  |  |  145|  2.05k|#  define png_debug(l, m) ((void)0)
  ------------------
 2309|  2.05k|   X0 = png_get_int_32((png_bytep)buf+1);
  ------------------
  |  | 2596|  2.05k|#    define png_get_int_32(buf)  PNG_get_int_32(buf)
  |  |  ------------------
  |  |  |  | 2586|  2.05k|   ((png_int_32)((*(buf) & 0x80) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (2586:18): [True: 640, False: 1.41k]
  |  |  |  |  ------------------
  |  |  |  | 2587|  2.05k|    ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2594|    640|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 2572|    640|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  |  |  |  |  | 2573|    640|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  |  |  |  |  | 2574|    640|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  |  |  |  |  | 2575|    640|    ((png_uint_32)(*((buf) + 3))))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 2588|  2.05k|    : (png_int_32)png_get_uint_32(buf)))
  |  |  |  |  ------------------
  |  |  |  |  |  | 2594|  1.41k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 2572|  1.41k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  |  |  |  |  | 2573|  1.41k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  |  |  |  |  | 2574|  1.41k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  |  |  |  |  | 2575|  1.41k|    ((png_uint_32)(*((buf) + 3))))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2310|  2.05k|   X1 = png_get_int_32((png_bytep)buf+5);
  ------------------
  |  | 2596|  2.05k|#    define png_get_int_32(buf)  PNG_get_int_32(buf)
  |  |  ------------------
  |  |  |  | 2586|  2.05k|   ((png_int_32)((*(buf) & 0x80) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (2586:18): [True: 352, False: 1.70k]
  |  |  |  |  ------------------
  |  |  |  | 2587|  2.05k|    ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2594|    352|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 2572|    352|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  |  |  |  |  | 2573|    352|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  |  |  |  |  | 2574|    352|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  |  |  |  |  | 2575|    352|    ((png_uint_32)(*((buf) + 3))))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 2588|  2.05k|    : (png_int_32)png_get_uint_32(buf)))
  |  |  |  |  ------------------
  |  |  |  |  |  | 2594|  1.70k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 2572|  1.70k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  |  |  |  |  | 2573|  1.70k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  |  |  |  |  | 2574|  1.70k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  |  |  |  |  | 2575|  1.70k|    ((png_uint_32)(*((buf) + 3))))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2311|  2.05k|   type = buf[9];
 2312|  2.05k|   nparams = buf[10];
 2313|  2.05k|   units = buf + 11;
 2314|       |
 2315|  2.05k|   png_debug(3, "Checking pCAL equation type and number of parameters");
  ------------------
  |  |  145|  2.05k|#  define png_debug(l, m) ((void)0)
  ------------------
 2316|       |   /* Check that we have the right number of parameters for known
 2317|       |    * equation types.
 2318|       |    */
 2319|  2.05k|   if ((type == PNG_EQUATION_LINEAR && nparams != 2) ||
  ------------------
  |  |  696|  4.11k|#define PNG_EQUATION_LINEAR       0 /* Linear transformation */
  ------------------
  |  Branch (2319:9): [True: 462, False: 1.59k]
  |  Branch (2319:40): [True: 195, False: 267]
  ------------------
 2320|  2.05k|       (type == PNG_EQUATION_BASE_E && nparams != 3) ||
  ------------------
  |  |  697|  3.65k|#define PNG_EQUATION_BASE_E       1 /* Exponential base e transform */
  ------------------
  |  Branch (2320:9): [True: 233, False: 1.59k]
  |  Branch (2320:40): [True: 38, False: 195]
  ------------------
 2321|  2.05k|       (type == PNG_EQUATION_ARBITRARY && nparams != 3) ||
  ------------------
  |  |  698|  3.57k|#define PNG_EQUATION_ARBITRARY    2 /* Arbitrary base exponential transform */
  ------------------
  |  Branch (2321:9): [True: 401, False: 1.38k]
  |  Branch (2321:43): [True: 194, False: 207]
  ------------------
 2322|  2.05k|       (type == PNG_EQUATION_HYPERBOLIC && nparams != 4))
  ------------------
  |  |  699|  3.18k|#define PNG_EQUATION_HYPERBOLIC   3 /* Hyperbolic sine transformation */
  ------------------
  |  Branch (2322:9): [True: 501, False: 1.09k]
  |  Branch (2322:44): [True: 196, False: 305]
  ------------------
 2323|    623|   {
 2324|    623|      png_chunk_benign_error(png_ptr, "invalid parameter count");
 2325|    623|      return;
 2326|    623|   }
 2327|       |
 2328|  1.43k|   else if (type >= PNG_EQUATION_LAST)
  ------------------
  |  |  700|  1.43k|#define PNG_EQUATION_LAST         4 /* Not a valid value */
  ------------------
  |  Branch (2328:13): [True: 423, False: 1.01k]
  ------------------
 2329|    423|   {
 2330|    423|      png_chunk_benign_error(png_ptr, "unrecognized equation type");
 2331|    423|   }
 2332|       |
 2333|  2.06k|   for (buf = units; *buf; buf++)
  ------------------
  |  Branch (2333:22): [True: 634, False: 1.43k]
  ------------------
 2334|    634|      /* Empty loop to move past the units string. */ ;
 2335|       |
 2336|  1.43k|   png_debug(3, "Allocating pCAL parameters array");
  ------------------
  |  |  145|  1.43k|#  define png_debug(l, m) ((void)0)
  ------------------
 2337|       |
 2338|  1.43k|   params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
  ------------------
  |  |  544|  1.43k|#  define png_voidcast(type, value) (value)
  ------------------
 2339|  1.43k|       nparams * (sizeof (png_charp))));
 2340|       |
 2341|  1.43k|   if (params == NULL)
  ------------------
  |  Branch (2341:8): [True: 194, False: 1.24k]
  ------------------
 2342|    194|   {
 2343|    194|      png_chunk_benign_error(png_ptr, "out of memory");
 2344|    194|      return;
 2345|    194|   }
 2346|       |
 2347|       |   /* Get pointers to the start of each parameter string. */
 2348|  4.01k|   for (i = 0; i < nparams; i++)
  ------------------
  |  Branch (2348:16): [True: 3.23k, False: 773]
  ------------------
 2349|  3.23k|   {
 2350|  3.23k|      buf++; /* Skip the null string terminator from previous parameter. */
 2351|       |
 2352|  3.23k|      png_debug1(3, "Reading pCAL parameter %d", i);
  ------------------
  |  |  148|  3.23k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
 2353|       |
 2354|  4.77k|      for (params[i] = (png_charp)buf; buf <= endptr && *buf != 0; buf++)
  ------------------
  |  Branch (2354:40): [True: 4.30k, False: 468]
  |  Branch (2354:57): [True: 1.53k, False: 2.76k]
  ------------------
 2355|  1.53k|         /* Empty loop to move past each parameter string */ ;
 2356|       |
 2357|       |      /* Make sure we haven't run out of data yet */
 2358|  3.23k|      if (buf > endptr)
  ------------------
  |  Branch (2358:11): [True: 468, False: 2.76k]
  ------------------
 2359|    468|      {
 2360|    468|         png_free(png_ptr, params);
 2361|    468|         png_chunk_benign_error(png_ptr, "invalid data");
 2362|    468|         return;
 2363|    468|      }
 2364|  3.23k|   }
 2365|       |
 2366|    773|   png_set_pCAL(png_ptr, info_ptr, (png_charp)buffer, X0, X1, type, nparams,
 2367|    773|       (png_charp)units, params);
 2368|       |
 2369|    773|   png_free(png_ptr, params);
 2370|    773|}
png_handle_sCAL:
 2377|  6.45k|{
 2378|  6.45k|   png_bytep buffer;
 2379|  6.45k|   size_t i;
 2380|  6.45k|   int state;
 2381|       |
 2382|  6.45k|   png_debug(1, "in png_handle_sCAL");
  ------------------
  |  |  145|  6.45k|#  define png_debug(l, m) ((void)0)
  ------------------
 2383|       |
 2384|  6.45k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  6.45k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (2384:8): [True: 0, False: 6.45k]
  ------------------
 2385|      0|      png_chunk_error(png_ptr, "missing IHDR");
 2386|       |
 2387|  6.45k|   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|  6.45k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (2387:13): [True: 75, False: 6.37k]
  ------------------
 2388|     75|   {
 2389|     75|      png_crc_finish(png_ptr, length);
 2390|     75|      png_chunk_benign_error(png_ptr, "out of place");
 2391|     75|      return;
 2392|     75|   }
 2393|       |
 2394|  6.37k|   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL) != 0)
  ------------------
  |  |  745|  6.37k|#define PNG_INFO_sCAL 0x4000U  /* ESR, 1.0.6 */
  ------------------
  |  Branch (2394:13): [True: 6.37k, False: 0]
  |  Branch (2394:33): [True: 205, False: 6.17k]
  ------------------
 2395|    205|   {
 2396|    205|      png_crc_finish(png_ptr, length);
 2397|    205|      png_chunk_benign_error(png_ptr, "duplicate");
 2398|    205|      return;
 2399|    205|   }
 2400|       |
 2401|       |   /* Need unit type, width, \0, height: minimum 4 bytes */
 2402|  6.17k|   else if (length < 4)
  ------------------
  |  Branch (2402:13): [True: 192, False: 5.97k]
  ------------------
 2403|    192|   {
 2404|    192|      png_crc_finish(png_ptr, length);
 2405|    192|      png_chunk_benign_error(png_ptr, "invalid");
 2406|    192|      return;
 2407|    192|   }
 2408|       |
 2409|  5.97k|   png_debug1(2, "Allocating and reading sCAL chunk data (%u bytes)",
  ------------------
  |  |  148|  5.97k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
 2410|  5.97k|       length + 1);
 2411|       |
 2412|  5.97k|   buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
 2413|       |
 2414|  5.97k|   if (buffer == NULL)
  ------------------
  |  Branch (2414:8): [True: 0, False: 5.97k]
  ------------------
 2415|      0|   {
 2416|      0|      png_chunk_benign_error(png_ptr, "out of memory");
 2417|      0|      png_crc_finish(png_ptr, length);
 2418|      0|      return;
 2419|      0|   }
 2420|       |
 2421|  5.97k|   png_crc_read(png_ptr, buffer, length);
 2422|  5.97k|   buffer[length] = 0; /* Null terminate the last string */
 2423|       |
 2424|  5.97k|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (2424:8): [True: 1.65k, False: 4.32k]
  ------------------
 2425|  1.65k|      return;
 2426|       |
 2427|       |   /* Validate the unit. */
 2428|  4.32k|   if (buffer[0] != 1 && buffer[0] != 2)
  ------------------
  |  Branch (2428:8): [True: 2.59k, False: 1.72k]
  |  Branch (2428:26): [True: 193, False: 2.40k]
  ------------------
 2429|    193|   {
 2430|    193|      png_chunk_benign_error(png_ptr, "invalid unit");
 2431|    193|      return;
 2432|    193|   }
 2433|       |
 2434|       |   /* Validate the ASCII numbers, need two ASCII numbers separated by
 2435|       |    * a '\0' and they need to fit exactly in the chunk data.
 2436|       |    */
 2437|  4.12k|   i = 1;
 2438|  4.12k|   state = 0;
 2439|       |
 2440|  4.12k|   if (png_check_fp_number((png_const_charp)buffer, length, &state, &i) == 0 ||
  ------------------
  |  Branch (2440:8): [True: 1.55k, False: 2.56k]
  ------------------
 2441|  4.12k|       i >= length || buffer[i++] != 0)
  ------------------
  |  Branch (2441:8): [True: 316, False: 2.25k]
  |  Branch (2441:23): [True: 653, False: 1.60k]
  ------------------
 2442|  2.49k|      png_chunk_benign_error(png_ptr, "bad width format");
 2443|       |
 2444|  1.63k|   else if (PNG_FP_IS_POSITIVE(state) == 0)
  ------------------
  |  | 1998|  1.63k|#define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK)
  |  |  ------------------
  |  |  |  | 1992|  1.63k|#define PNG_FP_NZ_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NEGATIVE | PNG_FP_NONZERO)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1964|  1.63k|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  |  |  |  |  ------------------
  |  |  |  |               #define PNG_FP_NZ_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NEGATIVE | PNG_FP_NONZERO)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1972|  1.63k|#define PNG_FP_NEGATIVE 128  /* A negative number, including "-0" */
  |  |  |  |  ------------------
  |  |  |  |               #define PNG_FP_NZ_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NEGATIVE | PNG_FP_NONZERO)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1973|  1.63k|#define PNG_FP_NONZERO  256  /* A non-zero value */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK)
  |  |  ------------------
  |  |  |  | 1994|  1.63k|#define PNG_FP_Z_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NONZERO)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1964|  1.63k|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  |  |  |  |  ------------------
  |  |  |  |               #define PNG_FP_Z_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NONZERO)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1973|  1.63k|#define PNG_FP_NONZERO  256  /* A non-zero value */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2444:13): [True: 209, False: 1.42k]
  ------------------
 2445|    209|      png_chunk_benign_error(png_ptr, "non-positive width");
 2446|       |
 2447|  1.42k|   else
 2448|  1.42k|   {
 2449|  1.42k|      size_t heighti = i;
 2450|       |
 2451|  1.42k|      state = 0;
 2452|  1.42k|      if (png_check_fp_number((png_const_charp)buffer, length,
  ------------------
  |  Branch (2452:11): [True: 548, False: 881]
  ------------------
 2453|  1.42k|          &state, &i) == 0 || i != length)
  ------------------
  |  Branch (2453:31): [True: 578, False: 303]
  ------------------
 2454|  1.08k|         png_chunk_benign_error(png_ptr, "bad height format");
 2455|       |
 2456|    341|      else if (PNG_FP_IS_POSITIVE(state) == 0)
  ------------------
  |  | 1998|    341|#define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK)
  |  |  ------------------
  |  |  |  | 1992|    341|#define PNG_FP_NZ_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NEGATIVE | PNG_FP_NONZERO)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1964|    341|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  |  |  |  |  ------------------
  |  |  |  |               #define PNG_FP_NZ_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NEGATIVE | PNG_FP_NONZERO)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1972|    341|#define PNG_FP_NEGATIVE 128  /* A negative number, including "-0" */
  |  |  |  |  ------------------
  |  |  |  |               #define PNG_FP_NZ_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NEGATIVE | PNG_FP_NONZERO)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1973|    341|#define PNG_FP_NONZERO  256  /* A non-zero value */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK)
  |  |  ------------------
  |  |  |  | 1994|    341|#define PNG_FP_Z_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NONZERO)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1964|    341|#define PNG_FP_SAW_DIGIT  8  /* Saw a digit in current state */
  |  |  |  |  ------------------
  |  |  |  |               #define PNG_FP_Z_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NONZERO)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1973|    341|#define PNG_FP_NONZERO  256  /* A non-zero value */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2456:16): [True: 289, False: 52]
  ------------------
 2457|    289|         png_chunk_benign_error(png_ptr, "non-positive height");
 2458|       |
 2459|     52|      else
 2460|       |         /* This is the (only) success case. */
 2461|     52|         png_set_sCAL_s(png_ptr, info_ptr, buffer[0],
 2462|     52|             (png_charp)buffer+1, (png_charp)buffer+heighti);
 2463|  1.42k|   }
 2464|  4.12k|}
png_handle_tIME:
 2470|  1.70k|{
 2471|  1.70k|   png_byte buf[7];
 2472|  1.70k|   png_time mod_time;
 2473|       |
 2474|  1.70k|   png_debug(1, "in png_handle_tIME");
  ------------------
  |  |  145|  1.70k|#  define png_debug(l, m) ((void)0)
  ------------------
 2475|       |
 2476|  1.70k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  1.70k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (2476:8): [True: 0, False: 1.70k]
  ------------------
 2477|      0|      png_chunk_error(png_ptr, "missing IHDR");
 2478|       |
 2479|  1.70k|   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) != 0)
  ------------------
  |  |  740|  1.70k|#define PNG_INFO_tIME 0x0200U
  ------------------
  |  Branch (2479:13): [True: 1.70k, False: 0]
  |  Branch (2479:33): [True: 66, False: 1.63k]
  ------------------
 2480|     66|   {
 2481|     66|      png_crc_finish(png_ptr, length);
 2482|     66|      png_chunk_benign_error(png_ptr, "duplicate");
 2483|     66|      return;
 2484|     66|   }
 2485|       |
 2486|  1.63k|   if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|  1.63k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (2486:8): [True: 205, False: 1.43k]
  ------------------
 2487|    205|      png_ptr->mode |= PNG_AFTER_IDAT;
  ------------------
  |  |  645|    205|#define PNG_AFTER_IDAT 0x08
  ------------------
 2488|       |
 2489|  1.63k|   if (length != 7)
  ------------------
  |  Branch (2489:8): [True: 258, False: 1.38k]
  ------------------
 2490|    258|   {
 2491|    258|      png_crc_finish(png_ptr, length);
 2492|    258|      png_chunk_benign_error(png_ptr, "invalid");
 2493|    258|      return;
 2494|    258|   }
 2495|       |
 2496|  1.38k|   png_crc_read(png_ptr, buf, 7);
 2497|       |
 2498|  1.38k|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (2498:8): [True: 169, False: 1.21k]
  ------------------
 2499|    169|      return;
 2500|       |
 2501|  1.21k|   mod_time.second = buf[6];
 2502|  1.21k|   mod_time.minute = buf[5];
 2503|  1.21k|   mod_time.hour = buf[4];
 2504|  1.21k|   mod_time.day = buf[3];
 2505|  1.21k|   mod_time.month = buf[2];
 2506|  1.21k|   mod_time.year = png_get_uint_16(buf);
  ------------------
  |  | 2595|  1.21k|#    define png_get_uint_16(buf) PNG_get_uint_16(buf)
  |  |  ------------------
  |  |  |  | 2581|  1.21k|   ((png_uint_16) \
  |  |  |  | 2582|  1.21k|    (((unsigned int)(*(buf)) << 8) + \
  |  |  |  | 2583|  1.21k|    ((unsigned int)(*((buf) + 1)))))
  |  |  ------------------
  ------------------
 2507|       |
 2508|  1.21k|   png_set_tIME(png_ptr, info_ptr, &mod_time);
 2509|  1.21k|}
png_handle_tEXt:
 2516|  13.9k|{
 2517|  13.9k|   png_text  text_info;
 2518|  13.9k|   png_bytep buffer;
 2519|  13.9k|   png_charp key;
 2520|  13.9k|   png_charp text;
 2521|  13.9k|   png_uint_32 skip = 0;
 2522|       |
 2523|  13.9k|   png_debug(1, "in png_handle_tEXt");
  ------------------
  |  |  145|  13.9k|#  define png_debug(l, m) ((void)0)
  ------------------
 2524|       |
 2525|  13.9k|#ifdef PNG_USER_LIMITS_SUPPORTED
 2526|  13.9k|   if (png_ptr->user_chunk_cache_max != 0)
  ------------------
  |  Branch (2526:8): [True: 13.9k, False: 0]
  ------------------
 2527|  13.9k|   {
 2528|  13.9k|      if (png_ptr->user_chunk_cache_max == 1)
  ------------------
  |  Branch (2528:11): [True: 197, False: 13.7k]
  ------------------
 2529|    197|      {
 2530|    197|         png_crc_finish(png_ptr, length);
 2531|    197|         return;
 2532|    197|      }
 2533|       |
 2534|  13.7k|      if (--png_ptr->user_chunk_cache_max == 1)
  ------------------
  |  Branch (2534:11): [True: 9, False: 13.7k]
  ------------------
 2535|      9|      {
 2536|      9|         png_crc_finish(png_ptr, length);
 2537|      9|         png_chunk_benign_error(png_ptr, "no space in chunk cache");
 2538|      9|         return;
 2539|      9|      }
 2540|  13.7k|   }
 2541|  13.7k|#endif
 2542|       |
 2543|  13.7k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  13.7k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (2543:8): [True: 0, False: 13.7k]
  ------------------
 2544|      0|      png_chunk_error(png_ptr, "missing IHDR");
 2545|       |
 2546|  13.7k|   if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|  13.7k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (2546:8): [True: 345, False: 13.4k]
  ------------------
 2547|    345|      png_ptr->mode |= PNG_AFTER_IDAT;
  ------------------
  |  |  645|    345|#define PNG_AFTER_IDAT 0x08
  ------------------
 2548|       |
 2549|       |#ifdef PNG_MAX_MALLOC_64K
 2550|       |   if (length > 65535U)
 2551|       |   {
 2552|       |      png_crc_finish(png_ptr, length);
 2553|       |      png_chunk_benign_error(png_ptr, "too large to fit in memory");
 2554|       |      return;
 2555|       |   }
 2556|       |#endif
 2557|       |
 2558|  13.7k|   buffer = png_read_buffer(png_ptr, length+1, 1/*warn*/);
 2559|       |
 2560|  13.7k|   if (buffer == NULL)
  ------------------
  |  Branch (2560:8): [True: 0, False: 13.7k]
  ------------------
 2561|      0|   {
 2562|      0|      png_chunk_benign_error(png_ptr, "out of memory");
 2563|      0|      return;
 2564|      0|   }
 2565|       |
 2566|  13.7k|   png_crc_read(png_ptr, buffer, length);
 2567|       |
 2568|  13.7k|   if (png_crc_finish(png_ptr, skip) != 0)
  ------------------
  |  Branch (2568:8): [True: 1.00k, False: 12.7k]
  ------------------
 2569|  1.00k|      return;
 2570|       |
 2571|  12.7k|   key = (png_charp)buffer;
 2572|  12.7k|   key[length] = 0;
 2573|       |
 2574|  12.9k|   for (text = key; *text; text++)
  ------------------
  |  Branch (2574:21): [True: 221, False: 12.7k]
  ------------------
 2575|    221|      /* Empty loop to find end of key */ ;
 2576|       |
 2577|  12.7k|   if (text != key + length)
  ------------------
  |  Branch (2577:8): [True: 397, False: 12.3k]
  ------------------
 2578|    397|      text++;
 2579|       |
 2580|  12.7k|   text_info.compression = PNG_TEXT_COMPRESSION_NONE;
  ------------------
  |  |  587|  12.7k|#define PNG_TEXT_COMPRESSION_NONE    -1
  ------------------
 2581|  12.7k|   text_info.key = key;
 2582|  12.7k|   text_info.lang = NULL;
 2583|  12.7k|   text_info.lang_key = NULL;
 2584|  12.7k|   text_info.itxt_length = 0;
 2585|  12.7k|   text_info.text = text;
 2586|  12.7k|   text_info.text_length = strlen(text);
 2587|       |
 2588|  12.7k|   if (png_set_text_2(png_ptr, info_ptr, &text_info, 1) != 0)
  ------------------
  |  Branch (2588:8): [True: 0, False: 12.7k]
  ------------------
 2589|      0|      png_warning(png_ptr, "Insufficient memory to process text chunk");
 2590|  12.7k|}
png_handle_zTXt:
 2597|  25.3k|{
 2598|  25.3k|   png_const_charp errmsg = NULL;
 2599|  25.3k|   png_bytep       buffer;
 2600|  25.3k|   png_uint_32     keyword_length;
 2601|       |
 2602|  25.3k|   png_debug(1, "in png_handle_zTXt");
  ------------------
  |  |  145|  25.3k|#  define png_debug(l, m) ((void)0)
  ------------------
 2603|       |
 2604|  25.3k|#ifdef PNG_USER_LIMITS_SUPPORTED
 2605|  25.3k|   if (png_ptr->user_chunk_cache_max != 0)
  ------------------
  |  Branch (2605:8): [True: 25.3k, False: 0]
  ------------------
 2606|  25.3k|   {
 2607|  25.3k|      if (png_ptr->user_chunk_cache_max == 1)
  ------------------
  |  Branch (2607:11): [True: 222, False: 25.1k]
  ------------------
 2608|    222|      {
 2609|    222|         png_crc_finish(png_ptr, length);
 2610|    222|         return;
 2611|    222|      }
 2612|       |
 2613|  25.1k|      if (--png_ptr->user_chunk_cache_max == 1)
  ------------------
  |  Branch (2613:11): [True: 11, False: 25.1k]
  ------------------
 2614|     11|      {
 2615|     11|         png_crc_finish(png_ptr, length);
 2616|     11|         png_chunk_benign_error(png_ptr, "no space in chunk cache");
 2617|     11|         return;
 2618|     11|      }
 2619|  25.1k|   }
 2620|  25.1k|#endif
 2621|       |
 2622|  25.1k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  25.1k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (2622:8): [True: 0, False: 25.1k]
  ------------------
 2623|      0|      png_chunk_error(png_ptr, "missing IHDR");
 2624|       |
 2625|  25.1k|   if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|  25.1k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (2625:8): [True: 208, False: 24.9k]
  ------------------
 2626|    208|      png_ptr->mode |= PNG_AFTER_IDAT;
  ------------------
  |  |  645|    208|#define PNG_AFTER_IDAT 0x08
  ------------------
 2627|       |
 2628|       |   /* Note, "length" is sufficient here; we won't be adding
 2629|       |    * a null terminator later.
 2630|       |    */
 2631|  25.1k|   buffer = png_read_buffer(png_ptr, length, 2/*silent*/);
 2632|       |
 2633|  25.1k|   if (buffer == NULL)
  ------------------
  |  Branch (2633:8): [True: 1.19k, False: 23.9k]
  ------------------
 2634|  1.19k|   {
 2635|  1.19k|      png_crc_finish(png_ptr, length);
 2636|  1.19k|      png_chunk_benign_error(png_ptr, "out of memory");
 2637|  1.19k|      return;
 2638|  1.19k|   }
 2639|       |
 2640|  23.9k|   png_crc_read(png_ptr, buffer, length);
 2641|       |
 2642|  23.9k|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (2642:8): [True: 20.2k, False: 3.68k]
  ------------------
 2643|  20.2k|      return;
 2644|       |
 2645|       |   /* TODO: also check that the keyword contents match the spec! */
 2646|  3.68k|   for (keyword_length = 0;
 2647|  10.1k|      keyword_length < length && buffer[keyword_length] != 0;
  ------------------
  |  Branch (2647:7): [True: 9.41k, False: 703]
  |  Branch (2647:34): [True: 6.43k, False: 2.97k]
  ------------------
 2648|  6.43k|      ++keyword_length)
 2649|  6.43k|      /* Empty loop to find end of name */ ;
 2650|       |
 2651|  3.68k|   if (keyword_length > 79 || keyword_length < 1)
  ------------------
  |  Branch (2651:8): [True: 91, False: 3.59k]
  |  Branch (2651:31): [True: 406, False: 3.18k]
  ------------------
 2652|    443|      errmsg = "bad keyword";
 2653|       |
 2654|       |   /* zTXt must have some LZ data after the keyword, although it may expand to
 2655|       |    * zero bytes; we need a '\0' at the end of the keyword, the compression type
 2656|       |    * then the LZ data:
 2657|       |    */
 2658|  3.23k|   else if (keyword_length + 3 > length)
  ------------------
  |  Branch (2658:13): [True: 211, False: 3.02k]
  ------------------
 2659|    211|      errmsg = "truncated";
 2660|       |
 2661|  3.02k|   else if (buffer[keyword_length+1] != PNG_COMPRESSION_TYPE_BASE)
  ------------------
  |  |  677|  3.02k|#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
  ------------------
  |  Branch (2661:13): [True: 193, False: 2.83k]
  ------------------
 2662|    193|      errmsg = "unknown compression type";
 2663|       |
 2664|  2.83k|   else
 2665|  2.83k|   {
 2666|  2.83k|      png_alloc_size_t uncompressed_length = PNG_SIZE_MAX;
  ------------------
  |  |  650|  2.83k|#define PNG_SIZE_MAX ((size_t)(-1))
  ------------------
 2667|       |
 2668|       |      /* TODO: at present png_decompress_chunk imposes a single application
 2669|       |       * level memory limit, this should be split to different values for iCCP
 2670|       |       * and text chunks.
 2671|       |       */
 2672|  2.83k|      if (png_decompress_chunk(png_ptr, length, keyword_length+2,
  ------------------
  |  Branch (2672:11): [True: 1.72k, False: 1.11k]
  ------------------
 2673|  2.83k|          &uncompressed_length, 1/*terminate*/) == Z_STREAM_END)
 2674|  1.72k|      {
 2675|  1.72k|         png_text text;
 2676|       |
 2677|  1.72k|         if (png_ptr->read_buffer == NULL)
  ------------------
  |  Branch (2677:14): [True: 0, False: 1.72k]
  ------------------
 2678|      0|           errmsg="Read failure in png_handle_zTXt";
 2679|  1.72k|         else
 2680|  1.72k|         {
 2681|       |            /* It worked; png_ptr->read_buffer now looks like a tEXt chunk
 2682|       |             * except for the extra compression type byte and the fact that
 2683|       |             * it isn't necessarily '\0' terminated.
 2684|       |             */
 2685|  1.72k|            buffer = png_ptr->read_buffer;
 2686|  1.72k|            buffer[uncompressed_length+(keyword_length+2)] = 0;
 2687|       |
 2688|  1.72k|            text.compression = PNG_TEXT_COMPRESSION_zTXt;
  ------------------
  |  |  588|  1.72k|#define PNG_TEXT_COMPRESSION_zTXt     0
  ------------------
 2689|  1.72k|            text.key = (png_charp)buffer;
 2690|  1.72k|            text.text = (png_charp)(buffer + keyword_length+2);
 2691|  1.72k|            text.text_length = uncompressed_length;
 2692|  1.72k|            text.itxt_length = 0;
 2693|  1.72k|            text.lang = NULL;
 2694|  1.72k|            text.lang_key = NULL;
 2695|       |
 2696|  1.72k|            if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
  ------------------
  |  Branch (2696:17): [True: 0, False: 1.72k]
  ------------------
 2697|      0|               errmsg = "insufficient memory";
 2698|  1.72k|         }
 2699|  1.72k|      }
 2700|       |
 2701|  1.11k|      else
 2702|  1.11k|         errmsg = png_ptr->zstream.msg;
 2703|  2.83k|   }
 2704|       |
 2705|  3.68k|   if (errmsg != NULL)
  ------------------
  |  Branch (2705:8): [True: 1.90k, False: 1.77k]
  ------------------
 2706|  1.90k|      png_chunk_benign_error(png_ptr, errmsg);
 2707|  3.68k|}
png_handle_iTXt:
 2714|  8.09k|{
 2715|  8.09k|   png_const_charp errmsg = NULL;
 2716|  8.09k|   png_bytep buffer;
 2717|  8.09k|   png_uint_32 prefix_length;
 2718|       |
 2719|  8.09k|   png_debug(1, "in png_handle_iTXt");
  ------------------
  |  |  145|  8.09k|#  define png_debug(l, m) ((void)0)
  ------------------
 2720|       |
 2721|  8.09k|#ifdef PNG_USER_LIMITS_SUPPORTED
 2722|  8.09k|   if (png_ptr->user_chunk_cache_max != 0)
  ------------------
  |  Branch (2722:8): [True: 8.09k, False: 0]
  ------------------
 2723|  8.09k|   {
 2724|  8.09k|      if (png_ptr->user_chunk_cache_max == 1)
  ------------------
  |  Branch (2724:11): [True: 208, False: 7.89k]
  ------------------
 2725|    208|      {
 2726|    208|         png_crc_finish(png_ptr, length);
 2727|    208|         return;
 2728|    208|      }
 2729|       |
 2730|  7.89k|      if (--png_ptr->user_chunk_cache_max == 1)
  ------------------
  |  Branch (2730:11): [True: 7, False: 7.88k]
  ------------------
 2731|      7|      {
 2732|      7|         png_crc_finish(png_ptr, length);
 2733|      7|         png_chunk_benign_error(png_ptr, "no space in chunk cache");
 2734|      7|         return;
 2735|      7|      }
 2736|  7.89k|   }
 2737|  7.88k|#endif
 2738|       |
 2739|  7.88k|   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
  ------------------
  |  |  643|  7.88k|#define PNG_HAVE_IHDR  0x01
  ------------------
  |  Branch (2739:8): [True: 0, False: 7.88k]
  ------------------
 2740|      0|      png_chunk_error(png_ptr, "missing IHDR");
 2741|       |
 2742|  7.88k|   if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
  ------------------
  |  |  651|  7.88k|#define PNG_HAVE_IDAT               0x04U
  ------------------
  |  Branch (2742:8): [True: 448, False: 7.43k]
  ------------------
 2743|    448|      png_ptr->mode |= PNG_AFTER_IDAT;
  ------------------
  |  |  645|    448|#define PNG_AFTER_IDAT 0x08
  ------------------
 2744|       |
 2745|  7.88k|   buffer = png_read_buffer(png_ptr, length+1, 1/*warn*/);
 2746|       |
 2747|  7.88k|   if (buffer == NULL)
  ------------------
  |  Branch (2747:8): [True: 0, False: 7.88k]
  ------------------
 2748|      0|   {
 2749|      0|      png_crc_finish(png_ptr, length);
 2750|      0|      png_chunk_benign_error(png_ptr, "out of memory");
 2751|      0|      return;
 2752|      0|   }
 2753|       |
 2754|  7.88k|   png_crc_read(png_ptr, buffer, length);
 2755|       |
 2756|  7.88k|   if (png_crc_finish(png_ptr, 0) != 0)
  ------------------
  |  Branch (2756:8): [True: 4.66k, False: 3.22k]
  ------------------
 2757|  4.66k|      return;
 2758|       |
 2759|       |   /* First the keyword. */
 2760|  3.22k|   for (prefix_length=0;
 2761|  12.4k|      prefix_length < length && buffer[prefix_length] != 0;
  ------------------
  |  Branch (2761:7): [True: 11.0k, False: 1.44k]
  |  Branch (2761:33): [True: 9.23k, False: 1.77k]
  ------------------
 2762|  9.23k|      ++prefix_length)
 2763|  9.23k|      /* Empty loop */ ;
 2764|       |
 2765|       |   /* Perform a basic check on the keyword length here. */
 2766|  3.22k|   if (prefix_length > 79 || prefix_length < 1)
  ------------------
  |  Branch (2766:8): [True: 115, False: 3.10k]
  |  Branch (2766:30): [True: 990, False: 2.11k]
  ------------------
 2767|  1.05k|      errmsg = "bad keyword";
 2768|       |
 2769|       |   /* Expect keyword, compression flag, compression type, language, translated
 2770|       |    * keyword (both may be empty but are 0 terminated) then the text, which may
 2771|       |    * be empty.
 2772|       |    */
 2773|  2.16k|   else if (prefix_length + 5 > length)
  ------------------
  |  Branch (2773:13): [True: 853, False: 1.31k]
  ------------------
 2774|    853|      errmsg = "truncated";
 2775|       |
 2776|  1.31k|   else if (buffer[prefix_length+1] == 0 ||
  ------------------
  |  Branch (2776:13): [True: 343, False: 969]
  ------------------
 2777|  1.31k|      (buffer[prefix_length+1] == 1 &&
  ------------------
  |  Branch (2777:8): [True: 776, False: 193]
  ------------------
 2778|    969|      buffer[prefix_length+2] == PNG_COMPRESSION_TYPE_BASE))
  ------------------
  |  |  677|    776|#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
  ------------------
  |  Branch (2778:7): [True: 583, False: 193]
  ------------------
 2779|    879|   {
 2780|    879|      int compressed = buffer[prefix_length+1] != 0;
 2781|    879|      png_uint_32 language_offset, translated_keyword_offset;
 2782|    879|      png_alloc_size_t uncompressed_length = 0;
 2783|       |
 2784|       |      /* Now the language tag */
 2785|    879|      prefix_length += 3;
 2786|    879|      language_offset = prefix_length;
 2787|       |
 2788|  2.22k|      for (; prefix_length < length && buffer[prefix_length] != 0;
  ------------------
  |  Branch (2788:14): [True: 1.98k, False: 233]
  |  Branch (2788:40): [True: 1.34k, False: 646]
  ------------------
 2789|  1.34k|         ++prefix_length)
 2790|  1.34k|         /* Empty loop */ ;
 2791|       |
 2792|       |      /* WARNING: the length may be invalid here, this is checked below. */
 2793|    879|      translated_keyword_offset = ++prefix_length;
 2794|       |
 2795|  3.55k|      for (; prefix_length < length && buffer[prefix_length] != 0;
  ------------------
  |  Branch (2795:14): [True: 3.14k, False: 408]
  |  Branch (2795:40): [True: 2.67k, False: 471]
  ------------------
 2796|  2.67k|         ++prefix_length)
 2797|  2.67k|         /* Empty loop */ ;
 2798|       |
 2799|       |      /* prefix_length should now be at the trailing '\0' of the translated
 2800|       |       * keyword, but it may already be over the end.  None of this arithmetic
 2801|       |       * can overflow because chunks are at most 2^31 bytes long, but on 16-bit
 2802|       |       * systems the available allocation may overflow.
 2803|       |       */
 2804|    879|      ++prefix_length;
 2805|       |
 2806|    879|      if (compressed == 0 && prefix_length <= length)
  ------------------
  |  Branch (2806:11): [True: 296, False: 583]
  |  Branch (2806:30): [True: 83, False: 213]
  ------------------
 2807|     83|         uncompressed_length = length - prefix_length;
 2808|       |
 2809|    796|      else if (compressed != 0 && prefix_length < length)
  ------------------
  |  Branch (2809:16): [True: 583, False: 213]
  |  Branch (2809:35): [True: 387, False: 196]
  ------------------
 2810|    387|      {
 2811|    387|         uncompressed_length = PNG_SIZE_MAX;
  ------------------
  |  |  650|    387|#define PNG_SIZE_MAX ((size_t)(-1))
  ------------------
 2812|       |
 2813|       |         /* TODO: at present png_decompress_chunk imposes a single application
 2814|       |          * level memory limit, this should be split to different values for
 2815|       |          * iCCP and text chunks.
 2816|       |          */
 2817|    387|         if (png_decompress_chunk(png_ptr, length, prefix_length,
  ------------------
  |  Branch (2817:14): [True: 186, False: 201]
  ------------------
 2818|    387|             &uncompressed_length, 1/*terminate*/) == Z_STREAM_END)
 2819|    186|            buffer = png_ptr->read_buffer;
 2820|       |
 2821|    201|         else
 2822|    201|            errmsg = png_ptr->zstream.msg;
 2823|    387|      }
 2824|       |
 2825|    409|      else
 2826|    409|         errmsg = "truncated";
 2827|       |
 2828|    879|      if (errmsg == NULL)
  ------------------
  |  Branch (2828:11): [True: 269, False: 610]
  ------------------
 2829|    269|      {
 2830|    269|         png_text text;
 2831|       |
 2832|    269|         buffer[uncompressed_length+prefix_length] = 0;
 2833|       |
 2834|    269|         if (compressed == 0)
  ------------------
  |  Branch (2834:14): [True: 83, False: 186]
  ------------------
 2835|     83|            text.compression = PNG_ITXT_COMPRESSION_NONE;
  ------------------
  |  |  589|     83|#define PNG_ITXT_COMPRESSION_NONE     1
  ------------------
 2836|       |
 2837|    186|         else
 2838|    186|            text.compression = PNG_ITXT_COMPRESSION_zTXt;
  ------------------
  |  |  590|    186|#define PNG_ITXT_COMPRESSION_zTXt     2
  ------------------
 2839|       |
 2840|    269|         text.key = (png_charp)buffer;
 2841|    269|         text.lang = (png_charp)buffer + language_offset;
 2842|    269|         text.lang_key = (png_charp)buffer + translated_keyword_offset;
 2843|    269|         text.text = (png_charp)buffer + prefix_length;
 2844|    269|         text.text_length = 0;
 2845|    269|         text.itxt_length = uncompressed_length;
 2846|       |
 2847|    269|         if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
  ------------------
  |  Branch (2847:14): [True: 0, False: 269]
  ------------------
 2848|      0|            errmsg = "insufficient memory";
 2849|    269|      }
 2850|    879|   }
 2851|       |
 2852|    433|   else
 2853|    433|      errmsg = "bad compression info";
 2854|       |
 2855|  3.22k|   if (errmsg != NULL)
  ------------------
  |  Branch (2855:8): [True: 2.90k, False: 316]
  ------------------
 2856|  2.90k|      png_chunk_benign_error(png_ptr, errmsg);
 2857|  3.22k|}
png_handle_unknown:
 2924|  1.74k|{
 2925|  1.74k|   int handled = 0; /* the chunk was handled */
 2926|       |
 2927|  1.74k|   png_debug(1, "in png_handle_unknown");
  ------------------
  |  |  145|  1.74k|#  define png_debug(l, m) ((void)0)
  ------------------
 2928|       |
 2929|  1.74k|#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
 2930|       |   /* NOTE: this code is based on the code in libpng-1.4.12 except for fixing
 2931|       |    * the bug which meant that setting a non-default behavior for a specific
 2932|       |    * chunk would be ignored (the default was always used unless a user
 2933|       |    * callback was installed).
 2934|       |    *
 2935|       |    * 'keep' is the value from the png_chunk_unknown_handling, the setting for
 2936|       |    * this specific chunk_name, if PNG_HANDLE_AS_UNKNOWN_SUPPORTED, if not it
 2937|       |    * will always be PNG_HANDLE_CHUNK_AS_DEFAULT and it needs to be set here.
 2938|       |    * This is just an optimization to avoid multiple calls to the lookup
 2939|       |    * function.
 2940|       |    */
 2941|       |#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
 2942|       |#     ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
 2943|       |   keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name);
 2944|       |#     endif
 2945|       |#  endif
 2946|       |
 2947|       |   /* One of the following methods will read the chunk or skip it (at least one
 2948|       |    * of these is always defined because this is the only way to switch on
 2949|       |    * PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
 2950|       |    */
 2951|  1.74k|#  ifdef PNG_READ_USER_CHUNKS_SUPPORTED
 2952|       |   /* The user callback takes precedence over the chunk keep value, but the
 2953|       |    * keep value is still required to validate a save of a critical chunk.
 2954|       |    */
 2955|  1.74k|   if (png_ptr->read_user_chunk_fn != NULL)
  ------------------
  |  Branch (2955:8): [True: 0, False: 1.74k]
  ------------------
 2956|      0|   {
 2957|      0|      if (png_cache_unknown_chunk(png_ptr, length) != 0)
  ------------------
  |  Branch (2957:11): [True: 0, False: 0]
  ------------------
 2958|      0|      {
 2959|       |         /* Callback to user unknown chunk handler */
 2960|      0|         int ret = (*(png_ptr->read_user_chunk_fn))(png_ptr,
 2961|      0|             &png_ptr->unknown_chunk);
 2962|       |
 2963|       |         /* ret is:
 2964|       |          * negative: An error occurred; png_chunk_error will be called.
 2965|       |          *     zero: The chunk was not handled, the chunk will be discarded
 2966|       |          *           unless png_set_keep_unknown_chunks has been used to set
 2967|       |          *           a 'keep' behavior for this particular chunk, in which
 2968|       |          *           case that will be used.  A critical chunk will cause an
 2969|       |          *           error at this point unless it is to be saved.
 2970|       |          * positive: The chunk was handled, libpng will ignore/discard it.
 2971|       |          */
 2972|      0|         if (ret < 0)
  ------------------
  |  Branch (2972:14): [True: 0, False: 0]
  ------------------
 2973|      0|            png_chunk_error(png_ptr, "error in user chunk");
 2974|       |
 2975|      0|         else if (ret == 0)
  ------------------
  |  Branch (2975:19): [True: 0, False: 0]
  ------------------
 2976|      0|         {
 2977|       |            /* If the keep value is 'default' or 'never' override it, but
 2978|       |             * still error out on critical chunks unless the keep value is
 2979|       |             * 'always'  While this is weird it is the behavior in 1.4.12.
 2980|       |             * A possible improvement would be to obey the value set for the
 2981|       |             * chunk, but this would be an API change that would probably
 2982|       |             * damage some applications.
 2983|       |             *
 2984|       |             * The png_app_warning below catches the case that matters, where
 2985|       |             * the application has not set specific save or ignore for this
 2986|       |             * chunk or global save or ignore.
 2987|       |             */
 2988|      0|            if (keep < PNG_HANDLE_CHUNK_IF_SAFE)
  ------------------
  |  | 2343|      0|#define PNG_HANDLE_CHUNK_IF_SAFE      2
  ------------------
  |  Branch (2988:17): [True: 0, False: 0]
  ------------------
 2989|      0|            {
 2990|      0|#              ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
 2991|      0|               if (png_ptr->unknown_default < PNG_HANDLE_CHUNK_IF_SAFE)
  ------------------
  |  | 2343|      0|#define PNG_HANDLE_CHUNK_IF_SAFE      2
  ------------------
  |  Branch (2991:20): [True: 0, False: 0]
  ------------------
 2992|      0|               {
 2993|      0|                  png_chunk_warning(png_ptr, "Saving unknown chunk:");
 2994|      0|                  png_app_warning(png_ptr,
 2995|      0|                      "forcing save of an unhandled chunk;"
 2996|      0|                      " please call png_set_keep_unknown_chunks");
 2997|       |                      /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
 2998|      0|               }
 2999|      0|#              endif
 3000|      0|               keep = PNG_HANDLE_CHUNK_IF_SAFE;
  ------------------
  |  | 2343|      0|#define PNG_HANDLE_CHUNK_IF_SAFE      2
  ------------------
 3001|      0|            }
 3002|      0|         }
 3003|       |
 3004|      0|         else /* chunk was handled */
 3005|      0|         {
 3006|      0|            handled = 1;
 3007|       |            /* Critical chunks can be safely discarded at this point. */
 3008|      0|            keep = PNG_HANDLE_CHUNK_NEVER;
  ------------------
  |  | 2342|      0|#define PNG_HANDLE_CHUNK_NEVER        1
  ------------------
 3009|      0|         }
 3010|      0|      }
 3011|       |
 3012|      0|      else
 3013|      0|         keep = PNG_HANDLE_CHUNK_NEVER; /* insufficient memory */
  ------------------
  |  | 2342|      0|#define PNG_HANDLE_CHUNK_NEVER        1
  ------------------
 3014|      0|   }
 3015|       |
 3016|  1.74k|   else
 3017|       |   /* Use the SAVE_UNKNOWN_CHUNKS code or skip the chunk */
 3018|  1.74k|#  endif /* READ_USER_CHUNKS */
 3019|       |
 3020|  1.74k|#  ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
 3021|  1.74k|   {
 3022|       |      /* keep is currently just the per-chunk setting, if there was no
 3023|       |       * setting change it to the global default now (not that this may
 3024|       |       * still be AS_DEFAULT) then obtain the cache of the chunk if required,
 3025|       |       * if not simply skip the chunk.
 3026|       |       */
 3027|  1.74k|      if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
  ------------------
  |  | 2341|  1.74k|#define PNG_HANDLE_CHUNK_AS_DEFAULT   0
  ------------------
  |  Branch (3027:11): [True: 1.74k, False: 0]
  ------------------
 3028|  1.74k|         keep = png_ptr->unknown_default;
 3029|       |
 3030|  1.74k|      if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
  ------------------
  |  | 2344|  3.48k|#define PNG_HANDLE_CHUNK_ALWAYS       3
  ------------------
  |  Branch (3030:11): [True: 0, False: 1.74k]
  ------------------
 3031|  1.74k|         (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
  ------------------
  |  | 2343|  3.48k|#define PNG_HANDLE_CHUNK_IF_SAFE      2
  ------------------
  |  Branch (3031:11): [True: 0, False: 1.74k]
  ------------------
 3032|  1.74k|          PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
  ------------------
  |  |  922|      0|#define PNG_CHUNK_ANCILLARY(c)   (1 & ((c) >> 29))
  |  |  ------------------
  |  |  |  Branch (922:34): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3033|      0|      {
 3034|      0|         if (png_cache_unknown_chunk(png_ptr, length) == 0)
  ------------------
  |  Branch (3034:14): [True: 0, False: 0]
  ------------------
 3035|      0|            keep = PNG_HANDLE_CHUNK_NEVER;
  ------------------
  |  | 2342|      0|#define PNG_HANDLE_CHUNK_NEVER        1
  ------------------
 3036|      0|      }
 3037|       |
 3038|  1.74k|      else
 3039|  1.74k|         png_crc_finish(png_ptr, length);
 3040|  1.74k|   }
 3041|       |#  else
 3042|       |#     ifndef PNG_READ_USER_CHUNKS_SUPPORTED
 3043|       |#        error no method to support READ_UNKNOWN_CHUNKS
 3044|       |#     endif
 3045|       |
 3046|       |   {
 3047|       |      /* If here there is no read callback pointer set and no support is
 3048|       |       * compiled in to just save the unknown chunks, so simply skip this
 3049|       |       * chunk.  If 'keep' is something other than AS_DEFAULT or NEVER then
 3050|       |       * the app has erroneously asked for unknown chunk saving when there
 3051|       |       * is no support.
 3052|       |       */
 3053|       |      if (keep > PNG_HANDLE_CHUNK_NEVER)
 3054|       |         png_app_error(png_ptr, "no unknown chunk support available");
 3055|       |
 3056|       |      png_crc_finish(png_ptr, length);
 3057|       |   }
 3058|       |#  endif
 3059|       |
 3060|  1.74k|#  ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
 3061|       |   /* Now store the chunk in the chunk list if appropriate, and if the limits
 3062|       |    * permit it.
 3063|       |    */
 3064|  1.74k|   if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
  ------------------
  |  | 2344|  3.48k|#define PNG_HANDLE_CHUNK_ALWAYS       3
  ------------------
  |  Branch (3064:8): [True: 305, False: 1.43k]
  ------------------
 3065|  1.74k|      (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
  ------------------
  |  | 2343|  2.87k|#define PNG_HANDLE_CHUNK_IF_SAFE      2
  ------------------
  |  Branch (3065:8): [True: 0, False: 1.43k]
  ------------------
 3066|  1.43k|       PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
  ------------------
  |  |  922|      0|#define PNG_CHUNK_ANCILLARY(c)   (1 & ((c) >> 29))
  |  |  ------------------
  |  |  |  Branch (922:34): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3067|      0|   {
 3068|      0|#     ifdef PNG_USER_LIMITS_SUPPORTED
 3069|      0|      switch (png_ptr->user_chunk_cache_max)
 3070|      0|      {
 3071|      0|         case 2:
  ------------------
  |  Branch (3071:10): [True: 0, False: 0]
  ------------------
 3072|      0|            png_ptr->user_chunk_cache_max = 1;
 3073|      0|            png_chunk_benign_error(png_ptr, "no space in chunk cache");
 3074|       |            /* FALLTHROUGH */
 3075|      0|         case 1:
  ------------------
  |  Branch (3075:10): [True: 0, False: 0]
  ------------------
 3076|       |            /* NOTE: prior to 1.6.0 this case resulted in an unknown critical
 3077|       |             * chunk being skipped, now there will be a hard error below.
 3078|       |             */
 3079|      0|            break;
 3080|       |
 3081|      0|         default: /* not at limit */
  ------------------
  |  Branch (3081:10): [True: 0, False: 0]
  ------------------
 3082|      0|            --(png_ptr->user_chunk_cache_max);
 3083|       |            /* FALLTHROUGH */
 3084|      0|         case 0: /* no limit */
  ------------------
  |  Branch (3084:10): [True: 0, False: 0]
  ------------------
 3085|      0|#  endif /* USER_LIMITS */
 3086|       |            /* Here when the limit isn't reached or when limits are compiled
 3087|       |             * out; store the chunk.
 3088|       |             */
 3089|      0|            png_set_unknown_chunks(png_ptr, info_ptr,
 3090|      0|                &png_ptr->unknown_chunk, 1);
 3091|      0|            handled = 1;
 3092|      0|#  ifdef PNG_USER_LIMITS_SUPPORTED
 3093|      0|            break;
 3094|      0|      }
 3095|      0|#  endif
 3096|      0|   }
 3097|       |#  else /* no store support: the chunk must be handled by the user callback */
 3098|       |   PNG_UNUSED(info_ptr)
 3099|       |#  endif
 3100|       |
 3101|       |   /* Regardless of the error handling below the cached data (if any) can be
 3102|       |    * freed now.  Notice that the data is not freed if there is a png_error, but
 3103|       |    * it will be freed by destroy_read_struct.
 3104|       |    */
 3105|  1.74k|   if (png_ptr->unknown_chunk.data != NULL)
  ------------------
  |  Branch (3105:8): [True: 0, False: 1.74k]
  ------------------
 3106|      0|      png_free(png_ptr, png_ptr->unknown_chunk.data);
 3107|  1.74k|   png_ptr->unknown_chunk.data = NULL;
 3108|       |
 3109|       |#else /* !PNG_READ_UNKNOWN_CHUNKS_SUPPORTED */
 3110|       |   /* There is no support to read an unknown chunk, so just skip it. */
 3111|       |   png_crc_finish(png_ptr, length);
 3112|       |   PNG_UNUSED(info_ptr)
 3113|       |   PNG_UNUSED(keep)
 3114|       |#endif /* !READ_UNKNOWN_CHUNKS */
 3115|       |
 3116|       |   /* Check for unhandled critical chunks */
 3117|  1.74k|   if (handled == 0 && PNG_CHUNK_CRITICAL(png_ptr->chunk_name))
  ------------------
  |  |  923|  1.43k|#define PNG_CHUNK_CRITICAL(c)     (!PNG_CHUNK_ANCILLARY(c))
  |  |  ------------------
  |  |  |  |  922|  1.43k|#define PNG_CHUNK_ANCILLARY(c)   (1 & ((c) >> 29))
  |  |  ------------------
  |  |  |  Branch (923:35): [True: 0, False: 1.43k]
  |  |  ------------------
  ------------------
  |  Branch (3117:8): [True: 1.43k, False: 305]
  ------------------
 3118|      0|      png_chunk_error(png_ptr, "unhandled critical chunk");
 3119|  1.74k|}
png_check_chunk_name:
 3135|   102k|{
 3136|   102k|   int i;
 3137|   102k|   png_uint_32 cn=chunk_name;
 3138|       |
 3139|   102k|   png_debug(1, "in png_check_chunk_name");
  ------------------
  |  |  145|   102k|#  define png_debug(l, m) ((void)0)
  ------------------
 3140|       |
 3141|   511k|   for (i=1; i<=4; ++i)
  ------------------
  |  Branch (3141:14): [True: 409k, False: 102k]
  ------------------
 3142|   409k|   {
 3143|   409k|      int c = cn & 0xff;
 3144|       |
 3145|   409k|      if (c < 65 || c > 122 || (c > 90 && c < 97))
  ------------------
  |  Branch (3145:11): [True: 106, False: 409k]
  |  Branch (3145:21): [True: 67, False: 409k]
  |  Branch (3145:33): [True: 145k, False: 263k]
  |  Branch (3145:43): [True: 9, False: 145k]
  ------------------
 3146|    182|         png_chunk_error(png_ptr, "invalid chunk type");
 3147|       |
 3148|   409k|      cn >>= 8;
 3149|   409k|   }
 3150|   102k|}
png_check_chunk_length:
 3154|   102k|{
 3155|   102k|   png_alloc_size_t limit = PNG_UINT_31_MAX;
  ------------------
  |  |  648|   102k|#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  ------------------
 3156|       |
 3157|   102k|# ifdef PNG_SET_USER_LIMITS_SUPPORTED
 3158|   102k|   if (png_ptr->user_chunk_malloc_max > 0 &&
  ------------------
  |  Branch (3158:8): [True: 102k, False: 0]
  ------------------
 3159|   102k|       png_ptr->user_chunk_malloc_max < limit)
  ------------------
  |  Branch (3159:8): [True: 102k, False: 0]
  ------------------
 3160|   102k|      limit = png_ptr->user_chunk_malloc_max;
 3161|       |# elif PNG_USER_CHUNK_MALLOC_MAX > 0
 3162|       |   if (PNG_USER_CHUNK_MALLOC_MAX < limit)
 3163|       |      limit = PNG_USER_CHUNK_MALLOC_MAX;
 3164|       |# endif
 3165|   102k|   if (png_ptr->chunk_name == png_IDAT)
  ------------------
  |  |  873|   102k|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|   102k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|   102k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|   102k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|   102k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|   102k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3165:8): [True: 3.60k, False: 98.6k]
  ------------------
 3166|  3.60k|   {
 3167|  3.60k|      png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
  ------------------
  |  |  648|  3.60k|#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  ------------------
 3168|  3.60k|      size_t row_factor =
 3169|  3.60k|         (size_t)png_ptr->width
 3170|  3.60k|         * (size_t)png_ptr->channels
 3171|  3.60k|         * (png_ptr->bit_depth > 8? 2: 1)
  ------------------
  |  Branch (3171:13): [True: 1.97k, False: 1.63k]
  ------------------
 3172|  3.60k|         + 1
 3173|  3.60k|         + (png_ptr->interlaced? 6: 0);
  ------------------
  |  Branch (3173:13): [True: 1.79k, False: 1.81k]
  ------------------
 3174|  3.60k|      if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
  ------------------
  |  |  649|  3.60k|#define PNG_UINT_32_MAX ((png_uint_32)(-1))
  ------------------
  |  Branch (3174:11): [True: 12, False: 3.59k]
  ------------------
 3175|     12|         idat_limit = PNG_UINT_31_MAX;
  ------------------
  |  |  648|     12|#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  ------------------
 3176|  3.59k|      else
 3177|  3.59k|         idat_limit = png_ptr->height * row_factor;
 3178|  3.60k|      row_factor = row_factor > 32566? 32566 : row_factor;
  ------------------
  |  Branch (3178:20): [True: 506, False: 3.09k]
  ------------------
 3179|  3.60k|      idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */
 3180|  3.60k|      idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX;
  ------------------
  |  |  648|  3.60k|#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  ------------------
                    idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX;
  ------------------
  |  |  648|  3.61k|#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  ------------------
  |  Branch (3180:18): [True: 3.59k, False: 12]
  ------------------
 3181|  3.60k|      limit = limit < idat_limit? idat_limit : limit;
  ------------------
  |  Branch (3181:15): [True: 461, False: 3.14k]
  ------------------
 3182|  3.60k|   }
 3183|       |
 3184|   102k|   if (length > limit)
  ------------------
  |  Branch (3184:8): [True: 503, False: 101k]
  ------------------
 3185|    503|   {
 3186|    503|      png_debug2(0," length = %lu, limit = %lu",
  ------------------
  |  |  151|    503|#  define png_debug2(l, m, p1, p2) ((void)0)
  ------------------
 3187|    503|         (unsigned long)length,(unsigned long)limit);
 3188|    503|      png_benign_error(png_ptr, "chunk data is too large");
 3189|    503|   }
 3190|   102k|}
png_combine_row:
 3201|   104k|{
 3202|   104k|   unsigned int pixel_depth = png_ptr->transformed_pixel_depth;
 3203|   104k|   png_const_bytep sp = png_ptr->row_buf + 1;
 3204|   104k|   png_alloc_size_t row_width = png_ptr->width;
 3205|   104k|   unsigned int pass = png_ptr->pass;
 3206|   104k|   png_bytep end_ptr = 0;
 3207|   104k|   png_byte end_byte = 0;
 3208|   104k|   unsigned int end_mask;
 3209|       |
 3210|   104k|   png_debug(1, "in png_combine_row");
  ------------------
  |  |  145|   104k|#  define png_debug(l, m) ((void)0)
  ------------------
 3211|       |
 3212|       |   /* Added in 1.5.6: it should not be possible to enter this routine until at
 3213|       |    * least one row has been read from the PNG data and transformed.
 3214|       |    */
 3215|   104k|   if (pixel_depth == 0)
  ------------------
  |  Branch (3215:8): [True: 0, False: 104k]
  ------------------
 3216|      0|      png_error(png_ptr, "internal row logic error");
 3217|       |
 3218|       |   /* Added in 1.5.4: the pixel depth should match the information returned by
 3219|       |    * any call to png_read_update_info at this point.  Do not continue if we got
 3220|       |    * this wrong.
 3221|       |    */
 3222|   104k|   if (png_ptr->info_rowbytes != 0 && png_ptr->info_rowbytes !=
  ------------------
  |  Branch (3222:8): [True: 104k, False: 0]
  |  Branch (3222:39): [True: 0, False: 104k]
  ------------------
 3223|   104k|          PNG_ROWBYTES(pixel_depth, row_width))
  ------------------
  |  |  764|   104k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 104k, False: 0]
  |  |  ------------------
  |  |  765|   104k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|   104k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
 3224|      0|      png_error(png_ptr, "internal row size calculation error");
 3225|       |
 3226|       |   /* Don't expect this to ever happen: */
 3227|   104k|   if (row_width == 0)
  ------------------
  |  Branch (3227:8): [True: 0, False: 104k]
  ------------------
 3228|      0|      png_error(png_ptr, "internal row width error");
 3229|       |
 3230|       |   /* Preserve the last byte in cases where only part of it will be overwritten,
 3231|       |    * the multiply below may overflow, we don't care because ANSI-C guarantees
 3232|       |    * we get the low bits.
 3233|       |    */
 3234|   104k|   end_mask = (pixel_depth * row_width) & 7;
 3235|   104k|   if (end_mask != 0)
  ------------------
  |  Branch (3235:8): [True: 0, False: 104k]
  ------------------
 3236|      0|   {
 3237|       |      /* end_ptr == NULL is a flag to say do nothing */
 3238|      0|      end_ptr = dp + PNG_ROWBYTES(pixel_depth, row_width) - 1;
  ------------------
  |  |  764|      0|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  765|      0|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|      0|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
 3239|      0|      end_byte = *end_ptr;
 3240|      0|#     ifdef PNG_READ_PACKSWAP_SUPPORTED
 3241|      0|      if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
  ------------------
  |  |  683|      0|#define PNG_PACKSWAP           0x10000U
  ------------------
  |  Branch (3241:11): [True: 0, False: 0]
  ------------------
 3242|       |         /* little-endian byte */
 3243|      0|         end_mask = (unsigned int)(0xff << end_mask);
 3244|       |
 3245|      0|      else /* big-endian byte */
 3246|      0|#     endif
 3247|      0|      end_mask = 0xff >> end_mask;
 3248|       |      /* end_mask is now the bits to *keep* from the destination row */
 3249|      0|   }
 3250|       |
 3251|       |   /* For non-interlaced images this reduces to a memcpy(). A memcpy()
 3252|       |    * will also happen if interlacing isn't supported or if the application
 3253|       |    * does not call png_set_interlace_handling().  In the latter cases the
 3254|       |    * caller just gets a sequence of the unexpanded rows from each interlace
 3255|       |    * pass.
 3256|       |    */
 3257|   104k|#ifdef PNG_READ_INTERLACING_SUPPORTED
 3258|   104k|   if (png_ptr->interlaced != 0 &&
  ------------------
  |  Branch (3258:8): [True: 25.6k, False: 78.7k]
  ------------------
 3259|   104k|       (png_ptr->transformations & PNG_INTERLACE) != 0 &&
  ------------------
  |  |  668|  25.6k|#define PNG_INTERLACE           0x0002U
  ------------------
  |  Branch (3259:8): [True: 25.6k, False: 0]
  ------------------
 3260|   104k|       pass < 6 && (display == 0 ||
  ------------------
  |  Branch (3260:8): [True: 23.7k, False: 1.88k]
  |  Branch (3260:21): [True: 23.7k, False: 0]
  ------------------
 3261|       |       /* The following copies everything for 'display' on passes 0, 2 and 4. */
 3262|  23.7k|       (display == 1 && (pass & 1) != 0)))
  ------------------
  |  Branch (3262:9): [True: 0, False: 0]
  |  Branch (3262:25): [True: 0, False: 0]
  ------------------
 3263|  23.7k|   {
 3264|       |      /* Narrow images may have no bits in a pass; the caller should handle
 3265|       |       * this, but this test is cheap:
 3266|       |       */
 3267|  23.7k|      if (row_width <= PNG_PASS_START_COL(pass))
  ------------------
  |  | 2440|  23.7k|#define PNG_PASS_START_COL(pass) (((1& (pass))<<(3-(((pass)+1)>>1)))&7)
  ------------------
  |  Branch (3267:11): [True: 0, False: 23.7k]
  ------------------
 3268|      0|         return;
 3269|       |
 3270|  23.7k|      if (pixel_depth < 8)
  ------------------
  |  Branch (3270:11): [True: 0, False: 23.7k]
  ------------------
 3271|      0|      {
 3272|       |         /* For pixel depths up to 4 bpp the 8-pixel mask can be expanded to fit
 3273|       |          * into 32 bits, then a single loop over the bytes using the four byte
 3274|       |          * values in the 32-bit mask can be used.  For the 'display' option the
 3275|       |          * expanded mask may also not require any masking within a byte.  To
 3276|       |          * make this work the PACKSWAP option must be taken into account - it
 3277|       |          * simply requires the pixels to be reversed in each byte.
 3278|       |          *
 3279|       |          * The 'regular' case requires a mask for each of the first 6 passes,
 3280|       |          * the 'display' case does a copy for the even passes in the range
 3281|       |          * 0..6.  This has already been handled in the test above.
 3282|       |          *
 3283|       |          * The masks are arranged as four bytes with the first byte to use in
 3284|       |          * the lowest bits (little-endian) regardless of the order (PACKSWAP or
 3285|       |          * not) of the pixels in each byte.
 3286|       |          *
 3287|       |          * NOTE: the whole of this logic depends on the caller of this function
 3288|       |          * only calling it on rows appropriate to the pass.  This function only
 3289|       |          * understands the 'x' logic; the 'y' logic is handled by the caller.
 3290|       |          *
 3291|       |          * The following defines allow generation of compile time constant bit
 3292|       |          * masks for each pixel depth and each possibility of swapped or not
 3293|       |          * swapped bytes.  Pass 'p' is in the range 0..6; 'x', a pixel index,
 3294|       |          * is in the range 0..7; and the result is 1 if the pixel is to be
 3295|       |          * copied in the pass, 0 if not.  'S' is for the sparkle method, 'B'
 3296|       |          * for the block method.
 3297|       |          *
 3298|       |          * With some compilers a compile time expression of the general form:
 3299|       |          *
 3300|       |          *    (shift >= 32) ? (a >> (shift-32)) : (b >> shift)
 3301|       |          *
 3302|       |          * Produces warnings with values of 'shift' in the range 33 to 63
 3303|       |          * because the right hand side of the ?: expression is evaluated by
 3304|       |          * the compiler even though it isn't used.  Microsoft Visual C (various
 3305|       |          * versions) and the Intel C compiler are known to do this.  To avoid
 3306|       |          * this the following macros are used in 1.5.6.  This is a temporary
 3307|       |          * solution to avoid destabilizing the code during the release process.
 3308|       |          */
 3309|      0|#        if PNG_USE_COMPILE_TIME_MASKS
 3310|      0|#           define PNG_LSR(x,s) ((x)>>((s) & 0x1f))
 3311|      0|#           define PNG_LSL(x,s) ((x)<<((s) & 0x1f))
 3312|       |#        else
 3313|       |#           define PNG_LSR(x,s) ((x)>>(s))
 3314|       |#           define PNG_LSL(x,s) ((x)<<(s))
 3315|       |#        endif
 3316|      0|#        define S_COPY(p,x) (((p)<4 ? PNG_LSR(0x80088822,(3-(p))*8+(7-(x))) :\
 3317|      0|           PNG_LSR(0xaa55ff00,(7-(p))*8+(7-(x)))) & 1)
 3318|      0|#        define B_COPY(p,x) (((p)<4 ? PNG_LSR(0xff0fff33,(3-(p))*8+(7-(x))) :\
 3319|      0|           PNG_LSR(0xff55ff00,(7-(p))*8+(7-(x)))) & 1)
 3320|       |
 3321|       |         /* Return a mask for pass 'p' pixel 'x' at depth 'd'.  The mask is
 3322|       |          * little endian - the first pixel is at bit 0 - however the extra
 3323|       |          * parameter 's' can be set to cause the mask position to be swapped
 3324|       |          * within each byte, to match the PNG format.  This is done by XOR of
 3325|       |          * the shift with 7, 6 or 4 for bit depths 1, 2 and 4.
 3326|       |          */
 3327|      0|#        define PIXEL_MASK(p,x,d,s) \
 3328|      0|            (PNG_LSL(((PNG_LSL(1U,(d)))-1),(((x)*(d))^((s)?8-(d):0))))
 3329|       |
 3330|       |         /* Hence generate the appropriate 'block' or 'sparkle' pixel copy mask.
 3331|       |          */
 3332|      0|#        define S_MASKx(p,x,d,s) (S_COPY(p,x)?PIXEL_MASK(p,x,d,s):0)
 3333|      0|#        define B_MASKx(p,x,d,s) (B_COPY(p,x)?PIXEL_MASK(p,x,d,s):0)
 3334|       |
 3335|       |         /* Combine 8 of these to get the full mask.  For the 1-bpp and 2-bpp
 3336|       |          * cases the result needs replicating, for the 4-bpp case the above
 3337|       |          * generates a full 32 bits.
 3338|       |          */
 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
 3340|       |
 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
 3344|       |
 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
 3348|       |
 3349|      0|#if PNG_USE_COMPILE_TIME_MASKS
 3350|       |         /* Utility macros to construct all the masks for a depth/swap
 3351|       |          * combination.  The 's' parameter says whether the format is PNG
 3352|       |          * (big endian bytes) or not.  Only the three odd-numbered passes are
 3353|       |          * required for the display/block algorithm.
 3354|       |          */
 3355|      0|#        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
 3356|      0|            S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
 3357|       |
 3358|      0|#        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
 3359|       |
 3360|      0|#        define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
 3361|       |
 3362|       |         /* Hence the pre-compiled masks indexed by PACKSWAP (or not), depth and
 3363|       |          * then pass:
 3364|       |          */
 3365|      0|         static const png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] =
 3366|      0|         {
 3367|       |            /* Little-endian byte masks for PACKSWAP */
 3368|      0|            { S_MASKS(1,0), S_MASKS(2,0), S_MASKS(4,0) },
  ------------------
  |  | 3355|      0|#        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  | 3356|      0|            S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
                          { S_MASKS(1,0), S_MASKS(2,0), S_MASKS(4,0) },
  ------------------
  |  | 3355|      0|#        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  | 3356|      0|            S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
                          { S_MASKS(1,0), S_MASKS(2,0), S_MASKS(4,0) },
  ------------------
  |  | 3355|      0|#        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  | 3356|      0|            S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
 3369|       |            /* Normal (big-endian byte) masks - PNG format */
 3370|      0|            { S_MASKS(1,1), S_MASKS(2,1), S_MASKS(4,1) }
  ------------------
  |  | 3355|      0|#        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  | 3356|      0|            S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
                          { S_MASKS(1,1), S_MASKS(2,1), S_MASKS(4,1) }
  ------------------
  |  | 3355|      0|#        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  | 3356|      0|            S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
                          { S_MASKS(1,1), S_MASKS(2,1), S_MASKS(4,1) }
  ------------------
  |  | 3355|      0|#        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  | 3356|      0|            S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |                           S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3341|      0|#        define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3342|      0|            S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
  |  |  |  | 3343|      0|            S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
 3371|      0|         };
 3372|       |
 3373|       |         /* display_mask has only three entries for the odd passes, so index by
 3374|       |          * pass>>1.
 3375|       |          */
 3376|      0|         static const png_uint_32 display_mask[2][3][3] =
 3377|      0|         {
 3378|       |            /* Little-endian byte masks for PACKSWAP */
 3379|      0|            { B_MASKS(1,0), B_MASKS(2,0), B_MASKS(4,0) },
  ------------------
  |  | 3358|      0|#        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
                          { B_MASKS(1,0), B_MASKS(2,0), B_MASKS(4,0) },
  ------------------
  |  | 3358|      0|#        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
                          { B_MASKS(1,0), B_MASKS(2,0), B_MASKS(4,0) },
  ------------------
  |  | 3358|      0|#        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
 3380|       |            /* Normal (big-endian byte) masks - PNG format */
 3381|      0|            { B_MASKS(1,1), B_MASKS(2,1), B_MASKS(4,1) }
  ------------------
  |  | 3358|      0|#        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
                          { B_MASKS(1,1), B_MASKS(2,1), B_MASKS(4,1) }
  ------------------
  |  | 3358|      0|#        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
                          { B_MASKS(1,1), B_MASKS(2,1), B_MASKS(4,1) }
  ------------------
  |  | 3358|      0|#        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  |  |               #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
  |  |  ------------------
  |  |  |  | 3345|      0|#        define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
  |  |  |  |  ------------------
  |  |  |  |  |  | 3339|      0|#        define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:36): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:40): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (3339:59): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 3346|      0|            B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
  |  |  |  | 3347|      0|            B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
  |  |  ------------------
  ------------------
 3382|      0|         };
 3383|       |
 3384|      0|#        define MASK(pass,depth,display,png)\
 3385|      0|            ((display)?display_mask[png][DEPTH_INDEX(depth)][pass>>1]:\
 3386|      0|               row_mask[png][DEPTH_INDEX(depth)][pass])
 3387|       |
 3388|       |#else /* !PNG_USE_COMPILE_TIME_MASKS */
 3389|       |         /* This is the runtime alternative: it seems unlikely that this will
 3390|       |          * ever be either smaller or faster than the compile time approach.
 3391|       |          */
 3392|       |#        define MASK(pass,depth,display,png)\
 3393|       |            ((display)?B_MASK(pass,depth,png):S_MASK(pass,depth,png))
 3394|       |#endif /* !USE_COMPILE_TIME_MASKS */
 3395|       |
 3396|       |         /* Use the appropriate mask to copy the required bits.  In some cases
 3397|       |          * the byte mask will be 0 or 0xff; optimize these cases.  row_width is
 3398|       |          * the number of pixels, but the code copies bytes, so it is necessary
 3399|       |          * to special case the end.
 3400|       |          */
 3401|      0|         png_uint_32 pixels_per_byte = 8 / pixel_depth;
 3402|      0|         png_uint_32 mask;
 3403|       |
 3404|      0|#        ifdef PNG_READ_PACKSWAP_SUPPORTED
 3405|      0|         if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
  ------------------
  |  |  683|      0|#define PNG_PACKSWAP           0x10000U
  ------------------
  |  Branch (3405:14): [True: 0, False: 0]
  ------------------
 3406|      0|            mask = MASK(pass, pixel_depth, display, 0);
  ------------------
  |  | 3385|      0|            ((display)?display_mask[png][DEPTH_INDEX(depth)][pass>>1]:\
  |  |  ------------------
  |  |  |  | 3360|      0|#        define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (3360:33): [True: 0, False: 0]
  |  |  |  |  |  Branch (3360:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (3385:14): [True: 0, False: 0]
  |  |  ------------------
  |  | 3386|      0|               row_mask[png][DEPTH_INDEX(depth)][pass])
  |  |  ------------------
  |  |  |  | 3360|      0|#        define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (3360:33): [True: 0, False: 0]
  |  |  |  |  |  Branch (3360:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3407|       |
 3408|      0|         else
 3409|      0|#        endif
 3410|      0|         mask = MASK(pass, pixel_depth, display, 1);
  ------------------
  |  | 3385|      0|            ((display)?display_mask[png][DEPTH_INDEX(depth)][pass>>1]:\
  |  |  ------------------
  |  |  |  | 3360|      0|#        define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (3360:33): [True: 0, False: 0]
  |  |  |  |  |  Branch (3360:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (3385:14): [True: 0, False: 0]
  |  |  ------------------
  |  | 3386|      0|               row_mask[png][DEPTH_INDEX(depth)][pass])
  |  |  ------------------
  |  |  |  | 3360|      0|#        define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (3360:33): [True: 0, False: 0]
  |  |  |  |  |  Branch (3360:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3411|       |
 3412|      0|         for (;;)
 3413|      0|         {
 3414|      0|            png_uint_32 m;
 3415|       |
 3416|       |            /* It doesn't matter in the following if png_uint_32 has more than
 3417|       |             * 32 bits because the high bits always match those in m<<24; it is,
 3418|       |             * however, essential to use OR here, not +, because of this.
 3419|       |             */
 3420|      0|            m = mask;
 3421|      0|            mask = (m >> 8) | (m << 24); /* rotate right to good compilers */
 3422|      0|            m &= 0xff;
 3423|       |
 3424|      0|            if (m != 0) /* something to copy */
  ------------------
  |  Branch (3424:17): [True: 0, False: 0]
  ------------------
 3425|      0|            {
 3426|      0|               if (m != 0xff)
  ------------------
  |  Branch (3426:20): [True: 0, False: 0]
  ------------------
 3427|      0|                  *dp = (png_byte)((*dp & ~m) | (*sp & m));
 3428|      0|               else
 3429|      0|                  *dp = *sp;
 3430|      0|            }
 3431|       |
 3432|       |            /* NOTE: this may overwrite the last byte with garbage if the image
 3433|       |             * is not an exact number of bytes wide; libpng has always done
 3434|       |             * this.
 3435|       |             */
 3436|      0|            if (row_width <= pixels_per_byte)
  ------------------
  |  Branch (3436:17): [True: 0, False: 0]
  ------------------
 3437|      0|               break; /* May need to restore part of the last byte */
 3438|       |
 3439|      0|            row_width -= pixels_per_byte;
 3440|      0|            ++dp;
 3441|      0|            ++sp;
 3442|      0|         }
 3443|      0|      }
 3444|       |
 3445|  23.7k|      else /* pixel_depth >= 8 */
 3446|  23.7k|      {
 3447|  23.7k|         unsigned int bytes_to_copy, bytes_to_jump;
 3448|       |
 3449|       |         /* Validate the depth - it must be a multiple of 8 */
 3450|  23.7k|         if (pixel_depth & 7)
  ------------------
  |  Branch (3450:14): [True: 0, False: 23.7k]
  ------------------
 3451|      0|            png_error(png_ptr, "invalid user transform pixel depth");
 3452|       |
 3453|  23.7k|         pixel_depth >>= 3; /* now in bytes */
 3454|  23.7k|         row_width *= pixel_depth;
 3455|       |
 3456|       |         /* Regardless of pass number the Adam 7 interlace always results in a
 3457|       |          * fixed number of pixels to copy then to skip.  There may be a
 3458|       |          * different number of pixels to skip at the start though.
 3459|       |          */
 3460|  23.7k|         {
 3461|  23.7k|            unsigned int offset = PNG_PASS_START_COL(pass) * pixel_depth;
  ------------------
  |  | 2440|  23.7k|#define PNG_PASS_START_COL(pass) (((1& (pass))<<(3-(((pass)+1)>>1)))&7)
  ------------------
 3462|       |
 3463|  23.7k|            row_width -= offset;
 3464|  23.7k|            dp += offset;
 3465|  23.7k|            sp += offset;
 3466|  23.7k|         }
 3467|       |
 3468|       |         /* Work out the bytes to copy. */
 3469|  23.7k|         if (display != 0)
  ------------------
  |  Branch (3469:14): [True: 0, False: 23.7k]
  ------------------
 3470|      0|         {
 3471|       |            /* When doing the 'block' algorithm the pixel in the pass gets
 3472|       |             * replicated to adjacent pixels.  This is why the even (0,2,4,6)
 3473|       |             * passes are skipped above - the entire expanded row is copied.
 3474|       |             */
 3475|      0|            bytes_to_copy = (1<<((6-pass)>>1)) * pixel_depth;
 3476|       |
 3477|       |            /* But don't allow this number to exceed the actual row width. */
 3478|      0|            if (bytes_to_copy > row_width)
  ------------------
  |  Branch (3478:17): [True: 0, False: 0]
  ------------------
 3479|      0|               bytes_to_copy = (unsigned int)/*SAFE*/row_width;
 3480|      0|         }
 3481|       |
 3482|  23.7k|         else /* normal row; Adam7 only ever gives us one pixel to copy. */
 3483|  23.7k|            bytes_to_copy = pixel_depth;
 3484|       |
 3485|       |         /* In Adam7 there is a constant offset between where the pixels go. */
 3486|  23.7k|         bytes_to_jump = PNG_PASS_COL_OFFSET(pass) * pixel_depth;
  ------------------
  |  | 2448|  23.7k|#define PNG_PASS_COL_OFFSET(pass) (1<<((7-(pass))>>1))
  ------------------
 3487|       |
 3488|       |         /* And simply copy these bytes.  Some optimization is possible here,
 3489|       |          * depending on the value of 'bytes_to_copy'.  Special case the low
 3490|       |          * byte counts, which we know to be frequent.
 3491|       |          *
 3492|       |          * Notice that these cases all 'return' rather than 'break' - this
 3493|       |          * avoids an unnecessary test on whether to restore the last byte
 3494|       |          * below.
 3495|       |          */
 3496|  23.7k|         switch (bytes_to_copy)
 3497|  23.7k|         {
 3498|      0|            case 1:
  ------------------
  |  Branch (3498:13): [True: 0, False: 23.7k]
  ------------------
 3499|      0|               for (;;)
 3500|      0|               {
 3501|      0|                  *dp = *sp;
 3502|       |
 3503|      0|                  if (row_width <= bytes_to_jump)
  ------------------
  |  Branch (3503:23): [True: 0, False: 0]
  ------------------
 3504|      0|                     return;
 3505|       |
 3506|      0|                  dp += bytes_to_jump;
 3507|      0|                  sp += bytes_to_jump;
 3508|      0|                  row_width -= bytes_to_jump;
 3509|      0|               }
 3510|       |
 3511|      0|            case 2:
  ------------------
  |  Branch (3511:13): [True: 0, False: 23.7k]
  ------------------
 3512|       |               /* There is a possibility of a partial copy at the end here; this
 3513|       |                * slows the code down somewhat.
 3514|       |                */
 3515|      0|               do
 3516|      0|               {
 3517|      0|                  dp[0] = sp[0]; dp[1] = sp[1];
 3518|       |
 3519|      0|                  if (row_width <= bytes_to_jump)
  ------------------
  |  Branch (3519:23): [True: 0, False: 0]
  ------------------
 3520|      0|                     return;
 3521|       |
 3522|      0|                  sp += bytes_to_jump;
 3523|      0|                  dp += bytes_to_jump;
 3524|      0|                  row_width -= bytes_to_jump;
 3525|      0|               }
 3526|      0|               while (row_width > 1);
  ------------------
  |  Branch (3526:23): [True: 0, False: 0]
  ------------------
 3527|       |
 3528|       |               /* And there can only be one byte left at this point: */
 3529|      0|               *dp = *sp;
 3530|      0|               return;
 3531|       |
 3532|      0|            case 3:
  ------------------
  |  Branch (3532:13): [True: 0, False: 23.7k]
  ------------------
 3533|       |               /* This can only be the RGB case, so each copy is exactly one
 3534|       |                * pixel and it is not necessary to check for a partial copy.
 3535|       |                */
 3536|      0|               for (;;)
 3537|      0|               {
 3538|      0|                  dp[0] = sp[0]; dp[1] = sp[1]; dp[2] = sp[2];
 3539|       |
 3540|      0|                  if (row_width <= bytes_to_jump)
  ------------------
  |  Branch (3540:23): [True: 0, False: 0]
  ------------------
 3541|      0|                     return;
 3542|       |
 3543|      0|                  sp += bytes_to_jump;
 3544|      0|                  dp += bytes_to_jump;
 3545|      0|                  row_width -= bytes_to_jump;
 3546|      0|               }
 3547|       |
 3548|  23.7k|            default:
  ------------------
  |  Branch (3548:13): [True: 23.7k, False: 0]
  ------------------
 3549|  23.7k|#if PNG_ALIGN_TYPE != PNG_ALIGN_NONE
 3550|       |               /* Check for double byte alignment and, if possible, use a
 3551|       |                * 16-bit copy.  Don't attempt this for narrow images - ones that
 3552|       |                * are less than an interlace panel wide.  Don't attempt it for
 3553|       |                * wide bytes_to_copy either - use the memcpy there.
 3554|       |                */
 3555|  23.7k|               if (bytes_to_copy < 16 /*else use memcpy*/ &&
  ------------------
  |  Branch (3555:20): [True: 23.7k, False: 0]
  ------------------
 3556|  23.7k|                   png_isaligned(dp, png_uint_16) &&
  ------------------
  |  |  632|  47.5k|   (((type)(size_t)((const void*)(ptr)) & (type)(png_alignof(type)-1)) == 0)
  |  |  ------------------
  |  |  |  |  617|  23.7k|#  define png_alignof(type) (sizeof(type))
  |  |  ------------------
  |  |  |  Branch (632:4): [True: 23.7k, False: 0]
  |  |  ------------------
  ------------------
 3557|  23.7k|                   png_isaligned(sp, png_uint_16) &&
  ------------------
  |  |  632|  47.5k|   (((type)(size_t)((const void*)(ptr)) & (type)(png_alignof(type)-1)) == 0)
  |  |  ------------------
  |  |  |  |  617|  23.7k|#  define png_alignof(type) (sizeof(type))
  |  |  ------------------
  |  |  |  Branch (632:4): [True: 23.7k, False: 0]
  |  |  ------------------
  ------------------
 3558|  23.7k|                   bytes_to_copy % (sizeof (png_uint_16)) == 0 &&
  ------------------
  |  Branch (3558:20): [True: 23.7k, False: 0]
  ------------------
 3559|  23.7k|                   bytes_to_jump % (sizeof (png_uint_16)) == 0)
  ------------------
  |  Branch (3559:20): [True: 23.7k, False: 0]
  ------------------
 3560|  23.7k|               {
 3561|       |                  /* Everything is aligned for png_uint_16 copies, but try for
 3562|       |                   * png_uint_32 first.
 3563|       |                   */
 3564|  23.7k|                  if (png_isaligned(dp, png_uint_32) &&
  ------------------
  |  |  632|  47.5k|   (((type)(size_t)((const void*)(ptr)) & (type)(png_alignof(type)-1)) == 0)
  |  |  ------------------
  |  |  |  |  617|  23.7k|#  define png_alignof(type) (sizeof(type))
  |  |  ------------------
  |  |  |  Branch (632:4): [True: 23.7k, False: 0]
  |  |  ------------------
  ------------------
 3565|  23.7k|                      png_isaligned(sp, png_uint_32) &&
  ------------------
  |  |  632|  47.5k|   (((type)(size_t)((const void*)(ptr)) & (type)(png_alignof(type)-1)) == 0)
  |  |  ------------------
  |  |  |  |  617|  23.7k|#  define png_alignof(type) (sizeof(type))
  |  |  ------------------
  |  |  |  Branch (632:4): [True: 23.7k, False: 0]
  |  |  ------------------
  ------------------
 3566|  23.7k|                      bytes_to_copy % (sizeof (png_uint_32)) == 0 &&
  ------------------
  |  Branch (3566:23): [True: 23.7k, False: 0]
  ------------------
 3567|  23.7k|                      bytes_to_jump % (sizeof (png_uint_32)) == 0)
  ------------------
  |  Branch (3567:23): [True: 23.7k, False: 0]
  ------------------
 3568|  23.7k|                  {
 3569|  23.7k|                     png_uint_32p dp32 = png_aligncast(png_uint_32p,dp);
  ------------------
  |  |  546|  23.7k|#  define png_aligncast(type, value) ((void*)(value))
  ------------------
 3570|  23.7k|                     png_const_uint_32p sp32 = png_aligncastconst(
  ------------------
  |  |  547|  23.7k|#  define png_aligncastconst(type, value) ((const void*)(value))
  ------------------
 3571|  23.7k|                         png_const_uint_32p, sp);
 3572|  23.7k|                     size_t skip = (bytes_to_jump-bytes_to_copy) /
 3573|  23.7k|                         (sizeof (png_uint_32));
 3574|       |
 3575|  23.7k|                     do
 3576|  4.15M|                     {
 3577|  4.15M|                        size_t c = bytes_to_copy;
 3578|  4.15M|                        do
 3579|  4.19M|                        {
 3580|  4.19M|                           *dp32++ = *sp32++;
 3581|  4.19M|                           c -= (sizeof (png_uint_32));
 3582|  4.19M|                        }
 3583|  4.19M|                        while (c > 0);
  ------------------
  |  Branch (3583:32): [True: 38.8k, False: 4.15M]
  ------------------
 3584|       |
 3585|  4.15M|                        if (row_width <= bytes_to_jump)
  ------------------
  |  Branch (3585:29): [True: 23.7k, False: 4.13M]
  ------------------
 3586|  23.7k|                           return;
 3587|       |
 3588|  4.13M|                        dp32 += skip;
 3589|  4.13M|                        sp32 += skip;
 3590|  4.13M|                        row_width -= bytes_to_jump;
 3591|  4.13M|                     }
 3592|  4.13M|                     while (bytes_to_copy <= row_width);
  ------------------
  |  Branch (3592:29): [True: 4.13M, False: 0]
  ------------------
 3593|       |
 3594|       |                     /* Get to here when the row_width truncates the final copy.
 3595|       |                      * There will be 1-3 bytes left to copy, so don't try the
 3596|       |                      * 16-bit loop below.
 3597|       |                      */
 3598|      0|                     dp = (png_bytep)dp32;
 3599|      0|                     sp = (png_const_bytep)sp32;
 3600|      0|                     do
 3601|      0|                        *dp++ = *sp++;
 3602|      0|                     while (--row_width > 0);
  ------------------
  |  Branch (3602:29): [True: 0, False: 0]
  ------------------
 3603|      0|                     return;
 3604|  23.7k|                  }
 3605|       |
 3606|       |                  /* Else do it in 16-bit quantities, but only if the size is
 3607|       |                   * not too large.
 3608|       |                   */
 3609|      0|                  else
 3610|      0|                  {
 3611|      0|                     png_uint_16p dp16 = png_aligncast(png_uint_16p, dp);
  ------------------
  |  |  546|      0|#  define png_aligncast(type, value) ((void*)(value))
  ------------------
 3612|      0|                     png_const_uint_16p sp16 = png_aligncastconst(
  ------------------
  |  |  547|      0|#  define png_aligncastconst(type, value) ((const void*)(value))
  ------------------
 3613|      0|                        png_const_uint_16p, sp);
 3614|      0|                     size_t skip = (bytes_to_jump-bytes_to_copy) /
 3615|      0|                        (sizeof (png_uint_16));
 3616|       |
 3617|      0|                     do
 3618|      0|                     {
 3619|      0|                        size_t c = bytes_to_copy;
 3620|      0|                        do
 3621|      0|                        {
 3622|      0|                           *dp16++ = *sp16++;
 3623|      0|                           c -= (sizeof (png_uint_16));
 3624|      0|                        }
 3625|      0|                        while (c > 0);
  ------------------
  |  Branch (3625:32): [True: 0, False: 0]
  ------------------
 3626|       |
 3627|      0|                        if (row_width <= bytes_to_jump)
  ------------------
  |  Branch (3627:29): [True: 0, False: 0]
  ------------------
 3628|      0|                           return;
 3629|       |
 3630|      0|                        dp16 += skip;
 3631|      0|                        sp16 += skip;
 3632|      0|                        row_width -= bytes_to_jump;
 3633|      0|                     }
 3634|      0|                     while (bytes_to_copy <= row_width);
  ------------------
  |  Branch (3634:29): [True: 0, False: 0]
  ------------------
 3635|       |
 3636|       |                     /* End of row - 1 byte left, bytes_to_copy > row_width: */
 3637|      0|                     dp = (png_bytep)dp16;
 3638|      0|                     sp = (png_const_bytep)sp16;
 3639|      0|                     do
 3640|      0|                        *dp++ = *sp++;
 3641|      0|                     while (--row_width > 0);
  ------------------
  |  Branch (3641:29): [True: 0, False: 0]
  ------------------
 3642|      0|                     return;
 3643|      0|                  }
 3644|  23.7k|               }
 3645|      0|#endif /* ALIGN_TYPE code */
 3646|       |
 3647|       |               /* The true default - use a memcpy: */
 3648|      0|               for (;;)
 3649|      0|               {
 3650|      0|                  memcpy(dp, sp, bytes_to_copy);
 3651|       |
 3652|      0|                  if (row_width <= bytes_to_jump)
  ------------------
  |  Branch (3652:23): [True: 0, False: 0]
  ------------------
 3653|      0|                     return;
 3654|       |
 3655|      0|                  sp += bytes_to_jump;
 3656|      0|                  dp += bytes_to_jump;
 3657|      0|                  row_width -= bytes_to_jump;
 3658|      0|                  if (bytes_to_copy > row_width)
  ------------------
  |  Branch (3658:23): [True: 0, False: 0]
  ------------------
 3659|      0|                     bytes_to_copy = (unsigned int)/*SAFE*/row_width;
 3660|      0|               }
 3661|  23.7k|         }
 3662|       |
 3663|       |         /* NOT REACHED*/
 3664|  23.7k|      } /* pixel_depth >= 8 */
 3665|       |
 3666|       |      /* Here if pixel_depth < 8 to check 'end_ptr' below. */
 3667|  23.7k|   }
 3668|  80.6k|   else
 3669|  80.6k|#endif /* READ_INTERLACING */
 3670|       |
 3671|       |   /* If here then the switch above wasn't used so just memcpy the whole row
 3672|       |    * from the temporary row buffer (notice that this overwrites the end of the
 3673|       |    * destination row if it is a partial byte.)
 3674|       |    */
 3675|  80.6k|   memcpy(dp, sp, PNG_ROWBYTES(pixel_depth, row_width));
  ------------------
  |  |  764|  80.6k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 80.6k, False: 0]
  |  |  ------------------
  |  |  765|  80.6k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|  80.6k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
 3676|       |
 3677|       |   /* Restore the overwritten bits from the last byte if necessary. */
 3678|  80.6k|   if (end_ptr != NULL)
  ------------------
  |  Branch (3678:8): [True: 0, False: 80.6k]
  ------------------
 3679|      0|      *end_ptr = (png_byte)((end_byte & end_mask) | (*end_ptr & ~end_mask));
 3680|  80.6k|}
png_do_read_interlace:
 3686|  23.7k|{
 3687|       |   /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
 3688|       |   /* Offset to next interlace block */
 3689|  23.7k|   static const unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
 3690|       |
 3691|  23.7k|   png_debug(1, "in png_do_read_interlace");
  ------------------
  |  |  145|  23.7k|#  define png_debug(l, m) ((void)0)
  ------------------
 3692|  23.7k|   if (row != NULL && row_info != NULL)
  ------------------
  |  Branch (3692:8): [True: 23.7k, False: 0]
  |  Branch (3692:23): [True: 23.7k, False: 0]
  ------------------
 3693|  23.7k|   {
 3694|  23.7k|      png_uint_32 final_width;
 3695|       |
 3696|  23.7k|      final_width = row_info->width * png_pass_inc[pass];
 3697|       |
 3698|  23.7k|      switch (row_info->pixel_depth)
 3699|  23.7k|      {
 3700|      0|         case 1:
  ------------------
  |  Branch (3700:10): [True: 0, False: 23.7k]
  ------------------
 3701|      0|         {
 3702|      0|            png_bytep sp = row + (size_t)((row_info->width - 1) >> 3);
 3703|      0|            png_bytep dp = row + (size_t)((final_width - 1) >> 3);
 3704|      0|            unsigned int sshift, dshift;
 3705|      0|            unsigned int s_start, s_end;
 3706|      0|            int s_inc;
 3707|      0|            int jstop = (int)png_pass_inc[pass];
 3708|      0|            png_byte v;
 3709|      0|            png_uint_32 i;
 3710|      0|            int j;
 3711|       |
 3712|      0|#ifdef PNG_READ_PACKSWAP_SUPPORTED
 3713|      0|            if ((transformations & PNG_PACKSWAP) != 0)
  ------------------
  |  |  683|      0|#define PNG_PACKSWAP           0x10000U
  ------------------
  |  Branch (3713:17): [True: 0, False: 0]
  ------------------
 3714|      0|            {
 3715|      0|                sshift = ((row_info->width + 7) & 0x07);
 3716|      0|                dshift = ((final_width + 7) & 0x07);
 3717|      0|                s_start = 7;
 3718|      0|                s_end = 0;
 3719|      0|                s_inc = -1;
 3720|      0|            }
 3721|       |
 3722|      0|            else
 3723|      0|#endif
 3724|      0|            {
 3725|      0|                sshift = 7 - ((row_info->width + 7) & 0x07);
 3726|      0|                dshift = 7 - ((final_width + 7) & 0x07);
 3727|      0|                s_start = 0;
 3728|      0|                s_end = 7;
 3729|      0|                s_inc = 1;
 3730|      0|            }
 3731|       |
 3732|      0|            for (i = 0; i < row_info->width; i++)
  ------------------
  |  Branch (3732:25): [True: 0, False: 0]
  ------------------
 3733|      0|            {
 3734|      0|               v = (png_byte)((*sp >> sshift) & 0x01);
 3735|      0|               for (j = 0; j < jstop; j++)
  ------------------
  |  Branch (3735:28): [True: 0, False: 0]
  ------------------
 3736|      0|               {
 3737|      0|                  unsigned int tmp = *dp & (0x7f7f >> (7 - dshift));
 3738|      0|                  tmp |= (unsigned int)(v << dshift);
 3739|      0|                  *dp = (png_byte)(tmp & 0xff);
 3740|       |
 3741|      0|                  if (dshift == s_end)
  ------------------
  |  Branch (3741:23): [True: 0, False: 0]
  ------------------
 3742|      0|                  {
 3743|      0|                     dshift = s_start;
 3744|      0|                     dp--;
 3745|      0|                  }
 3746|       |
 3747|      0|                  else
 3748|      0|                     dshift = (unsigned int)((int)dshift + s_inc);
 3749|      0|               }
 3750|       |
 3751|      0|               if (sshift == s_end)
  ------------------
  |  Branch (3751:20): [True: 0, False: 0]
  ------------------
 3752|      0|               {
 3753|      0|                  sshift = s_start;
 3754|      0|                  sp--;
 3755|      0|               }
 3756|       |
 3757|      0|               else
 3758|      0|                  sshift = (unsigned int)((int)sshift + s_inc);
 3759|      0|            }
 3760|      0|            break;
 3761|      0|         }
 3762|       |
 3763|      0|         case 2:
  ------------------
  |  Branch (3763:10): [True: 0, False: 23.7k]
  ------------------
 3764|      0|         {
 3765|      0|            png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2);
 3766|      0|            png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2);
 3767|      0|            unsigned int sshift, dshift;
 3768|      0|            unsigned int s_start, s_end;
 3769|      0|            int s_inc;
 3770|      0|            int jstop = (int)png_pass_inc[pass];
 3771|      0|            png_uint_32 i;
 3772|       |
 3773|      0|#ifdef PNG_READ_PACKSWAP_SUPPORTED
 3774|      0|            if ((transformations & PNG_PACKSWAP) != 0)
  ------------------
  |  |  683|      0|#define PNG_PACKSWAP           0x10000U
  ------------------
  |  Branch (3774:17): [True: 0, False: 0]
  ------------------
 3775|      0|            {
 3776|      0|               sshift = (((row_info->width + 3) & 0x03) << 1);
 3777|      0|               dshift = (((final_width + 3) & 0x03) << 1);
 3778|      0|               s_start = 6;
 3779|      0|               s_end = 0;
 3780|      0|               s_inc = -2;
 3781|      0|            }
 3782|       |
 3783|      0|            else
 3784|      0|#endif
 3785|      0|            {
 3786|      0|               sshift = ((3 - ((row_info->width + 3) & 0x03)) << 1);
 3787|      0|               dshift = ((3 - ((final_width + 3) & 0x03)) << 1);
 3788|      0|               s_start = 0;
 3789|      0|               s_end = 6;
 3790|      0|               s_inc = 2;
 3791|      0|            }
 3792|       |
 3793|      0|            for (i = 0; i < row_info->width; i++)
  ------------------
  |  Branch (3793:25): [True: 0, False: 0]
  ------------------
 3794|      0|            {
 3795|      0|               png_byte v;
 3796|      0|               int j;
 3797|       |
 3798|      0|               v = (png_byte)((*sp >> sshift) & 0x03);
 3799|      0|               for (j = 0; j < jstop; j++)
  ------------------
  |  Branch (3799:28): [True: 0, False: 0]
  ------------------
 3800|      0|               {
 3801|      0|                  unsigned int tmp = *dp & (0x3f3f >> (6 - dshift));
 3802|      0|                  tmp |= (unsigned int)(v << dshift);
 3803|      0|                  *dp = (png_byte)(tmp & 0xff);
 3804|       |
 3805|      0|                  if (dshift == s_end)
  ------------------
  |  Branch (3805:23): [True: 0, False: 0]
  ------------------
 3806|      0|                  {
 3807|      0|                     dshift = s_start;
 3808|      0|                     dp--;
 3809|      0|                  }
 3810|       |
 3811|      0|                  else
 3812|      0|                     dshift = (unsigned int)((int)dshift + s_inc);
 3813|      0|               }
 3814|       |
 3815|      0|               if (sshift == s_end)
  ------------------
  |  Branch (3815:20): [True: 0, False: 0]
  ------------------
 3816|      0|               {
 3817|      0|                  sshift = s_start;
 3818|      0|                  sp--;
 3819|      0|               }
 3820|       |
 3821|      0|               else
 3822|      0|                  sshift = (unsigned int)((int)sshift + s_inc);
 3823|      0|            }
 3824|      0|            break;
 3825|      0|         }
 3826|       |
 3827|      0|         case 4:
  ------------------
  |  Branch (3827:10): [True: 0, False: 23.7k]
  ------------------
 3828|      0|         {
 3829|      0|            png_bytep sp = row + (size_t)((row_info->width - 1) >> 1);
 3830|      0|            png_bytep dp = row + (size_t)((final_width - 1) >> 1);
 3831|      0|            unsigned int sshift, dshift;
 3832|      0|            unsigned int s_start, s_end;
 3833|      0|            int s_inc;
 3834|      0|            png_uint_32 i;
 3835|      0|            int jstop = (int)png_pass_inc[pass];
 3836|       |
 3837|      0|#ifdef PNG_READ_PACKSWAP_SUPPORTED
 3838|      0|            if ((transformations & PNG_PACKSWAP) != 0)
  ------------------
  |  |  683|      0|#define PNG_PACKSWAP           0x10000U
  ------------------
  |  Branch (3838:17): [True: 0, False: 0]
  ------------------
 3839|      0|            {
 3840|      0|               sshift = (((row_info->width + 1) & 0x01) << 2);
 3841|      0|               dshift = (((final_width + 1) & 0x01) << 2);
 3842|      0|               s_start = 4;
 3843|      0|               s_end = 0;
 3844|      0|               s_inc = -4;
 3845|      0|            }
 3846|       |
 3847|      0|            else
 3848|      0|#endif
 3849|      0|            {
 3850|      0|               sshift = ((1 - ((row_info->width + 1) & 0x01)) << 2);
 3851|      0|               dshift = ((1 - ((final_width + 1) & 0x01)) << 2);
 3852|      0|               s_start = 0;
 3853|      0|               s_end = 4;
 3854|      0|               s_inc = 4;
 3855|      0|            }
 3856|       |
 3857|      0|            for (i = 0; i < row_info->width; i++)
  ------------------
  |  Branch (3857:25): [True: 0, False: 0]
  ------------------
 3858|      0|            {
 3859|      0|               png_byte v = (png_byte)((*sp >> sshift) & 0x0f);
 3860|      0|               int j;
 3861|       |
 3862|      0|               for (j = 0; j < jstop; j++)
  ------------------
  |  Branch (3862:28): [True: 0, False: 0]
  ------------------
 3863|      0|               {
 3864|      0|                  unsigned int tmp = *dp & (0xf0f >> (4 - dshift));
 3865|      0|                  tmp |= (unsigned int)(v << dshift);
 3866|      0|                  *dp = (png_byte)(tmp & 0xff);
 3867|       |
 3868|      0|                  if (dshift == s_end)
  ------------------
  |  Branch (3868:23): [True: 0, False: 0]
  ------------------
 3869|      0|                  {
 3870|      0|                     dshift = s_start;
 3871|      0|                     dp--;
 3872|      0|                  }
 3873|       |
 3874|      0|                  else
 3875|      0|                     dshift = (unsigned int)((int)dshift + s_inc);
 3876|      0|               }
 3877|       |
 3878|      0|               if (sshift == s_end)
  ------------------
  |  Branch (3878:20): [True: 0, False: 0]
  ------------------
 3879|      0|               {
 3880|      0|                  sshift = s_start;
 3881|      0|                  sp--;
 3882|      0|               }
 3883|       |
 3884|      0|               else
 3885|      0|                  sshift = (unsigned int)((int)sshift + s_inc);
 3886|      0|            }
 3887|      0|            break;
 3888|      0|         }
 3889|       |
 3890|  23.7k|         default:
  ------------------
  |  Branch (3890:10): [True: 23.7k, False: 0]
  ------------------
 3891|  23.7k|         {
 3892|  23.7k|            size_t pixel_bytes = (row_info->pixel_depth >> 3);
 3893|       |
 3894|  23.7k|            png_bytep sp = row + (size_t)(row_info->width - 1)
 3895|  23.7k|                * pixel_bytes;
 3896|       |
 3897|  23.7k|            png_bytep dp = row + (size_t)(final_width - 1) * pixel_bytes;
 3898|       |
 3899|  23.7k|            int jstop = (int)png_pass_inc[pass];
 3900|  23.7k|            png_uint_32 i;
 3901|       |
 3902|  4.18M|            for (i = 0; i < row_info->width; i++)
  ------------------
  |  Branch (3902:25): [True: 4.15M, False: 23.7k]
  ------------------
 3903|  4.15M|            {
 3904|  4.15M|               png_byte v[8]; /* SAFE; pixel_depth does not exceed 64 */
 3905|  4.15M|               int j;
 3906|       |
 3907|  4.15M|               memcpy(v, sp, pixel_bytes);
 3908|       |
 3909|  23.8M|               for (j = 0; j < jstop; j++)
  ------------------
  |  Branch (3909:28): [True: 19.7M, False: 4.15M]
  ------------------
 3910|  19.7M|               {
 3911|  19.7M|                  memcpy(dp, v, pixel_bytes);
 3912|  19.7M|                  dp -= pixel_bytes;
 3913|  19.7M|               }
 3914|       |
 3915|  4.15M|               sp -= pixel_bytes;
 3916|  4.15M|            }
 3917|  23.7k|            break;
 3918|      0|         }
 3919|  23.7k|      }
 3920|       |
 3921|  23.7k|      row_info->width = final_width;
 3922|  23.7k|      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width);
  ------------------
  |  |  764|  23.7k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 23.7k, False: 0]
  |  |  ------------------
  |  |  765|  23.7k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|  23.7k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
 3923|  23.7k|   }
 3924|       |#ifndef PNG_READ_PACKSWAP_SUPPORTED
 3925|       |   PNG_UNUSED(transformations)  /* Silence compiler warning */
 3926|       |#endif
 3927|  23.7k|}
png_read_filter_row:
 4133|  24.8k|{
 4134|       |   /* OPTIMIZATION: DO NOT MODIFY THIS FUNCTION, instead #define
 4135|       |    * PNG_FILTER_OPTIMIZATIONS to a function that overrides the generic
 4136|       |    * implementations.  See png_init_filter_functions above.
 4137|       |    */
 4138|  24.8k|   if (filter > PNG_FILTER_VALUE_NONE && filter < PNG_FILTER_VALUE_LAST)
  ------------------
  |  | 1475|  49.6k|#define PNG_FILTER_VALUE_NONE  0
  ------------------
                 if (filter > PNG_FILTER_VALUE_NONE && filter < PNG_FILTER_VALUE_LAST)
  ------------------
  |  | 1480|  24.8k|#define PNG_FILTER_VALUE_LAST  5
  ------------------
  |  Branch (4138:8): [True: 24.8k, False: 0]
  |  Branch (4138:42): [True: 24.8k, False: 0]
  ------------------
 4139|  24.8k|   {
 4140|  24.8k|      if (pp->read_filter[0] == NULL)
  ------------------
  |  Branch (4140:11): [True: 315, False: 24.5k]
  ------------------
 4141|    315|         png_init_filter_functions(pp);
 4142|       |
 4143|  24.8k|      pp->read_filter[filter-1](row_info, row, prev_row);
 4144|  24.8k|   }
 4145|  24.8k|}
png_read_IDAT_data:
 4151|   105k|{
 4152|       |   /* Loop reading IDATs and decompressing the result into output[avail_out] */
 4153|   105k|   png_ptr->zstream.next_out = output;
 4154|   105k|   png_ptr->zstream.avail_out = 0; /* safety: set below */
 4155|       |
 4156|   105k|   if (output == NULL)
  ------------------
  |  Branch (4156:8): [True: 588, False: 104k]
  ------------------
 4157|    588|      avail_out = 0;
 4158|       |
 4159|   105k|   do
 4160|   108k|   {
 4161|   108k|      int ret;
 4162|   108k|      png_byte tmpbuf[PNG_INFLATE_BUF_SIZE];
 4163|       |
 4164|   108k|      if (png_ptr->zstream.avail_in == 0)
  ------------------
  |  Branch (4164:11): [True: 2.54k, False: 105k]
  ------------------
 4165|  2.54k|      {
 4166|  2.54k|         uInt avail_in;
 4167|  2.54k|         png_bytep buffer;
 4168|       |
 4169|  4.47k|         while (png_ptr->idat_size == 0)
  ------------------
  |  Branch (4169:17): [True: 1.93k, False: 2.54k]
  ------------------
 4170|  1.93k|         {
 4171|  1.93k|            png_crc_finish(png_ptr, 0);
 4172|       |
 4173|  1.93k|            png_ptr->idat_size = png_read_chunk_header(png_ptr);
 4174|       |            /* This is an error even in the 'check' case because the code just
 4175|       |             * consumed a non-IDAT header.
 4176|       |             */
 4177|  1.93k|            if (png_ptr->chunk_name != png_IDAT)
  ------------------
  |  |  873|  1.93k|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|  1.93k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.93k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.93k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.93k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.93k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4177:17): [True: 0, False: 1.93k]
  ------------------
 4178|      0|               png_error(png_ptr, "Not enough image data");
 4179|  1.93k|         }
 4180|       |
 4181|  2.54k|         avail_in = png_ptr->IDAT_read_size;
 4182|       |
 4183|  2.54k|         if (avail_in > png_ptr->idat_size)
  ------------------
  |  Branch (4183:14): [True: 1.61k, False: 932]
  ------------------
 4184|  1.61k|            avail_in = (uInt)png_ptr->idat_size;
 4185|       |
 4186|       |         /* A PNG with a gradually increasing IDAT size will defeat this attempt
 4187|       |          * to minimize memory usage by causing lots of re-allocs, but
 4188|       |          * realistically doing IDAT_read_size re-allocs is not likely to be a
 4189|       |          * big problem.
 4190|       |          */
 4191|  2.54k|         buffer = png_read_buffer(png_ptr, avail_in, 0/*error*/);
 4192|       |
 4193|  2.54k|         png_crc_read(png_ptr, buffer, avail_in);
 4194|  2.54k|         png_ptr->idat_size -= avail_in;
 4195|       |
 4196|  2.54k|         png_ptr->zstream.next_in = buffer;
 4197|  2.54k|         png_ptr->zstream.avail_in = avail_in;
 4198|  2.54k|      }
 4199|       |
 4200|       |      /* And set up the output side. */
 4201|   108k|      if (output != NULL) /* standard read */
  ------------------
  |  Branch (4201:11): [True: 105k, False: 2.65k]
  ------------------
 4202|   105k|      {
 4203|   105k|         uInt out = ZLIB_IO_MAX;
  ------------------
  |  |   56|   105k|#  define ZLIB_IO_MAX ((uInt)-1)
  ------------------
 4204|       |
 4205|   105k|         if (out > avail_out)
  ------------------
  |  Branch (4205:14): [True: 105k, False: 0]
  ------------------
 4206|   105k|            out = (uInt)avail_out;
 4207|       |
 4208|   105k|         avail_out -= out;
 4209|   105k|         png_ptr->zstream.avail_out = out;
 4210|   105k|      }
 4211|       |
 4212|  2.65k|      else /* after last row, checking for end */
 4213|  2.65k|      {
 4214|  2.65k|         png_ptr->zstream.next_out = tmpbuf;
 4215|  2.65k|         png_ptr->zstream.avail_out = (sizeof tmpbuf);
 4216|  2.65k|      }
 4217|       |
 4218|       |      /* Use NO_FLUSH; this gives zlib the maximum opportunity to optimize the
 4219|       |       * process.  If the LZ stream is truncated the sequential reader will
 4220|       |       * terminally damage the stream, above, by reading the chunk header of the
 4221|       |       * following chunk (it then exits with png_error).
 4222|       |       *
 4223|       |       * TODO: deal more elegantly with truncated IDAT lists.
 4224|       |       */
 4225|   108k|      ret = PNG_INFLATE(png_ptr, Z_NO_FLUSH);
  ------------------
  |  | 1455|   108k|#  define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
  ------------------
 4226|       |
 4227|       |      /* Take the unconsumed output back. */
 4228|   108k|      if (output != NULL)
  ------------------
  |  Branch (4228:11): [True: 105k, False: 2.65k]
  ------------------
 4229|   105k|         avail_out += png_ptr->zstream.avail_out;
 4230|       |
 4231|  2.65k|      else /* avail_out counts the extra bytes */
 4232|  2.65k|         avail_out += (sizeof tmpbuf) - png_ptr->zstream.avail_out;
 4233|       |
 4234|   108k|      png_ptr->zstream.avail_out = 0;
 4235|       |
 4236|   108k|      if (ret == Z_STREAM_END)
  ------------------
  |  Branch (4236:11): [True: 66, False: 108k]
  ------------------
 4237|     66|      {
 4238|       |         /* Do this for safety; we won't read any more into this row. */
 4239|     66|         png_ptr->zstream.next_out = NULL;
 4240|       |
 4241|     66|         png_ptr->mode |= PNG_AFTER_IDAT;
  ------------------
  |  |  645|     66|#define PNG_AFTER_IDAT 0x08
  ------------------
 4242|     66|         png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
  ------------------
  |  |  707|     66|#define PNG_FLAG_ZSTREAM_ENDED            0x0008U /* Added to libpng-1.6.0 */
  ------------------
 4243|       |
 4244|     66|         if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
  ------------------
  |  Branch (4244:14): [True: 1, False: 65]
  |  Branch (4244:47): [True: 0, False: 65]
  ------------------
 4245|      1|            png_chunk_benign_error(png_ptr, "Extra compressed data");
 4246|     66|         break;
 4247|     66|      }
 4248|       |
 4249|   108k|      if (ret != Z_OK)
  ------------------
  |  Branch (4249:11): [True: 568, False: 107k]
  ------------------
 4250|    568|      {
 4251|    568|         png_zstream_error(png_ptr, ret);
 4252|       |
 4253|    568|         if (output != NULL)
  ------------------
  |  Branch (4253:14): [True: 36, False: 532]
  ------------------
 4254|     36|            png_chunk_error(png_ptr, png_ptr->zstream.msg);
 4255|       |
 4256|    532|         else /* checking */
 4257|    532|         {
 4258|    532|            png_chunk_benign_error(png_ptr, png_ptr->zstream.msg);
 4259|    532|            return;
 4260|    532|         }
 4261|    568|      }
 4262|   108k|   } while (avail_out > 0);
  ------------------
  |  Branch (4262:13): [True: 3.06k, False: 104k]
  ------------------
 4263|       |
 4264|   104k|   if (avail_out > 0)
  ------------------
  |  Branch (4264:8): [True: 19, False: 104k]
  ------------------
 4265|     19|   {
 4266|       |      /* The stream ended before the image; this is the same as too few IDATs so
 4267|       |       * should be handled the same way.
 4268|       |       */
 4269|     19|      if (output != NULL)
  ------------------
  |  Branch (4269:11): [True: 2, False: 17]
  ------------------
 4270|      2|         png_error(png_ptr, "Not enough image data");
 4271|       |
 4272|     17|      else /* the deflate stream contained extra data */
 4273|     17|         png_chunk_benign_error(png_ptr, "Too much image data");
 4274|     19|   }
 4275|   104k|}
png_read_finish_IDAT:
 4279|  1.22k|{
 4280|       |   /* We don't need any more data and the stream should have ended, however the
 4281|       |    * LZ end code may actually not have been processed.  In this case we must
 4282|       |    * read it otherwise stray unread IDAT data or, more likely, an IDAT chunk
 4283|       |    * may still remain to be consumed.
 4284|       |    */
 4285|  1.22k|   if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
  ------------------
  |  |  707|  1.22k|#define PNG_FLAG_ZSTREAM_ENDED            0x0008U /* Added to libpng-1.6.0 */
  ------------------
  |  Branch (4285:8): [True: 588, False: 633]
  ------------------
 4286|    588|   {
 4287|       |      /* The NULL causes png_read_IDAT_data to swallow any remaining bytes in
 4288|       |       * the compressed stream, but the stream may be damaged too, so even after
 4289|       |       * this call we may need to terminate the zstream ownership.
 4290|       |       */
 4291|    588|      png_read_IDAT_data(png_ptr, NULL, 0);
 4292|    588|      png_ptr->zstream.next_out = NULL; /* safety */
 4293|       |
 4294|       |      /* Now clear everything out for safety; the following may not have been
 4295|       |       * done.
 4296|       |       */
 4297|    588|      if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
  ------------------
  |  |  707|    588|#define PNG_FLAG_ZSTREAM_ENDED            0x0008U /* Added to libpng-1.6.0 */
  ------------------
  |  Branch (4297:11): [True: 532, False: 56]
  ------------------
 4298|    532|      {
 4299|    532|         png_ptr->mode |= PNG_AFTER_IDAT;
  ------------------
  |  |  645|    532|#define PNG_AFTER_IDAT 0x08
  ------------------
 4300|    532|         png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
  ------------------
  |  |  707|    532|#define PNG_FLAG_ZSTREAM_ENDED            0x0008U /* Added to libpng-1.6.0 */
  ------------------
 4301|    532|      }
 4302|    588|   }
 4303|       |
 4304|       |   /* If the zstream has not been released do it now *and* terminate the reading
 4305|       |    * of the final IDAT chunk.
 4306|       |    */
 4307|  1.22k|   if (png_ptr->zowner == png_IDAT)
  ------------------
  |  |  873|  1.22k|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|  1.22k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.22k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.22k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.22k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.22k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4307:8): [True: 596, False: 625]
  ------------------
 4308|    596|   {
 4309|       |      /* Always do this; the pointers otherwise point into the read buffer. */
 4310|    596|      png_ptr->zstream.next_in = NULL;
 4311|    596|      png_ptr->zstream.avail_in = 0;
 4312|       |
 4313|       |      /* Now we no longer own the zstream. */
 4314|    596|      png_ptr->zowner = 0;
 4315|       |
 4316|       |      /* The slightly weird semantics of the sequential IDAT reading is that we
 4317|       |       * are always in or at the end of an IDAT chunk, so we always need to do a
 4318|       |       * crc_finish here.  If idat_size is non-zero we also need to read the
 4319|       |       * spurious bytes at the end of the chunk now.
 4320|       |       */
 4321|    596|      (void)png_crc_finish(png_ptr, png_ptr->idat_size);
 4322|    596|   }
 4323|  1.22k|}
png_read_finish_row:
 4327|   259k|{
 4328|       |   /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
 4329|       |
 4330|       |   /* Start of interlace block */
 4331|   259k|   static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
 4332|       |
 4333|       |   /* Offset to next interlace block */
 4334|   259k|   static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
 4335|       |
 4336|       |   /* Start of interlace block in the y direction */
 4337|   259k|   static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
 4338|       |
 4339|       |   /* Offset to next interlace block in the y direction */
 4340|   259k|   static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
 4341|       |
 4342|   259k|   png_debug(1, "in png_read_finish_row");
  ------------------
  |  |  145|   259k|#  define png_debug(l, m) ((void)0)
  ------------------
 4343|   259k|   png_ptr->row_number++;
 4344|   259k|   if (png_ptr->row_number < png_ptr->num_rows)
  ------------------
  |  Branch (4344:8): [True: 255k, False: 4.01k]
  ------------------
 4345|   255k|      return;
 4346|       |
 4347|  4.01k|   if (png_ptr->interlaced != 0)
  ------------------
  |  Branch (4347:8): [True: 3.89k, False: 125]
  ------------------
 4348|  3.89k|   {
 4349|  3.89k|      png_ptr->row_number = 0;
 4350|       |
 4351|       |      /* TO DO: don't do this if prev_row isn't needed (requires
 4352|       |       * read-ahead of the next row's filter byte.
 4353|       |       */
 4354|  3.89k|      memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
 4355|       |
 4356|  3.89k|      do
 4357|  3.89k|      {
 4358|  3.89k|         png_ptr->pass++;
 4359|       |
 4360|  3.89k|         if (png_ptr->pass >= 7)
  ------------------
  |  Branch (4360:14): [True: 510, False: 3.38k]
  ------------------
 4361|    510|            break;
 4362|       |
 4363|  3.38k|         png_ptr->iwidth = (png_ptr->width +
 4364|  3.38k|            png_pass_inc[png_ptr->pass] - 1 -
 4365|  3.38k|            png_pass_start[png_ptr->pass]) /
 4366|  3.38k|            png_pass_inc[png_ptr->pass];
 4367|       |
 4368|  3.38k|         if ((png_ptr->transformations & PNG_INTERLACE) == 0)
  ------------------
  |  |  668|  3.38k|#define PNG_INTERLACE           0x0002U
  ------------------
  |  Branch (4368:14): [True: 0, False: 3.38k]
  ------------------
 4369|      0|         {
 4370|      0|            png_ptr->num_rows = (png_ptr->height +
 4371|      0|                png_pass_yinc[png_ptr->pass] - 1 -
 4372|      0|                png_pass_ystart[png_ptr->pass]) /
 4373|      0|                png_pass_yinc[png_ptr->pass];
 4374|      0|         }
 4375|       |
 4376|  3.38k|         else  /* if (png_ptr->transformations & PNG_INTERLACE) */
 4377|  3.38k|            break; /* libpng deinterlacing sees every row */
 4378|       |
 4379|  3.38k|      } while (png_ptr->num_rows == 0 || png_ptr->iwidth == 0);
  ------------------
  |  Branch (4379:16): [True: 0, False: 0]
  |  Branch (4379:42): [True: 0, False: 0]
  ------------------
 4380|       |
 4381|  3.89k|      if (png_ptr->pass < 7)
  ------------------
  |  Branch (4381:11): [True: 3.38k, False: 510]
  ------------------
 4382|  3.38k|         return;
 4383|  3.89k|   }
 4384|       |
 4385|       |   /* Here after at the end of the last row of the last pass. */
 4386|    635|   png_read_finish_IDAT(png_ptr);
 4387|    635|}
png_read_start_row:
 4392|  1.01k|{
 4393|       |   /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
 4394|       |
 4395|       |   /* Start of interlace block */
 4396|  1.01k|   static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
 4397|       |
 4398|       |   /* Offset to next interlace block */
 4399|  1.01k|   static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
 4400|       |
 4401|       |   /* Start of interlace block in the y direction */
 4402|  1.01k|   static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
 4403|       |
 4404|       |   /* Offset to next interlace block in the y direction */
 4405|  1.01k|   static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
 4406|       |
 4407|  1.01k|   unsigned int max_pixel_depth;
 4408|  1.01k|   size_t row_bytes;
 4409|       |
 4410|  1.01k|   png_debug(1, "in png_read_start_row");
  ------------------
  |  |  145|  1.01k|#  define png_debug(l, m) ((void)0)
  ------------------
 4411|       |
 4412|  1.01k|#ifdef PNG_READ_TRANSFORMS_SUPPORTED
 4413|  1.01k|   png_init_read_transformations(png_ptr);
 4414|  1.01k|#endif
 4415|  1.01k|   if (png_ptr->interlaced != 0)
  ------------------
  |  Branch (4415:8): [True: 710, False: 301]
  ------------------
 4416|    710|   {
 4417|    710|      if ((png_ptr->transformations & PNG_INTERLACE) == 0)
  ------------------
  |  |  668|    710|#define PNG_INTERLACE           0x0002U
  ------------------
  |  Branch (4417:11): [True: 0, False: 710]
  ------------------
 4418|      0|         png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
 4419|      0|             png_pass_ystart[0]) / png_pass_yinc[0];
 4420|       |
 4421|    710|      else
 4422|    710|         png_ptr->num_rows = png_ptr->height;
 4423|       |
 4424|    710|      png_ptr->iwidth = (png_ptr->width +
 4425|    710|          png_pass_inc[png_ptr->pass] - 1 -
 4426|    710|          png_pass_start[png_ptr->pass]) /
 4427|    710|          png_pass_inc[png_ptr->pass];
 4428|    710|   }
 4429|       |
 4430|    301|   else
 4431|    301|   {
 4432|    301|      png_ptr->num_rows = png_ptr->height;
 4433|    301|      png_ptr->iwidth = png_ptr->width;
 4434|    301|   }
 4435|       |
 4436|  1.01k|   max_pixel_depth = (unsigned int)png_ptr->pixel_depth;
 4437|       |
 4438|       |   /* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of
 4439|       |    * calculations to calculate the final pixel depth, then
 4440|       |    * png_do_read_transforms actually does the transforms.  This means that the
 4441|       |    * code which effectively calculates this value is actually repeated in three
 4442|       |    * separate places.  They must all match.  Innocent changes to the order of
 4443|       |    * transformations can and will break libpng in a way that causes memory
 4444|       |    * overwrites.
 4445|       |    *
 4446|       |    * TODO: fix this.
 4447|       |    */
 4448|  1.01k|#ifdef PNG_READ_PACK_SUPPORTED
 4449|  1.01k|   if ((png_ptr->transformations & PNG_PACK) != 0 && png_ptr->bit_depth < 8)
  ------------------
  |  |  669|  1.01k|#define PNG_PACK                0x0004U
  ------------------
  |  Branch (4449:8): [True: 134, False: 877]
  |  Branch (4449:54): [True: 134, False: 0]
  ------------------
 4450|    134|      max_pixel_depth = 8;
 4451|  1.01k|#endif
 4452|       |
 4453|  1.01k|#ifdef PNG_READ_EXPAND_SUPPORTED
 4454|  1.01k|   if ((png_ptr->transformations & PNG_EXPAND) != 0)
  ------------------
  |  |  679|  1.01k|#define PNG_EXPAND              0x1000U
  ------------------
  |  Branch (4454:8): [True: 382, False: 629]
  ------------------
 4455|    382|   {
 4456|    382|      if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|    382|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|    382|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|    382|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (4456:11): [True: 84, False: 298]
  ------------------
 4457|     84|      {
 4458|     84|         if (png_ptr->num_trans != 0)
  ------------------
  |  Branch (4458:14): [True: 29, False: 55]
  ------------------
 4459|     29|            max_pixel_depth = 32;
 4460|       |
 4461|     55|         else
 4462|     55|            max_pixel_depth = 24;
 4463|     84|      }
 4464|       |
 4465|    298|      else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
  ------------------
  |  |  667|    298|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (4465:16): [True: 132, False: 166]
  ------------------
 4466|    132|      {
 4467|    132|         if (max_pixel_depth < 8)
  ------------------
  |  Branch (4467:14): [True: 0, False: 132]
  ------------------
 4468|      0|            max_pixel_depth = 8;
 4469|       |
 4470|    132|         if (png_ptr->num_trans != 0)
  ------------------
  |  Branch (4470:14): [True: 52, False: 80]
  ------------------
 4471|     52|            max_pixel_depth *= 2;
 4472|    132|      }
 4473|       |
 4474|    166|      else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
  ------------------
  |  |  669|    166|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|    166|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (4474:16): [True: 135, False: 31]
  ------------------
 4475|    135|      {
 4476|    135|         if (png_ptr->num_trans != 0)
  ------------------
  |  Branch (4476:14): [True: 135, False: 0]
  ------------------
 4477|    135|         {
 4478|    135|            max_pixel_depth *= 4;
 4479|    135|            max_pixel_depth /= 3;
 4480|    135|         }
 4481|    135|      }
 4482|    382|   }
 4483|  1.01k|#endif
 4484|       |
 4485|  1.01k|#ifdef PNG_READ_EXPAND_16_SUPPORTED
 4486|  1.01k|   if ((png_ptr->transformations & PNG_EXPAND_16) != 0)
  ------------------
  |  |  676|  1.01k|#define PNG_EXPAND_16           0x0200U    /* Added to libpng 1.5.2 */
  ------------------
  |  Branch (4486:8): [True: 0, False: 1.01k]
  ------------------
 4487|      0|   {
 4488|      0|#  ifdef PNG_READ_EXPAND_SUPPORTED
 4489|       |      /* In fact it is an error if it isn't supported, but checking is
 4490|       |       * the safe way.
 4491|       |       */
 4492|      0|      if ((png_ptr->transformations & PNG_EXPAND) != 0)
  ------------------
  |  |  679|      0|#define PNG_EXPAND              0x1000U
  ------------------
  |  Branch (4492:11): [True: 0, False: 0]
  ------------------
 4493|      0|      {
 4494|      0|         if (png_ptr->bit_depth < 16)
  ------------------
  |  Branch (4494:14): [True: 0, False: 0]
  ------------------
 4495|      0|            max_pixel_depth *= 2;
 4496|      0|      }
 4497|      0|      else
 4498|      0|#  endif
 4499|      0|      png_ptr->transformations &= ~PNG_EXPAND_16;
  ------------------
  |  |  676|      0|#define PNG_EXPAND_16           0x0200U    /* Added to libpng 1.5.2 */
  ------------------
 4500|      0|   }
 4501|  1.01k|#endif
 4502|       |
 4503|  1.01k|#ifdef PNG_READ_FILLER_SUPPORTED
 4504|  1.01k|   if ((png_ptr->transformations & (PNG_FILLER)) != 0)
  ------------------
  |  |  682|  1.01k|#define PNG_FILLER              0x8000U
  ------------------
  |  Branch (4504:8): [True: 1.01k, False: 0]
  ------------------
 4505|  1.01k|   {
 4506|  1.01k|      if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
  ------------------
  |  |  667|  1.01k|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (4506:11): [True: 132, False: 879]
  ------------------
 4507|    132|      {
 4508|    132|         if (max_pixel_depth <= 8)
  ------------------
  |  Branch (4508:14): [True: 60, False: 72]
  ------------------
 4509|     60|            max_pixel_depth = 16;
 4510|       |
 4511|     72|         else
 4512|     72|            max_pixel_depth = 32;
 4513|    132|      }
 4514|       |
 4515|    879|      else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB ||
  ------------------
  |  |  669|  1.75k|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|    879|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (4515:16): [True: 716, False: 163]
  ------------------
 4516|    879|         png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|    163|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|    163|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|    163|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (4516:10): [True: 84, False: 79]
  ------------------
 4517|    800|      {
 4518|    800|         if (max_pixel_depth <= 32)
  ------------------
  |  Branch (4518:14): [True: 200, False: 600]
  ------------------
 4519|    200|            max_pixel_depth = 32;
 4520|       |
 4521|    600|         else
 4522|    600|            max_pixel_depth = 64;
 4523|    800|      }
 4524|  1.01k|   }
 4525|  1.01k|#endif
 4526|       |
 4527|  1.01k|#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 4528|  1.01k|   if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0)
  ------------------
  |  |  681|  1.01k|#define PNG_GRAY_TO_RGB         0x4000U
  ------------------
  |  Branch (4528:8): [True: 163, False: 848]
  ------------------
 4529|    163|   {
 4530|    163|      if (
 4531|    163|#ifdef PNG_READ_EXPAND_SUPPORTED
 4532|    163|          (png_ptr->num_trans != 0 &&
  ------------------
  |  Branch (4532:12): [True: 52, False: 111]
  ------------------
 4533|    163|          (png_ptr->transformations & PNG_EXPAND) != 0) ||
  ------------------
  |  |  679|     52|#define PNG_EXPAND              0x1000U
  ------------------
  |  Branch (4533:11): [True: 52, False: 0]
  ------------------
 4534|    163|#endif
 4535|    163|#ifdef PNG_READ_FILLER_SUPPORTED
 4536|    163|          (png_ptr->transformations & (PNG_FILLER)) != 0 ||
  ------------------
  |  |  682|    111|#define PNG_FILLER              0x8000U
  ------------------
  |  Branch (4536:11): [True: 111, False: 0]
  ------------------
 4537|    163|#endif
 4538|    163|          png_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
  ------------------
  |  |  671|      0|#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (4538:11): [True: 0, False: 0]
  ------------------
 4539|    163|      {
 4540|    163|         if (max_pixel_depth <= 16)
  ------------------
  |  Branch (4540:14): [True: 85, False: 78]
  ------------------
 4541|     85|            max_pixel_depth = 32;
 4542|       |
 4543|     78|         else
 4544|     78|            max_pixel_depth = 64;
 4545|    163|      }
 4546|       |
 4547|      0|      else
 4548|      0|      {
 4549|      0|         if (max_pixel_depth <= 8)
  ------------------
  |  Branch (4549:14): [True: 0, False: 0]
  ------------------
 4550|      0|         {
 4551|      0|            if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
  ------------------
  |  |  670|      0|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (4551:17): [True: 0, False: 0]
  ------------------
 4552|      0|               max_pixel_depth = 32;
 4553|       |
 4554|      0|            else
 4555|      0|               max_pixel_depth = 24;
 4556|      0|         }
 4557|       |
 4558|      0|         else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
  ------------------
  |  |  670|      0|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|      0|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (4558:19): [True: 0, False: 0]
  ------------------
 4559|      0|            max_pixel_depth = 64;
 4560|       |
 4561|      0|         else
 4562|      0|            max_pixel_depth = 48;
 4563|      0|      }
 4564|    163|   }
 4565|  1.01k|#endif
 4566|       |
 4567|  1.01k|#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) && \
 4568|  1.01k|defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
 4569|  1.01k|   if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
  ------------------
  |  |  687|  1.01k|#define PNG_USER_TRANSFORM    0x100000U
  ------------------
  |  Branch (4569:8): [True: 0, False: 1.01k]
  ------------------
 4570|      0|   {
 4571|      0|      unsigned int user_pixel_depth = png_ptr->user_transform_depth *
 4572|      0|         png_ptr->user_transform_channels;
 4573|       |
 4574|      0|      if (user_pixel_depth > max_pixel_depth)
  ------------------
  |  Branch (4574:11): [True: 0, False: 0]
  ------------------
 4575|      0|         max_pixel_depth = user_pixel_depth;
 4576|      0|   }
 4577|  1.01k|#endif
 4578|       |
 4579|       |   /* This value is stored in png_struct and double checked in the row read
 4580|       |    * code.
 4581|       |    */
 4582|  1.01k|   png_ptr->maximum_pixel_depth = (png_byte)max_pixel_depth;
 4583|  1.01k|   png_ptr->transformed_pixel_depth = 0; /* calculated on demand */
 4584|       |
 4585|       |   /* Align the width on the next larger 8 pixels.  Mainly used
 4586|       |    * for interlacing
 4587|       |    */
 4588|  1.01k|   row_bytes = ((png_ptr->width + 7) & ~((png_uint_32)7));
 4589|       |   /* Calculate the maximum bytes needed, adding a byte and a pixel
 4590|       |    * for safety's sake
 4591|       |    */
 4592|  1.01k|   row_bytes = PNG_ROWBYTES(max_pixel_depth, row_bytes) +
  ------------------
  |  |  764|  1.01k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 1.01k, False: 0]
  |  |  ------------------
  |  |  765|  1.01k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|  1.01k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
 4593|  1.01k|       1 + ((max_pixel_depth + 7) >> 3U);
 4594|       |
 4595|       |#ifdef PNG_MAX_MALLOC_64K
 4596|       |   if (row_bytes > (png_uint_32)65536L)
 4597|       |      png_error(png_ptr, "This image requires a row greater than 64KB");
 4598|       |#endif
 4599|       |
 4600|  1.01k|   if (row_bytes + 48 > png_ptr->old_big_row_buf_size)
  ------------------
  |  Branch (4600:8): [True: 1.01k, False: 0]
  ------------------
 4601|  1.01k|   {
 4602|  1.01k|      png_free(png_ptr, png_ptr->big_row_buf);
 4603|  1.01k|      png_free(png_ptr, png_ptr->big_prev_row);
 4604|       |
 4605|  1.01k|      if (png_ptr->interlaced != 0)
  ------------------
  |  Branch (4605:11): [True: 710, False: 301]
  ------------------
 4606|    710|         png_ptr->big_row_buf = (png_bytep)png_calloc(png_ptr,
 4607|    710|             row_bytes + 48);
 4608|       |
 4609|    301|      else
 4610|    301|         png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes + 48);
 4611|       |
 4612|  1.01k|      png_ptr->big_prev_row = (png_bytep)png_malloc(png_ptr, row_bytes + 48);
 4613|       |
 4614|  1.01k|#ifdef PNG_ALIGNED_MEMORY_SUPPORTED
 4615|       |      /* Use 16-byte aligned memory for row_buf with at least 16 bytes
 4616|       |       * of padding before and after row_buf; treat prev_row similarly.
 4617|       |       * NOTE: the alignment is to the start of the pixels, one beyond the start
 4618|       |       * of the buffer, because of the filter byte.  Prior to libpng 1.5.6 this
 4619|       |       * was incorrect; the filter byte was aligned, which had the exact
 4620|       |       * opposite effect of that intended.
 4621|       |       */
 4622|  1.01k|      {
 4623|  1.01k|         png_bytep temp = png_ptr->big_row_buf + 32;
 4624|  1.01k|         size_t extra = (size_t)temp & 0x0f;
 4625|  1.01k|         png_ptr->row_buf = temp - extra - 1/*filter byte*/;
 4626|       |
 4627|  1.01k|         temp = png_ptr->big_prev_row + 32;
 4628|  1.01k|         extra = (size_t)temp & 0x0f;
 4629|  1.01k|         png_ptr->prev_row = temp - extra - 1/*filter byte*/;
 4630|  1.01k|      }
 4631|       |#else
 4632|       |      /* Use 31 bytes of padding before and 17 bytes after row_buf. */
 4633|       |      png_ptr->row_buf = png_ptr->big_row_buf + 31;
 4634|       |      png_ptr->prev_row = png_ptr->big_prev_row + 31;
 4635|       |#endif
 4636|  1.01k|      png_ptr->old_big_row_buf_size = row_bytes + 48;
 4637|  1.01k|   }
 4638|       |
 4639|       |#ifdef PNG_MAX_MALLOC_64K
 4640|       |   if (png_ptr->rowbytes > 65535)
 4641|       |      png_error(png_ptr, "This image requires a row greater than 64KB");
 4642|       |
 4643|       |#endif
 4644|  1.01k|   if (png_ptr->rowbytes > (PNG_SIZE_MAX - 1))
  ------------------
  |  |  650|  1.01k|#define PNG_SIZE_MAX ((size_t)(-1))
  ------------------
  |  Branch (4644:8): [True: 0, False: 1.01k]
  ------------------
 4645|      0|      png_error(png_ptr, "Row has too many bytes to allocate in memory");
 4646|       |
 4647|  1.01k|   memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
 4648|       |
 4649|  1.01k|   png_debug1(3, "width = %u,", png_ptr->width);
  ------------------
  |  |  148|  1.01k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
 4650|  1.01k|   png_debug1(3, "height = %u,", png_ptr->height);
  ------------------
  |  |  148|  1.01k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
 4651|  1.01k|   png_debug1(3, "iwidth = %u,", png_ptr->iwidth);
  ------------------
  |  |  148|  1.01k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
 4652|  1.01k|   png_debug1(3, "num_rows = %u,", png_ptr->num_rows);
  ------------------
  |  |  148|  1.01k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
 4653|  1.01k|   png_debug1(3, "rowbytes = %lu,", (unsigned long)png_ptr->rowbytes);
  ------------------
  |  |  148|  1.01k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
 4654|  1.01k|   png_debug1(3, "irowbytes = %lu",
  ------------------
  |  |  148|  1.01k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
 4655|  1.01k|       (unsigned long)PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1);
 4656|       |
 4657|       |   /* The sequential reader needs a buffer for IDAT, but the progressive reader
 4658|       |    * does not, so free the read buffer now regardless; the sequential reader
 4659|       |    * reallocates it on demand.
 4660|       |    */
 4661|  1.01k|   if (png_ptr->read_buffer != NULL)
  ------------------
  |  Branch (4661:8): [True: 21, False: 990]
  ------------------
 4662|     21|   {
 4663|     21|      png_bytep buffer = png_ptr->read_buffer;
 4664|       |
 4665|     21|      png_ptr->read_buffer_size = 0;
 4666|     21|      png_ptr->read_buffer = NULL;
 4667|     21|      png_free(png_ptr, buffer);
 4668|     21|   }
 4669|       |
 4670|       |   /* Finally claim the zstream for the inflate of the IDAT data, use the bits
 4671|       |    * value from the stream (note that this will result in a fatal error if the
 4672|       |    * IDAT stream has a bogus deflate header window_bits value, but this should
 4673|       |    * not be happening any longer!)
 4674|       |    */
 4675|  1.01k|   if (png_inflate_claim(png_ptr, png_IDAT) != Z_OK)
  ------------------
  |  |  873|  1.01k|#define png_IDAT PNG_U32( 73,  68,  65,  84)
  |  |  ------------------
  |  |  |  |  848|  1.01k|   (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.01k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.01k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.01k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  |  |                  (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
  |  |  |  |  ------------------
  |  |  |  |  |  |  846|  1.01k|#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4675:8): [True: 0, False: 1.01k]
  ------------------
 4676|      0|      png_error(png_ptr, png_ptr->zstream.msg);
 4677|       |
 4678|  1.01k|   png_ptr->flags |= PNG_FLAG_ROW_INIT;
  ------------------
  |  |  710|  1.01k|#define PNG_FLAG_ROW_INIT                 0x0040U
  ------------------
 4679|  1.01k|}
pngrutil.c:png_get_fixed_point:
   42|  20.3k|{
   43|  20.3k|   png_uint_32 uval = png_get_uint_32(buf);
  ------------------
  |  | 2594|  20.3k|#    define png_get_uint_32(buf) PNG_get_uint_32(buf)
  |  |  ------------------
  |  |  |  | 2572|  20.3k|   (((png_uint_32)(*(buf)) << 24) + \
  |  |  |  | 2573|  20.3k|    ((png_uint_32)(*((buf) + 1)) << 16) + \
  |  |  |  | 2574|  20.3k|    ((png_uint_32)(*((buf) + 2)) << 8) + \
  |  |  |  | 2575|  20.3k|    ((png_uint_32)(*((buf) + 3))))
  |  |  ------------------
  ------------------
   44|       |
   45|  20.3k|   if (uval <= PNG_UINT_31_MAX)
  ------------------
  |  |  648|  20.3k|#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  ------------------
  |  Branch (45:8): [True: 15.9k, False: 4.41k]
  ------------------
   46|  15.9k|      return (png_fixed_point)uval; /* known to be in range */
   47|       |
   48|       |   /* The caller can turn off the warning by passing NULL. */
   49|  4.41k|   if (png_ptr != NULL)
  ------------------
  |  Branch (49:8): [True: 0, False: 4.41k]
  ------------------
   50|      0|      png_warning(png_ptr, "PNG fixed point integer out of range");
   51|       |
   52|  4.41k|   return PNG_FIXED_ERROR;
  ------------------
  |  |   38|  4.41k|#define PNG_FIXED_ERROR (-1)
  ------------------
   53|  20.3k|}
pngrutil.c:png_inflate_claim:
  342|  9.96k|{
  343|  9.96k|   if (png_ptr->zowner != 0)
  ------------------
  |  Branch (343:8): [True: 0, False: 9.96k]
  ------------------
  344|      0|   {
  345|      0|      char msg[64];
  346|       |
  347|      0|      PNG_STRING_FROM_CHUNK(msg, png_ptr->zowner);
  ------------------
  |  |  912|      0|   (void)(((char*)(s))[0]=(char)(((c)>>24) & 0xff), \
  |  |  913|      0|   ((char*)(s))[1]=(char)(((c)>>16) & 0xff),\
  |  |  914|      0|   ((char*)(s))[2]=(char)(((c)>>8) & 0xff), \
  |  |  915|      0|   ((char*)(s))[3]=(char)((c & 0xff)))
  ------------------
  348|       |      /* So the message that results is "<chunk> using zstream"; this is an
  349|       |       * internal error, but is very useful for debugging.  i18n requirements
  350|       |       * are minimal.
  351|       |       */
  352|      0|      (void)png_safecat(msg, (sizeof msg), 4, " using zstream");
  353|      0|#if PNG_RELEASE_BUILD
  354|      0|      png_chunk_warning(png_ptr, msg);
  355|      0|      png_ptr->zowner = 0;
  356|       |#else
  357|       |      png_chunk_error(png_ptr, msg);
  358|       |#endif
  359|      0|   }
  360|       |
  361|       |   /* Implementation note: unlike 'png_deflate_claim' this internal function
  362|       |    * does not take the size of the data as an argument.  Some efficiency could
  363|       |    * be gained by using this when it is known *if* the zlib stream itself does
  364|       |    * not record the number; however, this is an illusion: the original writer
  365|       |    * of the PNG may have selected a lower window size, and we really must
  366|       |    * follow that because, for systems with with limited capabilities, we
  367|       |    * would otherwise reject the application's attempts to use a smaller window
  368|       |    * size (zlib doesn't have an interface to say "this or lower"!).
  369|       |    *
  370|       |    * inflateReset2 was added to zlib 1.2.4; before this the window could not be
  371|       |    * reset, therefore it is necessary to always allocate the maximum window
  372|       |    * size with earlier zlibs just in case later compressed chunks need it.
  373|       |    */
  374|  9.96k|   {
  375|  9.96k|      int ret; /* zlib return code */
  376|  9.96k|#if ZLIB_VERNUM >= 0x1240
  377|  9.96k|      int window_bits = 0;
  378|       |
  379|  9.96k|# if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW)
  380|  9.96k|      if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
  ------------------
  |  | 3201|  9.96k|#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
  ------------------
  |  Branch (380:11): [True: 0, False: 9.96k]
  ------------------
  381|  9.96k|          PNG_OPTION_ON)
  ------------------
  |  | 3223|  9.96k|#define PNG_OPTION_ON      3
  ------------------
  382|      0|      {
  383|      0|         window_bits = 15;
  384|      0|         png_ptr->zstream_start = 0; /* fixed window size */
  385|      0|      }
  386|       |
  387|  9.96k|      else
  388|  9.96k|      {
  389|  9.96k|         png_ptr->zstream_start = 1;
  390|  9.96k|      }
  391|  9.96k|# endif
  392|       |
  393|  9.96k|#endif /* ZLIB_VERNUM >= 0x1240 */
  394|       |
  395|       |      /* Set this for safety, just in case the previous owner left pointers to
  396|       |       * memory allocations.
  397|       |       */
  398|  9.96k|      png_ptr->zstream.next_in = NULL;
  399|  9.96k|      png_ptr->zstream.avail_in = 0;
  400|  9.96k|      png_ptr->zstream.next_out = NULL;
  401|  9.96k|      png_ptr->zstream.avail_out = 0;
  402|       |
  403|  9.96k|      if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
  ------------------
  |  |  705|  9.96k|#define PNG_FLAG_ZSTREAM_INITIALIZED      0x0002U /* Added to libpng-1.6.0 */
  ------------------
  |  Branch (403:11): [True: 7.30k, False: 2.66k]
  ------------------
  404|  7.30k|      {
  405|  7.30k|#if ZLIB_VERNUM >= 0x1240
  406|  7.30k|         ret = inflateReset2(&png_ptr->zstream, window_bits);
  407|       |#else
  408|       |         ret = inflateReset(&png_ptr->zstream);
  409|       |#endif
  410|  7.30k|      }
  411|       |
  412|  2.66k|      else
  413|  2.66k|      {
  414|  2.66k|#if ZLIB_VERNUM >= 0x1240
  415|  2.66k|         ret = inflateInit2(&png_ptr->zstream, window_bits);
  416|       |#else
  417|       |         ret = inflateInit(&png_ptr->zstream);
  418|       |#endif
  419|       |
  420|  2.66k|         if (ret == Z_OK)
  ------------------
  |  Branch (420:14): [True: 2.66k, False: 0]
  ------------------
  421|  2.66k|            png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
  ------------------
  |  |  705|  2.66k|#define PNG_FLAG_ZSTREAM_INITIALIZED      0x0002U /* Added to libpng-1.6.0 */
  ------------------
  422|  2.66k|      }
  423|       |
  424|       |#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
  425|       |      if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
  426|       |         /* Turn off validation of the ADLER32 checksum in IDAT chunks */
  427|       |         ret = inflateValidate(&png_ptr->zstream, 0);
  428|       |#endif
  429|       |
  430|  9.96k|      if (ret == Z_OK)
  ------------------
  |  Branch (430:11): [True: 9.96k, False: 0]
  ------------------
  431|  9.96k|         png_ptr->zowner = owner;
  432|       |
  433|      0|      else
  434|      0|         png_zstream_error(png_ptr, ret);
  435|       |
  436|  9.96k|      return ret;
  437|  9.96k|   }
  438|       |
  439|       |#ifdef window_bits
  440|       |# undef window_bits
  441|       |#endif
  442|  9.96k|}
pngrutil.c:png_inflate_read:
  775|  15.7k|{
  776|  15.7k|   if (png_ptr->zowner == png_ptr->chunk_name)
  ------------------
  |  Branch (776:8): [True: 15.7k, False: 0]
  ------------------
  777|  15.7k|   {
  778|  15.7k|      int ret;
  779|       |
  780|       |      /* next_in and avail_in must have been initialized by the caller. */
  781|  15.7k|      png_ptr->zstream.next_out = next_out;
  782|  15.7k|      png_ptr->zstream.avail_out = 0; /* set in the loop */
  783|       |
  784|  15.7k|      do
  785|  19.0k|      {
  786|  19.0k|         if (png_ptr->zstream.avail_in == 0)
  ------------------
  |  Branch (786:14): [True: 4.81k, False: 14.2k]
  ------------------
  787|  4.81k|         {
  788|  4.81k|            if (read_size > *chunk_bytes)
  ------------------
  |  Branch (788:17): [True: 4.49k, False: 317]
  ------------------
  789|  4.49k|               read_size = (uInt)*chunk_bytes;
  790|  4.81k|            *chunk_bytes -= read_size;
  791|       |
  792|  4.81k|            if (read_size > 0)
  ------------------
  |  Branch (792:17): [True: 3.34k, False: 1.46k]
  ------------------
  793|  3.34k|               png_crc_read(png_ptr, read_buffer, read_size);
  794|       |
  795|  4.81k|            png_ptr->zstream.next_in = read_buffer;
  796|  4.81k|            png_ptr->zstream.avail_in = read_size;
  797|  4.81k|         }
  798|       |
  799|  19.0k|         if (png_ptr->zstream.avail_out == 0)
  ------------------
  |  Branch (799:14): [True: 15.7k, False: 3.29k]
  ------------------
  800|  15.7k|         {
  801|  15.7k|            uInt avail = ZLIB_IO_MAX;
  ------------------
  |  |   56|  15.7k|#  define ZLIB_IO_MAX ((uInt)-1)
  ------------------
  802|  15.7k|            if (avail > *out_size)
  ------------------
  |  Branch (802:17): [True: 15.7k, False: 0]
  ------------------
  803|  15.7k|               avail = (uInt)*out_size;
  804|  15.7k|            *out_size -= avail;
  805|       |
  806|  15.7k|            png_ptr->zstream.avail_out = avail;
  807|  15.7k|         }
  808|       |
  809|       |         /* Use Z_SYNC_FLUSH when there is no more chunk data to ensure that all
  810|       |          * the available output is produced; this allows reading of truncated
  811|       |          * streams.
  812|       |          */
  813|  19.0k|         ret = PNG_INFLATE(png_ptr, *chunk_bytes > 0 ?
  ------------------
  |  | 1455|  47.5k|#  define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
  |  |  ------------------
  |  |  |  Branch (1455:55): [True: 2.92k, False: 1.77k]
  |  |  |  Branch (1455:55): [True: 14.3k, False: 4.70k]
  |  |  ------------------
  ------------------
  814|  19.0k|             Z_NO_FLUSH : (finish ? Z_FINISH : Z_SYNC_FLUSH));
  815|  19.0k|      }
  816|  19.0k|      while (ret == Z_OK && (*out_size > 0 || png_ptr->zstream.avail_out > 0));
  ------------------
  |  Branch (816:14): [True: 9.80k, False: 9.26k]
  |  Branch (816:30): [True: 0, False: 9.80k]
  |  Branch (816:47): [True: 3.28k, False: 6.52k]
  ------------------
  817|       |
  818|  15.7k|      *out_size += png_ptr->zstream.avail_out;
  819|  15.7k|      png_ptr->zstream.avail_out = 0; /* Should not be required, but is safe */
  820|       |
  821|       |      /* Ensure the error message pointer is always set: */
  822|  15.7k|      png_zstream_error(png_ptr, ret);
  823|  15.7k|      return ret;
  824|  15.7k|   }
  825|       |
  826|      0|   else
  827|      0|   {
  828|      0|      png_ptr->zstream.msg = PNGZ_MSG_CAST("zstream unclaimed");
  ------------------
  |  |   43|      0|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
  829|      0|      return Z_STREAM_ERROR;
  830|      0|   }
  831|  15.7k|}
pngrutil.c:png_read_buffer:
  299|  72.8k|{
  300|  72.8k|   png_bytep buffer = png_ptr->read_buffer;
  301|       |
  302|  72.8k|   if (buffer != NULL && new_size > png_ptr->read_buffer_size)
  ------------------
  |  Branch (302:8): [True: 64.5k, False: 8.27k]
  |  Branch (302:26): [True: 5.71k, False: 58.8k]
  ------------------
  303|  5.71k|   {
  304|  5.71k|      png_ptr->read_buffer = NULL;
  305|  5.71k|      png_ptr->read_buffer_size = 0;
  306|  5.71k|      png_free(png_ptr, buffer);
  307|  5.71k|      buffer = NULL;
  308|  5.71k|   }
  309|       |
  310|  72.8k|   if (buffer == NULL)
  ------------------
  |  Branch (310:8): [True: 13.9k, False: 58.8k]
  ------------------
  311|  13.9k|   {
  312|  13.9k|      buffer = png_voidcast(png_bytep, png_malloc_base(png_ptr, new_size));
  ------------------
  |  |  544|  13.9k|#  define png_voidcast(type, value) (value)
  ------------------
  313|       |
  314|  13.9k|      if (buffer != NULL)
  ------------------
  |  Branch (314:11): [True: 12.7k, False: 1.19k]
  ------------------
  315|  12.7k|      {
  316|  12.7k|         memset(buffer, 0, new_size); /* just in case */
  317|  12.7k|         png_ptr->read_buffer = buffer;
  318|  12.7k|         png_ptr->read_buffer_size = new_size;
  319|  12.7k|      }
  320|       |
  321|  1.19k|      else if (warn < 2) /* else silent */
  ------------------
  |  Branch (321:16): [True: 0, False: 1.19k]
  ------------------
  322|      0|      {
  323|      0|         if (warn != 0)
  ------------------
  |  Branch (323:14): [True: 0, False: 0]
  ------------------
  324|      0|             png_chunk_warning(png_ptr, "insufficient memory to read chunk");
  325|       |
  326|      0|         else
  327|      0|             png_chunk_error(png_ptr, "insufficient memory to read chunk");
  328|      0|      }
  329|  13.9k|   }
  330|       |
  331|  72.8k|   return buffer;
  332|  72.8k|}
pngrutil.c:png_decompress_chunk:
  612|  3.16k|{
  613|       |   /* TODO: implement different limits for different types of chunk.
  614|       |    *
  615|       |    * The caller supplies *newlength set to the maximum length of the
  616|       |    * uncompressed data, but this routine allocates space for the prefix and
  617|       |    * maybe a '\0' terminator too.  We have to assume that 'prefix_size' is
  618|       |    * limited only by the maximum chunk size.
  619|       |    */
  620|  3.16k|   png_alloc_size_t limit = PNG_SIZE_MAX;
  ------------------
  |  |  650|  3.16k|#define PNG_SIZE_MAX ((size_t)(-1))
  ------------------
  621|       |
  622|  3.16k|# ifdef PNG_SET_USER_LIMITS_SUPPORTED
  623|  3.16k|   if (png_ptr->user_chunk_malloc_max > 0 &&
  ------------------
  |  Branch (623:8): [True: 3.16k, False: 0]
  ------------------
  624|  3.16k|       png_ptr->user_chunk_malloc_max < limit)
  ------------------
  |  Branch (624:8): [True: 3.16k, False: 0]
  ------------------
  625|  3.16k|      limit = png_ptr->user_chunk_malloc_max;
  626|       |# elif PNG_USER_CHUNK_MALLOC_MAX > 0
  627|       |   if (PNG_USER_CHUNK_MALLOC_MAX < limit)
  628|       |      limit = PNG_USER_CHUNK_MALLOC_MAX;
  629|       |# endif
  630|       |
  631|  3.16k|   if (limit >= prefix_size + (terminate != 0))
  ------------------
  |  Branch (631:8): [True: 3.16k, False: 0]
  ------------------
  632|  3.16k|   {
  633|  3.16k|      int ret;
  634|       |
  635|  3.16k|      limit -= prefix_size + (terminate != 0);
  636|       |
  637|  3.16k|      if (limit < *newlength)
  ------------------
  |  Branch (637:11): [True: 3.16k, False: 0]
  ------------------
  638|  3.16k|         *newlength = limit;
  639|       |
  640|       |      /* Now try to claim the stream. */
  641|  3.16k|      ret = png_inflate_claim(png_ptr, png_ptr->chunk_name);
  642|       |
  643|  3.16k|      if (ret == Z_OK)
  ------------------
  |  Branch (643:11): [True: 3.16k, False: 0]
  ------------------
  644|  3.16k|      {
  645|  3.16k|         png_uint_32 lzsize = chunklength - prefix_size;
  646|       |
  647|  3.16k|         ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
  648|  3.16k|             /* input: */ png_ptr->read_buffer + prefix_size, &lzsize,
  649|       |             /* output: */ NULL, newlength);
  650|       |
  651|  3.16k|         if (ret == Z_STREAM_END)
  ------------------
  |  Branch (651:14): [True: 1.91k, False: 1.25k]
  ------------------
  652|  1.91k|         {
  653|       |            /* Use 'inflateReset' here, not 'inflateReset2' because this
  654|       |             * preserves the previously decided window size (otherwise it would
  655|       |             * be necessary to store the previous window size.)  In practice
  656|       |             * this doesn't matter anyway, because png_inflate will call inflate
  657|       |             * with Z_FINISH in almost all cases, so the window will not be
  658|       |             * maintained.
  659|       |             */
  660|  1.91k|            if (inflateReset(&png_ptr->zstream) == Z_OK)
  ------------------
  |  Branch (660:17): [True: 1.91k, False: 0]
  ------------------
  661|  1.91k|            {
  662|       |               /* Because of the limit checks above we know that the new,
  663|       |                * expanded, size will fit in a size_t (let alone an
  664|       |                * png_alloc_size_t).  Use png_malloc_base here to avoid an
  665|       |                * extra OOM message.
  666|       |                */
  667|  1.91k|               png_alloc_size_t new_size = *newlength;
  668|  1.91k|               png_alloc_size_t buffer_size = prefix_size + new_size +
  669|  1.91k|                   (terminate != 0);
  670|  1.91k|               png_bytep text = png_voidcast(png_bytep, png_malloc_base(png_ptr,
  ------------------
  |  |  544|  1.91k|#  define png_voidcast(type, value) (value)
  ------------------
  671|  1.91k|                   buffer_size));
  672|       |
  673|  1.91k|               if (text != NULL)
  ------------------
  |  Branch (673:20): [True: 1.91k, False: 0]
  ------------------
  674|  1.91k|               {
  675|  1.91k|                  memset(text, 0, buffer_size);
  676|       |
  677|  1.91k|                  ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
  678|  1.91k|                      png_ptr->read_buffer + prefix_size, &lzsize,
  679|  1.91k|                      text + prefix_size, newlength);
  680|       |
  681|  1.91k|                  if (ret == Z_STREAM_END)
  ------------------
  |  Branch (681:23): [True: 1.91k, False: 0]
  ------------------
  682|  1.91k|                  {
  683|  1.91k|                     if (new_size == *newlength)
  ------------------
  |  Branch (683:26): [True: 1.91k, False: 0]
  ------------------
  684|  1.91k|                     {
  685|  1.91k|                        if (terminate != 0)
  ------------------
  |  Branch (685:29): [True: 1.91k, False: 0]
  ------------------
  686|  1.91k|                           text[prefix_size + *newlength] = 0;
  687|       |
  688|  1.91k|                        if (prefix_size > 0)
  ------------------
  |  Branch (688:29): [True: 1.91k, False: 0]
  ------------------
  689|  1.91k|                           memcpy(text, png_ptr->read_buffer, prefix_size);
  690|       |
  691|  1.91k|                        {
  692|  1.91k|                           png_bytep old_ptr = png_ptr->read_buffer;
  693|       |
  694|  1.91k|                           png_ptr->read_buffer = text;
  695|  1.91k|                           png_ptr->read_buffer_size = buffer_size;
  696|  1.91k|                           text = old_ptr; /* freed below */
  697|  1.91k|                        }
  698|  1.91k|                     }
  699|       |
  700|      0|                     else
  701|      0|                     {
  702|       |                        /* The size changed on the second read, there can be no
  703|       |                         * guarantee that anything is correct at this point.
  704|       |                         * The 'msg' pointer has been set to "unexpected end of
  705|       |                         * LZ stream", which is fine, but return an error code
  706|       |                         * that the caller won't accept.
  707|       |                         */
  708|      0|                        ret = PNG_UNEXPECTED_ZLIB_RETURN;
  ------------------
  |  |  998|      0|#define PNG_UNEXPECTED_ZLIB_RETURN (-7)
  ------------------
  709|      0|                     }
  710|  1.91k|                  }
  711|       |
  712|      0|                  else if (ret == Z_OK)
  ------------------
  |  Branch (712:28): [True: 0, False: 0]
  ------------------
  713|      0|                     ret = PNG_UNEXPECTED_ZLIB_RETURN; /* for safety */
  ------------------
  |  |  998|      0|#define PNG_UNEXPECTED_ZLIB_RETURN (-7)
  ------------------
  714|       |
  715|       |                  /* Free the text pointer (this is the old read_buffer on
  716|       |                   * success)
  717|       |                   */
  718|  1.91k|                  png_free(png_ptr, text);
  719|       |
  720|       |                  /* This really is very benign, but it's still an error because
  721|       |                   * the extra space may otherwise be used as a Trojan Horse.
  722|       |                   */
  723|  1.91k|                  if (ret == Z_STREAM_END &&
  ------------------
  |  Branch (723:23): [True: 1.91k, False: 0]
  ------------------
  724|  1.91k|                      chunklength - prefix_size != lzsize)
  ------------------
  |  Branch (724:23): [True: 1.13k, False: 777]
  ------------------
  725|  1.13k|                     png_chunk_benign_error(png_ptr, "extra compressed data");
  726|  1.91k|               }
  727|       |
  728|      0|               else
  729|      0|               {
  730|       |                  /* Out of memory allocating the buffer */
  731|      0|                  ret = Z_MEM_ERROR;
  732|      0|                  png_zstream_error(png_ptr, Z_MEM_ERROR);
  733|      0|               }
  734|  1.91k|            }
  735|       |
  736|      0|            else
  737|      0|            {
  738|       |               /* inflateReset failed, store the error message */
  739|      0|               png_zstream_error(png_ptr, ret);
  740|      0|               ret = PNG_UNEXPECTED_ZLIB_RETURN;
  ------------------
  |  |  998|      0|#define PNG_UNEXPECTED_ZLIB_RETURN (-7)
  ------------------
  741|      0|            }
  742|  1.91k|         }
  743|       |
  744|  1.25k|         else if (ret == Z_OK)
  ------------------
  |  Branch (744:19): [True: 0, False: 1.25k]
  ------------------
  745|      0|            ret = PNG_UNEXPECTED_ZLIB_RETURN;
  ------------------
  |  |  998|      0|#define PNG_UNEXPECTED_ZLIB_RETURN (-7)
  ------------------
  746|       |
  747|       |         /* Release the claimed stream */
  748|  3.16k|         png_ptr->zowner = 0;
  749|  3.16k|      }
  750|       |
  751|      0|      else /* the claim failed */ if (ret == Z_STREAM_END) /* impossible! */
  ------------------
  |  Branch (751:39): [True: 0, False: 0]
  ------------------
  752|      0|         ret = PNG_UNEXPECTED_ZLIB_RETURN;
  ------------------
  |  |  998|      0|#define PNG_UNEXPECTED_ZLIB_RETURN (-7)
  ------------------
  753|       |
  754|  3.16k|      return ret;
  755|  3.16k|   }
  756|       |
  757|      0|   else
  758|      0|   {
  759|       |      /* Application/configuration limits exceeded */
  760|      0|      png_zstream_error(png_ptr, Z_MEM_ERROR);
  761|      0|      return Z_MEM_ERROR;
  762|      0|   }
  763|  3.16k|}
pngrutil.c:png_inflate:
  486|  5.07k|{
  487|  5.07k|   if (png_ptr->zowner == owner) /* Else not claimed */
  ------------------
  |  Branch (487:8): [True: 5.07k, False: 0]
  ------------------
  488|  5.07k|   {
  489|  5.07k|      int ret;
  490|  5.07k|      png_alloc_size_t avail_out = *output_size_ptr;
  491|  5.07k|      png_uint_32 avail_in = *input_size_ptr;
  492|       |
  493|       |      /* zlib can't necessarily handle more than 65535 bytes at once (i.e. it
  494|       |       * can't even necessarily handle 65536 bytes) because the type uInt is
  495|       |       * "16 bits or more".  Consequently it is necessary to chunk the input to
  496|       |       * zlib.  This code uses ZLIB_IO_MAX, from pngpriv.h, as the maximum (the
  497|       |       * maximum value that can be stored in a uInt.)  It is possible to set
  498|       |       * ZLIB_IO_MAX to a lower value in pngpriv.h and this may sometimes have
  499|       |       * a performance advantage, because it reduces the amount of data accessed
  500|       |       * at each step and that may give the OS more time to page it in.
  501|       |       */
  502|  5.07k|      png_ptr->zstream.next_in = PNGZ_INPUT_CAST(input);
  ------------------
  |  |   44|  5.07k|#  define PNGZ_INPUT_CAST(b) (b)
  ------------------
  503|       |      /* avail_in and avail_out are set below from 'size' */
  504|  5.07k|      png_ptr->zstream.avail_in = 0;
  505|  5.07k|      png_ptr->zstream.avail_out = 0;
  506|       |
  507|       |      /* Read directly into the output if it is available (this is set to
  508|       |       * a local buffer below if output is NULL).
  509|       |       */
  510|  5.07k|      if (output != NULL)
  ------------------
  |  Branch (510:11): [True: 1.91k, False: 3.16k]
  ------------------
  511|  1.91k|         png_ptr->zstream.next_out = output;
  512|       |
  513|  5.07k|      do
  514|  27.0k|      {
  515|  27.0k|         uInt avail;
  516|  27.0k|         Byte local_buffer[PNG_INFLATE_BUF_SIZE];
  517|       |
  518|       |         /* zlib INPUT BUFFER */
  519|       |         /* The setting of 'avail_in' used to be outside the loop; by setting it
  520|       |          * inside it is possible to chunk the input to zlib and simply rely on
  521|       |          * zlib to advance the 'next_in' pointer.  This allows arbitrary
  522|       |          * amounts of data to be passed through zlib at the unavoidable cost of
  523|       |          * requiring a window save (memcpy of up to 32768 output bytes)
  524|       |          * every ZLIB_IO_MAX input bytes.
  525|       |          */
  526|  27.0k|         avail_in += png_ptr->zstream.avail_in; /* not consumed last time */
  527|       |
  528|  27.0k|         avail = ZLIB_IO_MAX;
  ------------------
  |  |   56|  27.0k|#  define ZLIB_IO_MAX ((uInt)-1)
  ------------------
  529|       |
  530|  27.0k|         if (avail_in < avail)
  ------------------
  |  Branch (530:14): [True: 27.0k, False: 0]
  ------------------
  531|  27.0k|            avail = (uInt)avail_in; /* safe: < than ZLIB_IO_MAX */
  532|       |
  533|  27.0k|         avail_in -= avail;
  534|  27.0k|         png_ptr->zstream.avail_in = avail;
  535|       |
  536|       |         /* zlib OUTPUT BUFFER */
  537|  27.0k|         avail_out += png_ptr->zstream.avail_out; /* not written last time */
  538|       |
  539|  27.0k|         avail = ZLIB_IO_MAX; /* maximum zlib can process */
  ------------------
  |  |   56|  27.0k|#  define ZLIB_IO_MAX ((uInt)-1)
  ------------------
  540|       |
  541|  27.0k|         if (output == NULL)
  ------------------
  |  Branch (541:14): [True: 25.1k, False: 1.91k]
  ------------------
  542|  25.1k|         {
  543|       |            /* Reset the output buffer each time round if output is NULL and
  544|       |             * make available the full buffer, up to 'remaining_space'
  545|       |             */
  546|  25.1k|            png_ptr->zstream.next_out = local_buffer;
  547|  25.1k|            if ((sizeof local_buffer) < avail)
  ------------------
  |  Branch (547:17): [True: 25.1k, False: 0]
  ------------------
  548|  25.1k|               avail = (sizeof local_buffer);
  549|  25.1k|         }
  550|       |
  551|  27.0k|         if (avail_out < avail)
  ------------------
  |  Branch (551:14): [True: 1.91k, False: 25.1k]
  ------------------
  552|  1.91k|            avail = (uInt)avail_out; /* safe: < ZLIB_IO_MAX */
  553|       |
  554|  27.0k|         png_ptr->zstream.avail_out = avail;
  555|  27.0k|         avail_out -= avail;
  556|       |
  557|       |         /* zlib inflate call */
  558|       |         /* In fact 'avail_out' may be 0 at this point, that happens at the end
  559|       |          * of the read when the final LZ end code was not passed at the end of
  560|       |          * the previous chunk of input data.  Tell zlib if we have reached the
  561|       |          * end of the output buffer.
  562|       |          */
  563|  27.0k|         ret = PNG_INFLATE(png_ptr, avail_out > 0 ? Z_NO_FLUSH :
  ------------------
  |  | 1455|  57.8k|#  define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
  |  |  ------------------
  |  |  |  Branch (1455:55): [True: 1.91k, False: 0]
  |  |  |  Branch (1455:55): [True: 25.1k, False: 1.91k]
  |  |  ------------------
  ------------------
  564|  27.0k|             (finish ? Z_FINISH : Z_SYNC_FLUSH));
  565|  27.0k|      } while (ret == Z_OK);
  ------------------
  |  Branch (565:16): [True: 21.9k, False: 5.07k]
  ------------------
  566|       |
  567|       |      /* For safety kill the local buffer pointer now */
  568|  5.07k|      if (output == NULL)
  ------------------
  |  Branch (568:11): [True: 3.16k, False: 1.91k]
  ------------------
  569|  3.16k|         png_ptr->zstream.next_out = NULL;
  570|       |
  571|       |      /* Claw back the 'size' and 'remaining_space' byte counts. */
  572|  5.07k|      avail_in += png_ptr->zstream.avail_in;
  573|  5.07k|      avail_out += png_ptr->zstream.avail_out;
  574|       |
  575|       |      /* Update the input and output sizes; the updated values are the amount
  576|       |       * consumed or written, effectively the inverse of what zlib uses.
  577|       |       */
  578|  5.07k|      if (avail_out > 0)
  ------------------
  |  Branch (578:11): [True: 3.16k, False: 1.91k]
  ------------------
  579|  3.16k|         *output_size_ptr -= avail_out;
  580|       |
  581|  5.07k|      if (avail_in > 0)
  ------------------
  |  Branch (581:11): [True: 1.47k, False: 3.60k]
  ------------------
  582|  1.47k|         *input_size_ptr -= avail_in;
  583|       |
  584|       |      /* Ensure png_ptr->zstream.msg is set (even in the success case!) */
  585|  5.07k|      png_zstream_error(png_ptr, ret);
  586|  5.07k|      return ret;
  587|  5.07k|   }
  588|       |
  589|      0|   else
  590|      0|   {
  591|       |      /* This is a bad internal error.  The recovery assigns to the zstream msg
  592|       |       * pointer, which is not owned by the caller, but this is safe; it's only
  593|       |       * used on errors!
  594|       |       */
  595|      0|      png_ptr->zstream.msg = PNGZ_MSG_CAST("zstream unclaimed");
  ------------------
  |  |   43|      0|#  define PNGZ_MSG_CAST(s) (s)
  ------------------
  596|      0|      return Z_STREAM_ERROR;
  597|      0|   }
  598|  5.07k|}
pngrutil.c:png_init_filter_functions:
 4104|    315|{
 4105|    315|   unsigned int bpp = (pp->pixel_depth + 7) >> 3;
 4106|       |
 4107|    315|   pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub;
  ------------------
  |  | 1476|    315|#define PNG_FILTER_VALUE_SUB   1
  ------------------
 4108|    315|   pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up;
  ------------------
  |  | 1477|    315|#define PNG_FILTER_VALUE_UP    2
  ------------------
 4109|    315|   pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg;
  ------------------
  |  | 1478|    315|#define PNG_FILTER_VALUE_AVG   3
  ------------------
 4110|    315|   if (bpp == 1)
  ------------------
  |  Branch (4110:8): [True: 107, False: 208]
  ------------------
 4111|    107|      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
  ------------------
  |  | 1479|    107|#define PNG_FILTER_VALUE_PAETH 4
  ------------------
 4112|    107|         png_read_filter_row_paeth_1byte_pixel;
 4113|    208|   else
 4114|    208|      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
  ------------------
  |  | 1479|    208|#define PNG_FILTER_VALUE_PAETH 4
  ------------------
 4115|    208|         png_read_filter_row_paeth_multibyte_pixel;
 4116|       |
 4117|    315|#ifdef PNG_FILTER_OPTIMIZATIONS
 4118|       |   /* To use this define PNG_FILTER_OPTIMIZATIONS as the name of a function to
 4119|       |    * call to install hardware optimizations for the above functions; simply
 4120|       |    * replace whatever elements of the pp->read_filter[] array with a hardware
 4121|       |    * specific (or, for that matter, generic) optimization.
 4122|       |    *
 4123|       |    * To see an example of this examine what configure.ac does when
 4124|       |    * --enable-arm-neon is specified on the command line.
 4125|       |    */
 4126|    315|   PNG_FILTER_OPTIMIZATIONS(pp, bpp);
  ------------------
  |  |  266|    315|#      define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
  ------------------
 4127|    315|#endif
 4128|    315|}
pngrutil.c:png_read_filter_row_sub:
 3933|  9.99k|{
 3934|  9.99k|   size_t i;
 3935|  9.99k|   size_t istop = row_info->rowbytes;
 3936|  9.99k|   unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
 3937|  9.99k|   png_bytep rp = row + bpp;
 3938|       |
 3939|  9.99k|   PNG_UNUSED(prev_row)
  ------------------
  |  |  488|  9.99k|#  define PNG_UNUSED(param) (void)param;
  ------------------
 3940|       |
 3941|   662k|   for (i = bpp; i < istop; i++)
  ------------------
  |  Branch (3941:18): [True: 652k, False: 9.99k]
  ------------------
 3942|   652k|   {
 3943|   652k|      *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff);
 3944|   652k|      rp++;
 3945|   652k|   }
 3946|  9.99k|}
pngrutil.c:png_read_filter_row_up:
 3951|  4.77k|{
 3952|  4.77k|   size_t i;
 3953|  4.77k|   size_t istop = row_info->rowbytes;
 3954|  4.77k|   png_bytep rp = row;
 3955|  4.77k|   png_const_bytep pp = prev_row;
 3956|       |
 3957|  7.11M|   for (i = 0; i < istop; i++)
  ------------------
  |  Branch (3957:16): [True: 7.11M, False: 4.77k]
  ------------------
 3958|  7.11M|   {
 3959|  7.11M|      *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
 3960|  7.11M|      rp++;
 3961|  7.11M|   }
 3962|  4.77k|}
pngrutil.c:png_read_filter_row_avg:
 3967|    996|{
 3968|    996|   size_t i;
 3969|    996|   png_bytep rp = row;
 3970|    996|   png_const_bytep pp = prev_row;
 3971|    996|   unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
 3972|    996|   size_t istop = row_info->rowbytes - bpp;
 3973|       |
 3974|  2.59k|   for (i = 0; i < bpp; i++)
  ------------------
  |  Branch (3974:16): [True: 1.59k, False: 996]
  ------------------
 3975|  1.59k|   {
 3976|  1.59k|      *rp = (png_byte)(((int)(*rp) +
 3977|  1.59k|         ((int)(*pp++) / 2 )) & 0xff);
 3978|       |
 3979|  1.59k|      rp++;
 3980|  1.59k|   }
 3981|       |
 3982|   349k|   for (i = 0; i < istop; i++)
  ------------------
  |  Branch (3982:16): [True: 348k, False: 996]
  ------------------
 3983|   348k|   {
 3984|   348k|      *rp = (png_byte)(((int)(*rp) +
 3985|   348k|         (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);
 3986|       |
 3987|   348k|      rp++;
 3988|   348k|   }
 3989|    996|}
pngrutil.c:png_read_filter_row_paeth_1byte_pixel:
 3994|    360|{
 3995|    360|   png_bytep rp_end = row + row_info->rowbytes;
 3996|    360|   int a, c;
 3997|       |
 3998|       |   /* First pixel/byte */
 3999|    360|   c = *prev_row++;
 4000|    360|   a = *row + c;
 4001|    360|   *row++ = (png_byte)a;
 4002|       |
 4003|       |   /* Remainder */
 4004|  63.0k|   while (row < rp_end)
  ------------------
  |  Branch (4004:11): [True: 62.7k, False: 360]
  ------------------
 4005|  62.7k|   {
 4006|  62.7k|      int b, pa, pb, pc, p;
 4007|       |
 4008|  62.7k|      a &= 0xff; /* From previous iteration or start */
 4009|  62.7k|      b = *prev_row++;
 4010|       |
 4011|  62.7k|      p = b - c;
 4012|  62.7k|      pc = a - c;
 4013|       |
 4014|       |#ifdef PNG_USE_ABS
 4015|       |      pa = abs(p);
 4016|       |      pb = abs(pc);
 4017|       |      pc = abs(p + pc);
 4018|       |#else
 4019|  62.7k|      pa = p < 0 ? -p : p;
  ------------------
  |  Branch (4019:12): [True: 256, False: 62.4k]
  ------------------
 4020|  62.7k|      pb = pc < 0 ? -pc : pc;
  ------------------
  |  Branch (4020:12): [True: 73, False: 62.6k]
  ------------------
 4021|  62.7k|      pc = (p + pc) < 0 ? -(p + pc) : p + pc;
  ------------------
  |  Branch (4021:12): [True: 140, False: 62.5k]
  ------------------
 4022|  62.7k|#endif
 4023|       |
 4024|       |      /* Find the best predictor, the least of pa, pb, pc favoring the earlier
 4025|       |       * ones in the case of a tie.
 4026|       |       */
 4027|  62.7k|      if (pb < pa)
  ------------------
  |  Branch (4027:11): [True: 239, False: 62.4k]
  ------------------
 4028|    239|      {
 4029|    239|         pa = pb; a = b;
 4030|    239|      }
 4031|  62.7k|      if (pc < pa) a = c;
  ------------------
  |  Branch (4031:11): [True: 45, False: 62.6k]
  ------------------
 4032|       |
 4033|       |      /* Calculate the current pixel in a, and move the previous row pixel to c
 4034|       |       * for the next time round the loop
 4035|       |       */
 4036|  62.7k|      c = b;
 4037|  62.7k|      a += *row;
 4038|  62.7k|      *row++ = (png_byte)a;
 4039|  62.7k|   }
 4040|    360|}
pngrutil.c:png_read_filter_row_paeth_multibyte_pixel:
 4045|  1.12k|{
 4046|  1.12k|   unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
 4047|  1.12k|   png_bytep rp_end = row + bpp;
 4048|       |
 4049|       |   /* Process the first pixel in the row completely (this is the same as 'up'
 4050|       |    * because there is only one candidate predictor for the first row).
 4051|       |    */
 4052|  6.82k|   while (row < rp_end)
  ------------------
  |  Branch (4052:11): [True: 5.69k, False: 1.12k]
  ------------------
 4053|  5.69k|   {
 4054|  5.69k|      int a = *row + *prev_row++;
 4055|  5.69k|      *row++ = (png_byte)a;
 4056|  5.69k|   }
 4057|       |
 4058|       |   /* Remainder */
 4059|  1.12k|   rp_end = rp_end + (row_info->rowbytes - bpp);
 4060|       |
 4061|   452k|   while (row < rp_end)
  ------------------
  |  Branch (4061:11): [True: 450k, False: 1.12k]
  ------------------
 4062|   450k|   {
 4063|   450k|      int a, b, c, pa, pb, pc, p;
 4064|       |
 4065|   450k|      c = *(prev_row - bpp);
 4066|   450k|      a = *(row - bpp);
 4067|   450k|      b = *prev_row++;
 4068|       |
 4069|   450k|      p = b - c;
 4070|   450k|      pc = a - c;
 4071|       |
 4072|       |#ifdef PNG_USE_ABS
 4073|       |      pa = abs(p);
 4074|       |      pb = abs(pc);
 4075|       |      pc = abs(p + pc);
 4076|       |#else
 4077|   450k|      pa = p < 0 ? -p : p;
  ------------------
  |  Branch (4077:12): [True: 18.3k, False: 432k]
  ------------------
 4078|   450k|      pb = pc < 0 ? -pc : pc;
  ------------------
  |  Branch (4078:12): [True: 11.1k, False: 439k]
  ------------------
 4079|   450k|      pc = (p + pc) < 0 ? -(p + pc) : p + pc;
  ------------------
  |  Branch (4079:12): [True: 20.6k, False: 430k]
  ------------------
 4080|   450k|#endif
 4081|       |
 4082|   450k|      if (pb < pa)
  ------------------
  |  Branch (4082:11): [True: 33.6k, False: 417k]
  ------------------
 4083|  33.6k|      {
 4084|  33.6k|         pa = pb; a = b;
 4085|  33.6k|      }
 4086|   450k|      if (pc < pa) a = c;
  ------------------
  |  Branch (4086:11): [True: 836, False: 450k]
  ------------------
 4087|       |
 4088|   450k|      a += *row;
 4089|   450k|      *row++ = (png_byte)a;
 4090|   450k|   }
 4091|  1.12k|}

png_set_bKGD:
   27|     56|{
   28|     56|   png_debug1(1, "in %s storage function", "bKGD");
  ------------------
  |  |  148|     56|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
   29|       |
   30|     56|   if (png_ptr == NULL || info_ptr == NULL || background == NULL)
  ------------------
  |  Branch (30:8): [True: 0, False: 56]
  |  Branch (30:27): [True: 0, False: 56]
  |  Branch (30:47): [True: 0, False: 56]
  ------------------
   31|      0|      return;
   32|       |
   33|     56|   info_ptr->background = *background;
   34|     56|   info_ptr->valid |= PNG_INFO_bKGD;
  ------------------
  |  |  736|     56|#define PNG_INFO_bKGD 0x0020U
  ------------------
   35|     56|}
png_set_eXIf_1:
  150|      8|{
  151|      8|   png_bytep new_exif;
  152|       |
  153|      8|   png_debug1(1, "in %s storage function", "eXIf");
  ------------------
  |  |  148|      8|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  154|       |
  155|      8|   if (png_ptr == NULL || info_ptr == NULL ||
  ------------------
  |  Branch (155:8): [True: 0, False: 8]
  |  Branch (155:27): [True: 0, False: 8]
  ------------------
  156|      8|       (png_ptr->mode & PNG_WROTE_eXIf) != 0)
  ------------------
  |  |  663|      8|#define PNG_WROTE_eXIf            0x4000U
  ------------------
  |  Branch (156:8): [True: 0, False: 8]
  ------------------
  157|      0|      return;
  158|       |
  159|      8|   new_exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr, num_exif));
  ------------------
  |  |  544|      8|#  define png_voidcast(type, value) (value)
  ------------------
  160|       |
  161|      8|   if (new_exif == NULL)
  ------------------
  |  Branch (161:8): [True: 0, False: 8]
  ------------------
  162|      0|   {
  163|      0|      png_warning(png_ptr, "Insufficient memory for eXIf chunk data");
  164|      0|      return;
  165|      0|   }
  166|       |
  167|      8|   memcpy(new_exif, exif, (size_t)num_exif);
  168|       |
  169|      8|   png_free_data(png_ptr, info_ptr, PNG_FREE_EXIF, 0);
  ------------------
  |  | 1757|      8|#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */
  ------------------
  170|       |
  171|      8|   info_ptr->num_exif = num_exif;
  172|      8|   info_ptr->exif = new_exif;
  173|      8|   info_ptr->free_me |= PNG_FREE_EXIF;
  ------------------
  |  | 1757|      8|#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */
  ------------------
  174|      8|   info_ptr->valid |= PNG_INFO_eXIf;
  ------------------
  |  |  747|      8|#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
  ------------------
  175|      8|}
png_set_hIST:
  206|    216|{
  207|    216|   int i;
  208|       |
  209|    216|   png_debug1(1, "in %s storage function", "hIST");
  ------------------
  |  |  148|    216|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  210|       |
  211|    216|   if (png_ptr == NULL || info_ptr == NULL)
  ------------------
  |  Branch (211:8): [True: 0, False: 216]
  |  Branch (211:27): [True: 0, False: 216]
  ------------------
  212|      0|      return;
  213|       |
  214|    216|   if (info_ptr->num_palette == 0 || info_ptr->num_palette
  ------------------
  |  Branch (214:8): [True: 204, False: 12]
  |  Branch (214:38): [True: 0, False: 12]
  ------------------
  215|     12|       > PNG_MAX_PALETTE_LENGTH)
  ------------------
  |  |  724|     12|#define PNG_MAX_PALETTE_LENGTH    256
  ------------------
  216|    204|   {
  217|    204|      png_warning(png_ptr,
  218|    204|          "Invalid palette size, hIST allocation skipped");
  219|       |
  220|    204|      return;
  221|    204|   }
  222|       |
  223|     12|   png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
  ------------------
  |  | 1744|     12|#define PNG_FREE_HIST 0x0008U
  ------------------
  224|       |
  225|       |   /* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in
  226|       |    * version 1.2.1
  227|       |    */
  228|     12|   info_ptr->hist = png_voidcast(png_uint_16p, png_malloc_warn(png_ptr,
  ------------------
  |  |  544|     12|#  define png_voidcast(type, value) (value)
  ------------------
  229|     12|       PNG_MAX_PALETTE_LENGTH * (sizeof (png_uint_16))));
  230|       |
  231|     12|   if (info_ptr->hist == NULL)
  ------------------
  |  Branch (231:8): [True: 0, False: 12]
  ------------------
  232|      0|   {
  233|      0|      png_warning(png_ptr, "Insufficient memory for hIST chunk data");
  234|      0|      return;
  235|      0|   }
  236|       |
  237|    154|   for (i = 0; i < info_ptr->num_palette; i++)
  ------------------
  |  Branch (237:16): [True: 142, False: 12]
  ------------------
  238|    142|      info_ptr->hist[i] = hist[i];
  239|       |
  240|     12|   info_ptr->free_me |= PNG_FREE_HIST;
  ------------------
  |  | 1744|     12|#define PNG_FREE_HIST 0x0008U
  ------------------
  241|     12|   info_ptr->valid |= PNG_INFO_hIST;
  ------------------
  |  |  737|     12|#define PNG_INFO_hIST 0x0040U
  ------------------
  242|     12|}
png_set_IHDR:
  250|  4.71k|{
  251|  4.71k|   png_debug1(1, "in %s storage function", "IHDR");
  ------------------
  |  |  148|  4.71k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  252|       |
  253|  4.71k|   if (png_ptr == NULL || info_ptr == NULL)
  ------------------
  |  Branch (253:8): [True: 0, False: 4.71k]
  |  Branch (253:27): [True: 0, False: 4.71k]
  ------------------
  254|      0|      return;
  255|       |
  256|  4.71k|   info_ptr->width = width;
  257|  4.71k|   info_ptr->height = height;
  258|  4.71k|   info_ptr->bit_depth = (png_byte)bit_depth;
  259|  4.71k|   info_ptr->color_type = (png_byte)color_type;
  260|  4.71k|   info_ptr->compression_type = (png_byte)compression_type;
  261|  4.71k|   info_ptr->filter_type = (png_byte)filter_type;
  262|  4.71k|   info_ptr->interlace_type = (png_byte)interlace_type;
  263|       |
  264|  4.71k|   png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height,
  265|  4.71k|       info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
  266|  4.71k|       info_ptr->compression_type, info_ptr->filter_type);
  267|       |
  268|  4.71k|   if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|  4.71k|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|  4.71k|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|  4.71k|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (268:8): [True: 1.24k, False: 3.46k]
  ------------------
  269|  1.24k|      info_ptr->channels = 1;
  270|       |
  271|  3.46k|   else if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
  ------------------
  |  |  663|  3.46k|#define PNG_COLOR_MASK_COLOR      2
  ------------------
  |  Branch (271:13): [True: 2.00k, False: 1.46k]
  ------------------
  272|  2.00k|      info_ptr->channels = 3;
  273|       |
  274|  1.46k|   else
  275|  1.46k|      info_ptr->channels = 1;
  276|       |
  277|  4.71k|   if ((info_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)
  ------------------
  |  |  664|  4.71k|#define PNG_COLOR_MASK_ALPHA      4
  ------------------
  |  Branch (277:8): [True: 437, False: 4.27k]
  ------------------
  278|    437|      info_ptr->channels++;
  279|       |
  280|  4.71k|   info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
  281|       |
  282|  4.71k|   info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
  ------------------
  |  |  764|  4.71k|    ((pixel_bits) >= 8 ? \
  |  |  ------------------
  |  |  |  Branch (764:6): [True: 2.98k, False: 1.72k]
  |  |  ------------------
  |  |  765|  4.71k|    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
  |  |  766|  4.71k|    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
  ------------------
  283|  4.71k|}
png_set_oFFs:
  289|      7|{
  290|      7|   png_debug1(1, "in %s storage function", "oFFs");
  ------------------
  |  |  148|      7|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  291|       |
  292|      7|   if (png_ptr == NULL || info_ptr == NULL)
  ------------------
  |  Branch (292:8): [True: 0, False: 7]
  |  Branch (292:27): [True: 0, False: 7]
  ------------------
  293|      0|      return;
  294|       |
  295|      7|   info_ptr->x_offset = offset_x;
  296|      7|   info_ptr->y_offset = offset_y;
  297|      7|   info_ptr->offset_unit_type = (png_byte)unit_type;
  298|      7|   info_ptr->valid |= PNG_INFO_oFFs;
  ------------------
  |  |  739|      7|#define PNG_INFO_oFFs 0x0100U
  ------------------
  299|      7|}
png_set_pCAL:
  307|    735|{
  308|    735|   size_t length;
  309|    735|   int i;
  310|       |
  311|    735|   png_debug1(1, "in %s storage function", "pCAL");
  ------------------
  |  |  148|    735|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  312|       |
  313|    735|   if (png_ptr == NULL || info_ptr == NULL || purpose == NULL || units == NULL
  ------------------
  |  Branch (313:8): [True: 0, False: 735]
  |  Branch (313:27): [True: 0, False: 735]
  |  Branch (313:47): [True: 0, False: 735]
  |  Branch (313:66): [True: 0, False: 735]
  ------------------
  314|    735|       || (nparams > 0 && params == NULL))
  ------------------
  |  Branch (314:12): [True: 735, False: 0]
  |  Branch (314:27): [True: 0, False: 735]
  ------------------
  315|      0|      return;
  316|       |
  317|    735|   length = strlen(purpose) + 1;
  318|    735|   png_debug1(3, "allocating purpose for info (%lu bytes)",
  ------------------
  |  |  148|    735|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  319|    735|       (unsigned long)length);
  320|       |
  321|       |   /* TODO: validate format of calibration name and unit name */
  322|       |
  323|       |   /* Check that the type matches the specification. */
  324|    735|   if (type < 0 || type > 3)
  ------------------
  |  Branch (324:8): [True: 0, False: 735]
  |  Branch (324:20): [True: 211, False: 524]
  ------------------
  325|    211|   {
  326|    211|      png_chunk_report(png_ptr, "Invalid pCAL equation type",
  327|    211|            PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|    211|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
  328|    211|      return;
  329|    211|   }
  330|       |
  331|    524|   if (nparams < 0 || nparams > 255)
  ------------------
  |  Branch (331:8): [True: 0, False: 524]
  |  Branch (331:23): [True: 0, False: 524]
  ------------------
  332|      0|   {
  333|      0|      png_chunk_report(png_ptr, "Invalid pCAL parameter count",
  334|      0|            PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|      0|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
  335|      0|      return;
  336|      0|   }
  337|       |
  338|       |   /* Validate params[nparams] */
  339|  1.28k|   for (i=0; i<nparams; ++i)
  ------------------
  |  Branch (339:14): [True: 1.27k, False: 14]
  ------------------
  340|  1.27k|   {
  341|  1.27k|      if (params[i] == NULL ||
  ------------------
  |  Branch (341:11): [True: 0, False: 1.27k]
  ------------------
  342|  1.27k|          !png_check_fp_string(params[i], strlen(params[i])))
  ------------------
  |  Branch (342:11): [True: 510, False: 765]
  ------------------
  343|    510|      {
  344|    510|         png_chunk_report(png_ptr, "Invalid format for pCAL parameter",
  345|    510|               PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|    510|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
  346|    510|         return;
  347|    510|      }
  348|  1.27k|   }
  349|       |
  350|     14|   info_ptr->pcal_purpose = png_voidcast(png_charp,
  ------------------
  |  |  544|     14|#  define png_voidcast(type, value) (value)
  ------------------
  351|     14|       png_malloc_warn(png_ptr, length));
  352|       |
  353|     14|   if (info_ptr->pcal_purpose == NULL)
  ------------------
  |  Branch (353:8): [True: 0, False: 14]
  ------------------
  354|      0|   {
  355|      0|      png_chunk_report(png_ptr, "Insufficient memory for pCAL purpose",
  356|      0|            PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|      0|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
  357|      0|      return;
  358|      0|   }
  359|       |
  360|     14|   memcpy(info_ptr->pcal_purpose, purpose, length);
  361|       |
  362|     14|   info_ptr->free_me |= PNG_FREE_PCAL;
  ------------------
  |  | 1748|     14|#define PNG_FREE_PCAL 0x0080U
  ------------------
  363|       |
  364|     14|   png_debug(3, "storing X0, X1, type, and nparams in info");
  ------------------
  |  |  145|     14|#  define png_debug(l, m) ((void)0)
  ------------------
  365|     14|   info_ptr->pcal_X0 = X0;
  366|     14|   info_ptr->pcal_X1 = X1;
  367|     14|   info_ptr->pcal_type = (png_byte)type;
  368|     14|   info_ptr->pcal_nparams = (png_byte)nparams;
  369|       |
  370|     14|   length = strlen(units) + 1;
  371|     14|   png_debug1(3, "allocating units for info (%lu bytes)",
  ------------------
  |  |  148|     14|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  372|     14|       (unsigned long)length);
  373|       |
  374|     14|   info_ptr->pcal_units = png_voidcast(png_charp,
  ------------------
  |  |  544|     14|#  define png_voidcast(type, value) (value)
  ------------------
  375|     14|       png_malloc_warn(png_ptr, length));
  376|       |
  377|     14|   if (info_ptr->pcal_units == NULL)
  ------------------
  |  Branch (377:8): [True: 0, False: 14]
  ------------------
  378|      0|   {
  379|      0|      png_warning(png_ptr, "Insufficient memory for pCAL units");
  380|      0|      return;
  381|      0|   }
  382|       |
  383|     14|   memcpy(info_ptr->pcal_units, units, length);
  384|       |
  385|     14|   info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
  ------------------
  |  |  544|     14|#  define png_voidcast(type, value) (value)
  ------------------
  386|     14|       (size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp)))));
  387|       |
  388|     14|   if (info_ptr->pcal_params == NULL)
  ------------------
  |  Branch (388:8): [True: 0, False: 14]
  ------------------
  389|      0|   {
  390|      0|      png_warning(png_ptr, "Insufficient memory for pCAL params");
  391|      0|      return;
  392|      0|   }
  393|       |
  394|     14|   memset(info_ptr->pcal_params, 0, ((unsigned int)nparams + 1) *
  395|     14|       (sizeof (png_charp)));
  396|       |
  397|     56|   for (i = 0; i < nparams; i++)
  ------------------
  |  Branch (397:16): [True: 42, False: 14]
  ------------------
  398|     42|   {
  399|     42|      length = strlen(params[i]) + 1;
  400|     42|      png_debug2(3, "allocating parameter %d for info (%lu bytes)", i,
  ------------------
  |  |  151|     42|#  define png_debug2(l, m, p1, p2) ((void)0)
  ------------------
  401|     42|          (unsigned long)length);
  402|       |
  403|     42|      info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length);
  404|       |
  405|     42|      if (info_ptr->pcal_params[i] == NULL)
  ------------------
  |  Branch (405:11): [True: 0, False: 42]
  ------------------
  406|      0|      {
  407|      0|         png_warning(png_ptr, "Insufficient memory for pCAL parameter");
  408|      0|         return;
  409|      0|      }
  410|       |
  411|     42|      memcpy(info_ptr->pcal_params[i], params[i], length);
  412|     42|   }
  413|       |
  414|     14|   info_ptr->valid |= PNG_INFO_pCAL;
  ------------------
  |  |  741|     14|#define PNG_INFO_pCAL 0x0400U
  ------------------
  415|     14|}
png_set_sCAL_s:
  422|     14|{
  423|     14|   size_t lengthw = 0, lengthh = 0;
  424|       |
  425|     14|   png_debug1(1, "in %s storage function", "sCAL");
  ------------------
  |  |  148|     14|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  426|       |
  427|     14|   if (png_ptr == NULL || info_ptr == NULL)
  ------------------
  |  Branch (427:8): [True: 0, False: 14]
  |  Branch (427:27): [True: 0, False: 14]
  ------------------
  428|      0|      return;
  429|       |
  430|       |   /* Double check the unit (should never get here with an invalid
  431|       |    * unit unless this is an API call.)
  432|       |    */
  433|     14|   if (unit != 1 && unit != 2)
  ------------------
  |  Branch (433:8): [True: 0, False: 14]
  |  Branch (433:21): [True: 0, False: 0]
  ------------------
  434|      0|      png_error(png_ptr, "Invalid sCAL unit");
  435|       |
  436|     14|   if (swidth == NULL || (lengthw = strlen(swidth)) == 0 ||
  ------------------
  |  Branch (436:8): [True: 0, False: 14]
  |  Branch (436:26): [True: 0, False: 14]
  ------------------
  437|     14|       swidth[0] == 45 /* '-' */ || !png_check_fp_string(swidth, lengthw))
  ------------------
  |  Branch (437:8): [True: 0, False: 14]
  |  Branch (437:37): [True: 0, False: 14]
  ------------------
  438|      0|      png_error(png_ptr, "Invalid sCAL width");
  439|       |
  440|     14|   if (sheight == NULL || (lengthh = strlen(sheight)) == 0 ||
  ------------------
  |  Branch (440:8): [True: 0, False: 14]
  |  Branch (440:27): [True: 0, False: 14]
  ------------------
  441|     14|       sheight[0] == 45 /* '-' */ || !png_check_fp_string(sheight, lengthh))
  ------------------
  |  Branch (441:8): [True: 0, False: 14]
  |  Branch (441:38): [True: 0, False: 14]
  ------------------
  442|      0|      png_error(png_ptr, "Invalid sCAL height");
  443|       |
  444|     14|   info_ptr->scal_unit = (png_byte)unit;
  445|       |
  446|     14|   ++lengthw;
  447|       |
  448|     14|   png_debug1(3, "allocating unit for info (%u bytes)", (unsigned int)lengthw);
  ------------------
  |  |  148|     14|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  449|       |
  450|     14|   info_ptr->scal_s_width = png_voidcast(png_charp,
  ------------------
  |  |  544|     14|#  define png_voidcast(type, value) (value)
  ------------------
  451|     14|       png_malloc_warn(png_ptr, lengthw));
  452|       |
  453|     14|   if (info_ptr->scal_s_width == NULL)
  ------------------
  |  Branch (453:8): [True: 0, False: 14]
  ------------------
  454|      0|   {
  455|      0|      png_warning(png_ptr, "Memory allocation failed while processing sCAL");
  456|       |
  457|      0|      return;
  458|      0|   }
  459|       |
  460|     14|   memcpy(info_ptr->scal_s_width, swidth, lengthw);
  461|       |
  462|     14|   ++lengthh;
  463|       |
  464|     14|   png_debug1(3, "allocating unit for info (%u bytes)", (unsigned int)lengthh);
  ------------------
  |  |  148|     14|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  465|       |
  466|     14|   info_ptr->scal_s_height = png_voidcast(png_charp,
  ------------------
  |  |  544|     14|#  define png_voidcast(type, value) (value)
  ------------------
  467|     14|       png_malloc_warn(png_ptr, lengthh));
  468|       |
  469|     14|   if (info_ptr->scal_s_height == NULL)
  ------------------
  |  Branch (469:8): [True: 0, False: 14]
  ------------------
  470|      0|   {
  471|      0|      png_free(png_ptr, info_ptr->scal_s_width);
  472|      0|      info_ptr->scal_s_width = NULL;
  473|       |
  474|      0|      png_warning(png_ptr, "Memory allocation failed while processing sCAL");
  475|      0|      return;
  476|      0|   }
  477|       |
  478|     14|   memcpy(info_ptr->scal_s_height, sheight, lengthh);
  479|       |
  480|     14|   info_ptr->free_me |= PNG_FREE_SCAL;
  ------------------
  |  | 1749|     14|#define PNG_FREE_SCAL 0x0100U
  ------------------
  481|     14|   info_ptr->valid |= PNG_INFO_sCAL;
  ------------------
  |  |  745|     14|#define PNG_INFO_sCAL 0x4000U  /* ESR, 1.0.6 */
  ------------------
  482|     14|}
png_set_pHYs:
  547|     14|{
  548|     14|   png_debug1(1, "in %s storage function", "pHYs");
  ------------------
  |  |  148|     14|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  549|       |
  550|     14|   if (png_ptr == NULL || info_ptr == NULL)
  ------------------
  |  Branch (550:8): [True: 0, False: 14]
  |  Branch (550:27): [True: 0, False: 14]
  ------------------
  551|      0|      return;
  552|       |
  553|     14|   info_ptr->x_pixels_per_unit = res_x;
  554|     14|   info_ptr->y_pixels_per_unit = res_y;
  555|     14|   info_ptr->phys_unit_type = (png_byte)unit_type;
  556|     14|   info_ptr->valid |= PNG_INFO_pHYs;
  ------------------
  |  |  738|     14|#define PNG_INFO_pHYs 0x0080U
  ------------------
  557|     14|}
png_set_PLTE:
  563|    235|{
  564|       |
  565|    235|   png_uint_32 max_palette_length;
  566|       |
  567|    235|   png_debug1(1, "in %s storage function", "PLTE");
  ------------------
  |  |  148|    235|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  568|       |
  569|    235|   if (png_ptr == NULL || info_ptr == NULL)
  ------------------
  |  Branch (569:8): [True: 0, False: 235]
  |  Branch (569:27): [True: 0, False: 235]
  ------------------
  570|      0|      return;
  571|       |
  572|    235|   max_palette_length = (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
  ------------------
  |  |  668|    235|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|    235|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|    235|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (572:25): [True: 231, False: 4]
  ------------------
  573|    231|      (1 << info_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
  ------------------
  |  |  724|    239|#define PNG_MAX_PALETTE_LENGTH    256
  ------------------
  574|       |
  575|    235|   if (num_palette < 0 || num_palette > (int) max_palette_length)
  ------------------
  |  Branch (575:8): [True: 0, False: 235]
  |  Branch (575:27): [True: 0, False: 235]
  ------------------
  576|      0|   {
  577|      0|      if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  668|      0|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  662|      0|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (577:11): [True: 0, False: 0]
  ------------------
  578|      0|         png_error(png_ptr, "Invalid palette length");
  579|       |
  580|      0|      else
  581|      0|      {
  582|      0|         png_warning(png_ptr, "Invalid palette length");
  583|       |
  584|      0|         return;
  585|      0|      }
  586|      0|   }
  587|       |
  588|    235|   if ((num_palette > 0 && palette == NULL) ||
  ------------------
  |  Branch (588:9): [True: 234, False: 1]
  |  Branch (588:28): [True: 0, False: 234]
  ------------------
  589|    235|      (num_palette == 0
  ------------------
  |  Branch (589:8): [True: 1, False: 234]
  ------------------
  590|    235|#        ifdef PNG_MNG_FEATURES_SUPPORTED
  591|    235|            && (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0
  ------------------
  |  |  856|      1|#define PNG_FLAG_MNG_EMPTY_PLTE     0x01
  ------------------
  |  Branch (591:16): [True: 1, False: 0]
  ------------------
  592|    235|#        endif
  593|    235|      ))
  594|      1|   {
  595|      1|      png_error(png_ptr, "Invalid palette");
  596|      1|   }
  597|       |
  598|       |   /* It may not actually be necessary to set png_ptr->palette here;
  599|       |    * we do it for backward compatibility with the way the png_handle_tRNS
  600|       |    * function used to do the allocation.
  601|       |    *
  602|       |    * 1.6.0: the above statement appears to be incorrect; something has to set
  603|       |    * the palette inside png_struct on read.
  604|       |    */
  605|    234|   png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
  ------------------
  |  | 1754|    234|#define PNG_FREE_PLTE 0x1000U
  ------------------
  606|       |
  607|       |   /* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
  608|       |    * of num_palette entries, in case of an invalid PNG file or incorrect
  609|       |    * call to png_set_PLTE() with too-large sample values.
  610|       |    */
  611|    234|   png_ptr->palette = png_voidcast(png_colorp, png_calloc(png_ptr,
  ------------------
  |  |  544|    234|#  define png_voidcast(type, value) (value)
  ------------------
  612|    234|       PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
  613|       |
  614|    234|   if (num_palette > 0)
  ------------------
  |  Branch (614:8): [True: 234, False: 0]
  ------------------
  615|    234|      memcpy(png_ptr->palette, palette, (unsigned int)num_palette *
  616|    234|          (sizeof (png_color)));
  617|       |
  618|    234|   info_ptr->palette = png_ptr->palette;
  619|    234|   info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
  620|    234|   info_ptr->free_me |= PNG_FREE_PLTE;
  ------------------
  |  | 1754|    234|#define PNG_FREE_PLTE 0x1000U
  ------------------
  621|    234|   info_ptr->valid |= PNG_INFO_PLTE;
  ------------------
  |  |  734|    234|#define PNG_INFO_PLTE 0x0008U
  ------------------
  622|    234|}
png_set_sBIT:
  628|      7|{
  629|      7|   png_debug1(1, "in %s storage function", "sBIT");
  ------------------
  |  |  148|      7|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  630|       |
  631|      7|   if (png_ptr == NULL || info_ptr == NULL || sig_bit == NULL)
  ------------------
  |  Branch (631:8): [True: 0, False: 7]
  |  Branch (631:27): [True: 0, False: 7]
  |  Branch (631:47): [True: 0, False: 7]
  ------------------
  632|      0|      return;
  633|       |
  634|      7|   info_ptr->sig_bit = *sig_bit;
  635|      7|   info_ptr->valid |= PNG_INFO_sBIT;
  ------------------
  |  |  732|      7|#define PNG_INFO_sBIT 0x0002U
  ------------------
  636|      7|}
png_set_text_2:
  763|  14.6k|{
  764|  14.6k|   int i;
  765|       |
  766|  14.6k|   png_debug1(1, "in text storage function, chunk typeid = 0x%lx",
  ------------------
  |  |  148|  14.6k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  767|  14.6k|      png_ptr == NULL ? 0xabadca11UL : (unsigned long)png_ptr->chunk_name);
  768|       |
  769|  14.6k|   if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
  ------------------
  |  Branch (769:8): [True: 0, False: 14.6k]
  |  Branch (769:27): [True: 0, False: 14.6k]
  |  Branch (769:47): [True: 0, False: 14.6k]
  |  Branch (769:64): [True: 0, False: 14.6k]
  ------------------
  770|      0|      return 0;
  771|       |
  772|       |   /* Make sure we have enough space in the "text" array in info_struct
  773|       |    * to hold all of the incoming text_ptr objects.  This compare can't overflow
  774|       |    * because max_text >= num_text (anyway, subtract of two positive integers
  775|       |    * can't overflow in any case.)
  776|       |    */
  777|  14.6k|   if (num_text > info_ptr->max_text - info_ptr->num_text)
  ------------------
  |  Branch (777:8): [True: 1.96k, False: 12.7k]
  ------------------
  778|  1.96k|   {
  779|  1.96k|      int old_num_text = info_ptr->num_text;
  780|  1.96k|      int max_text;
  781|  1.96k|      png_textp new_text = NULL;
  782|       |
  783|       |      /* Calculate an appropriate max_text, checking for overflow. */
  784|  1.96k|      max_text = old_num_text;
  785|  1.96k|      if (num_text <= INT_MAX - max_text)
  ------------------
  |  Branch (785:11): [True: 1.96k, False: 0]
  ------------------
  786|  1.96k|      {
  787|  1.96k|         max_text += num_text;
  788|       |
  789|       |         /* Round up to a multiple of 8 */
  790|  1.96k|         if (max_text < INT_MAX-8)
  ------------------
  |  Branch (790:14): [True: 1.96k, False: 0]
  ------------------
  791|  1.96k|            max_text = (max_text + 8) & ~0x7;
  792|       |
  793|      0|         else
  794|      0|            max_text = INT_MAX;
  795|       |
  796|       |         /* Now allocate a new array and copy the old members in; this does all
  797|       |          * the overflow checks.
  798|       |          */
  799|  1.96k|         new_text = png_voidcast(png_textp,png_realloc_array(png_ptr,
  ------------------
  |  |  544|  1.96k|#  define png_voidcast(type, value) (value)
  ------------------
  800|  1.96k|             info_ptr->text, old_num_text, max_text-old_num_text,
  801|  1.96k|             sizeof *new_text));
  802|  1.96k|      }
  803|       |
  804|  1.96k|      if (new_text == NULL)
  ------------------
  |  Branch (804:11): [True: 0, False: 1.96k]
  ------------------
  805|      0|      {
  806|      0|         png_chunk_report(png_ptr, "too many text chunks",
  807|      0|             PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|      0|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
  808|       |
  809|      0|         return 1;
  810|      0|      }
  811|       |
  812|  1.96k|      png_free(png_ptr, info_ptr->text);
  813|       |
  814|  1.96k|      info_ptr->text = new_text;
  815|  1.96k|      info_ptr->free_me |= PNG_FREE_TEXT;
  ------------------
  |  | 1756|  1.96k|#define PNG_FREE_TEXT 0x4000U
  ------------------
  816|  1.96k|      info_ptr->max_text = max_text;
  817|       |      /* num_text is adjusted below as the entries are copied in */
  818|       |
  819|  1.96k|      png_debug1(3, "allocated %d entries for info_ptr->text", max_text);
  ------------------
  |  |  148|  1.96k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  820|  1.96k|   }
  821|       |
  822|  29.3k|   for (i = 0; i < num_text; i++)
  ------------------
  |  Branch (822:16): [True: 14.6k, False: 14.6k]
  ------------------
  823|  14.6k|   {
  824|  14.6k|      size_t text_length, key_len;
  825|  14.6k|      size_t lang_len, lang_key_len;
  826|  14.6k|      png_textp textp = &(info_ptr->text[info_ptr->num_text]);
  827|       |
  828|  14.6k|      if (text_ptr[i].key == NULL)
  ------------------
  |  Branch (828:11): [True: 0, False: 14.6k]
  ------------------
  829|      0|          continue;
  830|       |
  831|  14.6k|      if (text_ptr[i].compression < PNG_TEXT_COMPRESSION_NONE ||
  ------------------
  |  |  587|  29.3k|#define PNG_TEXT_COMPRESSION_NONE    -1
  ------------------
  |  Branch (831:11): [True: 0, False: 14.6k]
  ------------------
  832|  14.6k|          text_ptr[i].compression >= PNG_TEXT_COMPRESSION_LAST)
  ------------------
  |  |  591|  14.6k|#define PNG_TEXT_COMPRESSION_LAST     3  /* Not a valid value */
  ------------------
  |  Branch (832:11): [True: 0, False: 14.6k]
  ------------------
  833|      0|      {
  834|      0|         png_chunk_report(png_ptr, "text compression mode is out of range",
  835|      0|             PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|      0|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
  836|      0|         continue;
  837|      0|      }
  838|       |
  839|  14.6k|      key_len = strlen(text_ptr[i].key);
  840|       |
  841|  14.6k|      if (text_ptr[i].compression <= 0)
  ------------------
  |  Branch (841:11): [True: 14.4k, False: 269]
  ------------------
  842|  14.4k|      {
  843|  14.4k|         lang_len = 0;
  844|  14.4k|         lang_key_len = 0;
  845|  14.4k|      }
  846|       |
  847|    269|      else
  848|    269|#  ifdef PNG_iTXt_SUPPORTED
  849|    269|      {
  850|       |         /* Set iTXt data */
  851|       |
  852|    269|         if (text_ptr[i].lang != NULL)
  ------------------
  |  Branch (852:14): [True: 269, False: 0]
  ------------------
  853|    269|            lang_len = strlen(text_ptr[i].lang);
  854|       |
  855|      0|         else
  856|      0|            lang_len = 0;
  857|       |
  858|    269|         if (text_ptr[i].lang_key != NULL)
  ------------------
  |  Branch (858:14): [True: 269, False: 0]
  ------------------
  859|    269|            lang_key_len = strlen(text_ptr[i].lang_key);
  860|       |
  861|      0|         else
  862|      0|            lang_key_len = 0;
  863|    269|      }
  864|       |#  else /* iTXt */
  865|       |      {
  866|       |         png_chunk_report(png_ptr, "iTXt chunk not supported",
  867|       |             PNG_CHUNK_WRITE_ERROR);
  868|       |         continue;
  869|       |      }
  870|       |#  endif
  871|       |
  872|  14.6k|      if (text_ptr[i].text == NULL || text_ptr[i].text[0] == '\0')
  ------------------
  |  Branch (872:11): [True: 0, False: 14.6k]
  |  Branch (872:39): [True: 13.3k, False: 1.35k]
  ------------------
  873|  13.3k|      {
  874|  13.3k|         text_length = 0;
  875|  13.3k|#  ifdef PNG_iTXt_SUPPORTED
  876|  13.3k|         if (text_ptr[i].compression > 0)
  ------------------
  |  Branch (876:14): [True: 252, False: 13.0k]
  ------------------
  877|    252|            textp->compression = PNG_ITXT_COMPRESSION_NONE;
  ------------------
  |  |  589|    252|#define PNG_ITXT_COMPRESSION_NONE     1
  ------------------
  878|       |
  879|  13.0k|         else
  880|  13.0k|#  endif
  881|  13.0k|            textp->compression = PNG_TEXT_COMPRESSION_NONE;
  ------------------
  |  |  587|  13.0k|#define PNG_TEXT_COMPRESSION_NONE    -1
  ------------------
  882|  13.3k|      }
  883|       |
  884|  1.35k|      else
  885|  1.35k|      {
  886|  1.35k|         text_length = strlen(text_ptr[i].text);
  887|  1.35k|         textp->compression = text_ptr[i].compression;
  888|  1.35k|      }
  889|       |
  890|  14.6k|      textp->key = png_voidcast(png_charp,png_malloc_base(png_ptr,
  ------------------
  |  |  544|  14.6k|#  define png_voidcast(type, value) (value)
  ------------------
  891|  14.6k|          key_len + text_length + lang_len + lang_key_len + 4));
  892|       |
  893|  14.6k|      if (textp->key == NULL)
  ------------------
  |  Branch (893:11): [True: 0, False: 14.6k]
  ------------------
  894|      0|      {
  895|      0|         png_chunk_report(png_ptr, "text chunk: out of memory",
  896|      0|             PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|      0|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
  897|       |
  898|      0|         return 1;
  899|      0|      }
  900|       |
  901|  14.6k|      png_debug2(2, "Allocated %lu bytes at %p in png_set_text",
  ------------------
  |  |  151|  14.6k|#  define png_debug2(l, m, p1, p2) ((void)0)
  ------------------
  902|  14.6k|          (unsigned long)(png_uint_32)
  903|  14.6k|          (key_len + lang_len + lang_key_len + text_length + 4),
  904|  14.6k|          textp->key);
  905|       |
  906|  14.6k|      memcpy(textp->key, text_ptr[i].key, key_len);
  907|  14.6k|      *(textp->key + key_len) = '\0';
  908|       |
  909|  14.6k|      if (text_ptr[i].compression > 0)
  ------------------
  |  Branch (909:11): [True: 269, False: 14.4k]
  ------------------
  910|    269|      {
  911|    269|         textp->lang = textp->key + key_len + 1;
  912|    269|         memcpy(textp->lang, text_ptr[i].lang, lang_len);
  913|    269|         *(textp->lang + lang_len) = '\0';
  914|    269|         textp->lang_key = textp->lang + lang_len + 1;
  915|    269|         memcpy(textp->lang_key, text_ptr[i].lang_key, lang_key_len);
  916|    269|         *(textp->lang_key + lang_key_len) = '\0';
  917|    269|         textp->text = textp->lang_key + lang_key_len + 1;
  918|    269|      }
  919|       |
  920|  14.4k|      else
  921|  14.4k|      {
  922|  14.4k|         textp->lang=NULL;
  923|  14.4k|         textp->lang_key=NULL;
  924|  14.4k|         textp->text = textp->key + key_len + 1;
  925|  14.4k|      }
  926|       |
  927|  14.6k|      if (text_length != 0)
  ------------------
  |  Branch (927:11): [True: 1.35k, False: 13.3k]
  ------------------
  928|  1.35k|         memcpy(textp->text, text_ptr[i].text, text_length);
  929|       |
  930|  14.6k|      *(textp->text + text_length) = '\0';
  931|       |
  932|  14.6k|#  ifdef PNG_iTXt_SUPPORTED
  933|  14.6k|      if (textp->compression > 0)
  ------------------
  |  Branch (933:11): [True: 269, False: 14.4k]
  ------------------
  934|    269|      {
  935|    269|         textp->text_length = 0;
  936|    269|         textp->itxt_length = text_length;
  937|    269|      }
  938|       |
  939|  14.4k|      else
  940|  14.4k|#  endif
  941|  14.4k|      {
  942|  14.4k|         textp->text_length = text_length;
  943|  14.4k|         textp->itxt_length = 0;
  944|  14.4k|      }
  945|       |
  946|  14.6k|      info_ptr->num_text++;
  947|  14.6k|      png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
  ------------------
  |  |  148|  14.6k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  948|  14.6k|   }
  949|       |
  950|  14.6k|   return 0;
  951|  14.6k|}
png_set_tIME:
  958|  1.20k|{
  959|  1.20k|   png_debug1(1, "in %s storage function", "tIME");
  ------------------
  |  |  148|  1.20k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  960|       |
  961|  1.20k|   if (png_ptr == NULL || info_ptr == NULL || mod_time == NULL ||
  ------------------
  |  Branch (961:8): [True: 0, False: 1.20k]
  |  Branch (961:27): [True: 0, False: 1.20k]
  |  Branch (961:47): [True: 0, False: 1.20k]
  ------------------
  962|  1.20k|       (png_ptr->mode & PNG_WROTE_tIME) != 0)
  ------------------
  |  |  658|  1.20k|#define PNG_WROTE_tIME             0x200U
  ------------------
  |  Branch (962:8): [True: 0, False: 1.20k]
  ------------------
  963|      0|      return;
  964|       |
  965|  1.20k|   if (mod_time->month == 0   || mod_time->month > 12  ||
  ------------------
  |  Branch (965:8): [True: 193, False: 1.01k]
  |  Branch (965:34): [True: 218, False: 795]
  ------------------
  966|  1.20k|       mod_time->day   == 0   || mod_time->day   > 31  ||
  ------------------
  |  Branch (966:8): [True: 194, False: 601]
  |  Branch (966:34): [True: 193, False: 408]
  ------------------
  967|  1.20k|       mod_time->hour  > 23   || mod_time->minute > 59 ||
  ------------------
  |  Branch (967:8): [True: 193, False: 215]
  |  Branch (967:34): [True: 138, False: 77]
  ------------------
  968|  1.20k|       mod_time->second > 60)
  ------------------
  |  Branch (968:8): [True: 65, False: 12]
  ------------------
  969|  1.19k|   {
  970|  1.19k|      png_warning(png_ptr, "Ignoring invalid time value");
  971|       |
  972|  1.19k|      return;
  973|  1.19k|   }
  974|       |
  975|     12|   info_ptr->mod_time = *mod_time;
  976|     12|   info_ptr->valid |= PNG_INFO_tIME;
  ------------------
  |  |  740|     12|#define PNG_INFO_tIME 0x0200U
  ------------------
  977|     12|}
png_set_tRNS:
  984|    234|{
  985|    234|   png_debug1(1, "in %s storage function", "tRNS");
  ------------------
  |  |  148|    234|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
  986|       |
  987|    234|   if (png_ptr == NULL || info_ptr == NULL)
  ------------------
  |  Branch (987:8): [True: 0, False: 234]
  |  Branch (987:27): [True: 0, False: 234]
  ------------------
  988|       |
  989|      0|      return;
  990|       |
  991|    234|   if (trans_alpha != NULL)
  ------------------
  |  Branch (991:8): [True: 234, False: 0]
  ------------------
  992|    234|   {
  993|       |       /* It may not actually be necessary to set png_ptr->trans_alpha here;
  994|       |        * we do it for backward compatibility with the way the png_handle_tRNS
  995|       |        * function used to do the allocation.
  996|       |        *
  997|       |        * 1.6.0: The above statement is incorrect; png_handle_tRNS effectively
  998|       |        * relies on png_set_tRNS storing the information in png_struct
  999|       |        * (otherwise it won't be there for the code in pngrtran.c).
 1000|       |        */
 1001|       |
 1002|    234|       png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
  ------------------
  |  | 1755|    234|#define PNG_FREE_TRNS 0x2000U
  ------------------
 1003|       |
 1004|    234|       if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
  ------------------
  |  |  724|    234|#define PNG_MAX_PALETTE_LENGTH    256
  ------------------
  |  Branch (1004:12): [True: 234, False: 0]
  |  Branch (1004:29): [True: 234, False: 0]
  ------------------
 1005|    234|       {
 1006|       |         /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
 1007|    234|          info_ptr->trans_alpha = png_voidcast(png_bytep,
  ------------------
  |  |  544|    234|#  define png_voidcast(type, value) (value)
  ------------------
 1008|    234|              png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
 1009|    234|          memcpy(info_ptr->trans_alpha, trans_alpha, (size_t)num_trans);
 1010|       |
 1011|    234|          info_ptr->free_me |= PNG_FREE_TRNS;
  ------------------
  |  | 1755|    234|#define PNG_FREE_TRNS 0x2000U
  ------------------
 1012|    234|          info_ptr->valid |= PNG_INFO_tRNS;
  ------------------
  |  |  735|    234|#define PNG_INFO_tRNS 0x0010U
  ------------------
 1013|    234|       }
 1014|    234|       png_ptr->trans_alpha = info_ptr->trans_alpha;
 1015|    234|   }
 1016|       |
 1017|    234|   if (trans_color != NULL)
  ------------------
  |  Branch (1017:8): [True: 234, False: 0]
  ------------------
 1018|    234|   {
 1019|    234|#ifdef PNG_WARNINGS_SUPPORTED
 1020|    234|      if (info_ptr->bit_depth < 16)
  ------------------
  |  Branch (1020:11): [True: 105, False: 129]
  ------------------
 1021|    105|      {
 1022|    105|         int sample_max = (1 << info_ptr->bit_depth) - 1;
 1023|       |
 1024|    105|         if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
  ------------------
  |  |  667|    210|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (1024:15): [True: 19, False: 86]
  ------------------
 1025|    105|             trans_color->gray > sample_max) ||
  ------------------
  |  Branch (1025:14): [True: 6, False: 13]
  ------------------
 1026|    105|             (info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
  ------------------
  |  |  669|    198|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|     99|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (1026:15): [True: 48, False: 51]
  ------------------
 1027|     99|             (trans_color->red > sample_max ||
  ------------------
  |  Branch (1027:15): [True: 4, False: 44]
  ------------------
 1028|     48|             trans_color->green > sample_max ||
  ------------------
  |  Branch (1028:14): [True: 7, False: 37]
  ------------------
 1029|     48|             trans_color->blue > sample_max)))
  ------------------
  |  Branch (1029:14): [True: 29, False: 8]
  ------------------
 1030|     46|            png_warning(png_ptr,
 1031|     46|                "tRNS chunk has out-of-range samples for bit_depth");
 1032|    105|      }
 1033|    234|#endif
 1034|       |
 1035|    234|      info_ptr->trans_color = *trans_color;
 1036|       |
 1037|    234|      if (num_trans == 0)
  ------------------
  |  Branch (1037:11): [True: 0, False: 234]
  ------------------
 1038|      0|         num_trans = 1;
 1039|    234|   }
 1040|       |
 1041|    234|   info_ptr->num_trans = (png_uint_16)num_trans;
 1042|       |
 1043|    234|   if (num_trans != 0)
  ------------------
  |  Branch (1043:8): [True: 234, False: 0]
  ------------------
 1044|    234|   {
 1045|    234|      info_ptr->free_me |= PNG_FREE_TRNS;
  ------------------
  |  | 1755|    234|#define PNG_FREE_TRNS 0x2000U
  ------------------
 1046|    234|      info_ptr->valid |= PNG_INFO_tRNS;
  ------------------
  |  |  735|    234|#define PNG_INFO_tRNS 0x0010U
  ------------------
 1047|    234|   }
 1048|    234|}
png_set_sPLT:
 1063|  1.53k|{
 1064|  1.53k|   png_sPLT_tp np;
 1065|       |
 1066|  1.53k|   png_debug1(1, "in %s storage function", "sPLT");
  ------------------
  |  |  148|  1.53k|#  define png_debug1(l, m, p1) ((void)0)
  ------------------
 1067|       |
 1068|  1.53k|   if (png_ptr == NULL || info_ptr == NULL || nentries <= 0 || entries == NULL)
  ------------------
  |  Branch (1068:8): [True: 0, False: 1.53k]
  |  Branch (1068:27): [True: 0, False: 1.53k]
  |  Branch (1068:47): [True: 0, False: 1.53k]
  |  Branch (1068:64): [True: 0, False: 1.53k]
  ------------------
 1069|      0|      return;
 1070|       |
 1071|       |   /* Use the internal realloc function, which checks for all the possible
 1072|       |    * overflows.  Notice that the parameters are (int) and (size_t)
 1073|       |    */
 1074|  1.53k|   np = png_voidcast(png_sPLT_tp,png_realloc_array(png_ptr,
  ------------------
  |  |  544|  1.53k|#  define png_voidcast(type, value) (value)
  ------------------
 1075|  1.53k|       info_ptr->splt_palettes, info_ptr->splt_palettes_num, nentries,
 1076|  1.53k|       sizeof *np));
 1077|       |
 1078|  1.53k|   if (np == NULL)
  ------------------
  |  Branch (1078:8): [True: 0, False: 1.53k]
  ------------------
 1079|      0|   {
 1080|       |      /* Out of memory or too many chunks */
 1081|      0|      png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|      0|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
 1082|      0|      return;
 1083|      0|   }
 1084|       |
 1085|  1.53k|   png_free(png_ptr, info_ptr->splt_palettes);
 1086|       |
 1087|  1.53k|   info_ptr->splt_palettes = np;
 1088|  1.53k|   info_ptr->free_me |= PNG_FREE_SPLT;
  ------------------
  |  | 1746|  1.53k|#define PNG_FREE_SPLT 0x0020U
  ------------------
 1089|       |
 1090|  1.53k|   np += info_ptr->splt_palettes_num;
 1091|       |
 1092|  1.53k|   do
 1093|  1.53k|   {
 1094|  1.53k|      size_t length;
 1095|       |
 1096|       |      /* Skip invalid input entries */
 1097|  1.53k|      if (entries->name == NULL || entries->entries == NULL)
  ------------------
  |  Branch (1097:11): [True: 0, False: 1.53k]
  |  Branch (1097:36): [True: 0, False: 1.53k]
  ------------------
 1098|      0|      {
 1099|       |         /* png_handle_sPLT doesn't do this, so this is an app error */
 1100|      0|         png_app_error(png_ptr, "png_set_sPLT: invalid sPLT");
 1101|       |         /* Just skip the invalid entry */
 1102|      0|         continue;
 1103|      0|      }
 1104|       |
 1105|  1.53k|      np->depth = entries->depth;
 1106|       |
 1107|       |      /* In the event of out-of-memory just return - there's no point keeping
 1108|       |       * on trying to add sPLT chunks.
 1109|       |       */
 1110|  1.53k|      length = strlen(entries->name) + 1;
 1111|  1.53k|      np->name = png_voidcast(png_charp, png_malloc_base(png_ptr, length));
  ------------------
  |  |  544|  1.53k|#  define png_voidcast(type, value) (value)
  ------------------
 1112|       |
 1113|  1.53k|      if (np->name == NULL)
  ------------------
  |  Branch (1113:11): [True: 0, False: 1.53k]
  ------------------
 1114|      0|         break;
 1115|       |
 1116|  1.53k|      memcpy(np->name, entries->name, length);
 1117|       |
 1118|       |      /* IMPORTANT: we have memory now that won't get freed if something else
 1119|       |       * goes wrong; this code must free it.  png_malloc_array produces no
 1120|       |       * warnings; use a png_chunk_report (below) if there is an error.
 1121|       |       */
 1122|  1.53k|      np->entries = png_voidcast(png_sPLT_entryp, png_malloc_array(png_ptr,
  ------------------
  |  |  544|  1.53k|#  define png_voidcast(type, value) (value)
  ------------------
 1123|  1.53k|          entries->nentries, sizeof (png_sPLT_entry)));
 1124|       |
 1125|  1.53k|      if (np->entries == NULL)
  ------------------
  |  Branch (1125:11): [True: 0, False: 1.53k]
  ------------------
 1126|      0|      {
 1127|      0|         png_free(png_ptr, np->name);
 1128|      0|         np->name = NULL;
 1129|      0|         break;
 1130|      0|      }
 1131|       |
 1132|  1.53k|      np->nentries = entries->nentries;
 1133|       |      /* This multiply can't overflow because png_malloc_array has already
 1134|       |       * checked it when doing the allocation.
 1135|       |       */
 1136|  1.53k|      memcpy(np->entries, entries->entries,
 1137|  1.53k|          (unsigned int)entries->nentries * sizeof (png_sPLT_entry));
 1138|       |
 1139|       |      /* Note that 'continue' skips the advance of the out pointer and out
 1140|       |       * count, so an invalid entry is not added.
 1141|       |       */
 1142|  1.53k|      info_ptr->valid |= PNG_INFO_sPLT;
  ------------------
  |  |  744|  1.53k|#define PNG_INFO_sPLT 0x2000U  /* ESR, 1.0.6 */
  ------------------
 1143|  1.53k|      ++(info_ptr->splt_palettes_num);
 1144|  1.53k|      ++np;
 1145|  1.53k|      ++entries;
 1146|  1.53k|   }
 1147|  1.53k|   while (--nentries);
  ------------------
  |  Branch (1147:11): [True: 0, False: 1.53k]
  ------------------
 1148|       |
 1149|  1.53k|   if (nentries > 0)
  ------------------
  |  Branch (1149:8): [True: 0, False: 1.53k]
  ------------------
 1150|      0|      png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
  ------------------
  |  | 1902|      0|#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
  ------------------
 1151|  1.53k|}

png_set_swap:
   36|  1.01k|{
   37|  1.01k|   png_debug(1, "in png_set_swap");
  ------------------
  |  |  145|  1.01k|#  define png_debug(l, m) ((void)0)
  ------------------
   38|       |
   39|  1.01k|   if (png_ptr == NULL)
  ------------------
  |  Branch (39:8): [True: 0, False: 1.01k]
  ------------------
   40|      0|      return;
   41|       |
   42|  1.01k|   if (png_ptr->bit_depth == 16)
  ------------------
  |  Branch (42:8): [True: 670, False: 341]
  ------------------
   43|    670|      png_ptr->transformations |= PNG_SWAP_BYTES;
  ------------------
  |  |  671|    670|#define PNG_SWAP_BYTES          0x0010U
  ------------------
   44|  1.01k|}
png_set_packing:
   51|    134|{
   52|    134|   png_debug(1, "in png_set_packing");
  ------------------
  |  |  145|    134|#  define png_debug(l, m) ((void)0)
  ------------------
   53|       |
   54|    134|   if (png_ptr == NULL)
  ------------------
  |  Branch (54:8): [True: 0, False: 134]
  ------------------
   55|      0|      return;
   56|       |
   57|    134|   if (png_ptr->bit_depth < 8)
  ------------------
  |  Branch (57:8): [True: 134, False: 0]
  ------------------
   58|    134|   {
   59|    134|      png_ptr->transformations |= PNG_PACK;
  ------------------
  |  |  669|    134|#define PNG_PACK                0x0004U
  ------------------
   60|    134|#     ifdef PNG_WRITE_SUPPORTED
   61|    134|         png_ptr->usr_bit_depth = 8;
   62|    134|#     endif
   63|    134|   }
   64|    134|}
png_set_interlace_handling:
  100|  1.72k|{
  101|  1.72k|   png_debug(1, "in png_set_interlace handling");
  ------------------
  |  |  145|  1.72k|#  define png_debug(l, m) ((void)0)
  ------------------
  102|       |
  103|  1.72k|   if (png_ptr != 0 && png_ptr->interlaced != 0)
  ------------------
  |  Branch (103:8): [True: 1.72k, False: 0]
  |  Branch (103:24): [True: 1.42k, False: 301]
  ------------------
  104|  1.42k|   {
  105|  1.42k|      png_ptr->transformations |= PNG_INTERLACE;
  ------------------
  |  |  668|  1.42k|#define PNG_INTERLACE           0x0002U
  ------------------
  106|  1.42k|      return 7;
  107|  1.42k|   }
  108|       |
  109|    301|   return 1;
  110|  1.72k|}
png_set_filler:
  121|  1.01k|{
  122|  1.01k|   png_debug(1, "in png_set_filler");
  ------------------
  |  |  145|  1.01k|#  define png_debug(l, m) ((void)0)
  ------------------
  123|       |
  124|  1.01k|   if (png_ptr == NULL)
  ------------------
  |  Branch (124:8): [True: 0, False: 1.01k]
  ------------------
  125|      0|      return;
  126|       |
  127|       |   /* In libpng 1.6 it is possible to determine whether this is a read or write
  128|       |    * operation and therefore to do more checking here for a valid call.
  129|       |    */
  130|  1.01k|   if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
  ------------------
  |  |  664|  1.01k|#define PNG_IS_READ_STRUCT        0x8000U /* Else is a write struct */
  ------------------
  |  Branch (130:8): [True: 1.01k, False: 0]
  ------------------
  131|  1.01k|   {
  132|  1.01k|#     ifdef PNG_READ_FILLER_SUPPORTED
  133|       |         /* On read png_set_filler is always valid, regardless of the base PNG
  134|       |          * format, because other transformations can give a format where the
  135|       |          * filler code can execute (basically an 8 or 16-bit component RGB or G
  136|       |          * format.)
  137|       |          *
  138|       |          * NOTE: usr_channels is not used by the read code!  (This has led to
  139|       |          * confusion in the past.)  The filler is only used in the read code.
  140|       |          */
  141|  1.01k|         png_ptr->filler = (png_uint_16)filler;
  142|       |#     else
  143|       |         png_app_error(png_ptr, "png_set_filler not supported on read");
  144|       |         PNG_UNUSED(filler) /* not used in the write case */
  145|       |         return;
  146|       |#     endif
  147|  1.01k|   }
  148|       |
  149|      0|   else /* write */
  150|      0|   {
  151|      0|#     ifdef PNG_WRITE_FILLER_SUPPORTED
  152|       |         /* On write the usr_channels parameter must be set correctly at the
  153|       |          * start to record the number of channels in the app-supplied data.
  154|       |          */
  155|      0|         switch (png_ptr->color_type)
  156|      0|         {
  157|      0|            case PNG_COLOR_TYPE_RGB:
  ------------------
  |  |  669|      0|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  663|      0|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (157:13): [True: 0, False: 0]
  ------------------
  158|      0|               png_ptr->usr_channels = 4;
  159|      0|               break;
  160|       |
  161|      0|            case PNG_COLOR_TYPE_GRAY:
  ------------------
  |  |  667|      0|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (161:13): [True: 0, False: 0]
  ------------------
  162|      0|               if (png_ptr->bit_depth >= 8)
  ------------------
  |  Branch (162:20): [True: 0, False: 0]
  ------------------
  163|      0|               {
  164|      0|                  png_ptr->usr_channels = 2;
  165|      0|                  break;
  166|      0|               }
  167|       |
  168|      0|               else
  169|      0|               {
  170|       |                  /* There simply isn't any code in libpng to strip out bits
  171|       |                   * from bytes when the components are less than a byte in
  172|       |                   * size!
  173|       |                   */
  174|      0|                  png_app_error(png_ptr,
  175|      0|                      "png_set_filler is invalid for"
  176|      0|                      " low bit depth gray output");
  177|      0|                  return;
  178|      0|               }
  179|       |
  180|      0|            default:
  ------------------
  |  Branch (180:13): [True: 0, False: 0]
  ------------------
  181|      0|               png_app_error(png_ptr,
  182|      0|                   "png_set_filler: inappropriate color type");
  183|      0|               return;
  184|      0|         }
  185|       |#     else
  186|       |         png_app_error(png_ptr, "png_set_filler not supported on write");
  187|       |         return;
  188|       |#     endif
  189|      0|   }
  190|       |
  191|       |   /* Here on success - libpng supports the operation, set the transformation
  192|       |    * and the flag to say where the filler channel is.
  193|       |    */
  194|  1.01k|   png_ptr->transformations |= PNG_FILLER;
  ------------------
  |  |  682|  1.01k|#define PNG_FILLER              0x8000U
  ------------------
  195|       |
  196|  1.01k|   if (filler_loc == PNG_FILLER_AFTER)
  ------------------
  |  | 1248|  1.01k|#  define PNG_FILLER_AFTER 1
  ------------------
  |  Branch (196:8): [True: 1.01k, False: 0]
  ------------------
  197|  1.01k|      png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
  ------------------
  |  |  711|  1.01k|#define PNG_FLAG_FILLER_AFTER             0x0080U
  ------------------
  198|       |
  199|      0|   else
  200|      0|      png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
  ------------------
  |  |  711|      0|#define PNG_FLAG_FILLER_AFTER             0x0080U
  ------------------
  201|  1.01k|}
png_do_swap:
  320|  20.8k|{
  321|  20.8k|   png_debug(1, "in png_do_swap");
  ------------------
  |  |  145|  20.8k|#  define png_debug(l, m) ((void)0)
  ------------------
  322|       |
  323|  20.8k|   if (row_info->bit_depth == 16)
  ------------------
  |  Branch (323:8): [True: 20.8k, False: 0]
  ------------------
  324|  20.8k|   {
  325|  20.8k|      png_bytep rp = row;
  326|  20.8k|      png_uint_32 i;
  327|  20.8k|      png_uint_32 istop= row_info->width * row_info->channels;
  328|       |
  329|  1.02M|      for (i = 0; i < istop; i++, rp += 2)
  ------------------
  |  Branch (329:19): [True: 1.00M, False: 20.8k]
  ------------------
  330|  1.00M|      {
  331|       |#ifdef PNG_BUILTIN_BSWAP16_SUPPORTED
  332|       |         /* Feature added to libpng-1.6.11 for testing purposes, not
  333|       |          * enabled by default.
  334|       |          */
  335|       |         *(png_uint_16*)rp = __builtin_bswap16(*(png_uint_16*)rp);
  336|       |#else
  337|  1.00M|         png_byte t = *rp;
  338|  1.00M|         *rp = *(rp + 1);
  339|  1.00M|         *(rp + 1) = t;
  340|  1.00M|#endif
  341|  1.00M|      }
  342|  20.8k|   }
  343|  20.8k|}

_pixman_arm_get_implementations:
  233|      2|{
  234|       |#ifdef USE_ARM_SIMD
  235|       |    if (!_pixman_disabled ("arm-simd") && have_feature (ARM_V6))
  236|       |	imp = _pixman_implementation_create_arm_simd (imp);
  237|       |#endif
  238|       |
  239|       |#ifdef USE_ARM_IWMMXT
  240|       |    if (!_pixman_disabled ("arm-iwmmxt") && have_feature (ARM_IWMMXT))
  241|       |	imp = _pixman_implementation_create_mmx (imp);
  242|       |#endif
  243|       |
  244|       |#ifdef USE_ARM_NEON
  245|       |    if (!_pixman_disabled ("arm-neon") && have_feature (ARM_NEON))
  246|       |	imp = _pixman_implementation_create_arm_neon (imp);
  247|       |#endif
  248|       |
  249|       |#ifdef USE_ARM_A64_NEON
  250|       |    /* neon is a part of aarch64 */
  251|       |    if (!_pixman_disabled ("arm-neon"))
  252|       |        imp = _pixman_implementation_create_arm_neon (imp);
  253|       |#endif
  254|       |
  255|      2|    return imp;
  256|      2|}

_pixman_bits_image_init:
 1286|     69|{
 1287|     69|    uint32_t *free_me = NULL;
 1288|       |
 1289|     69|    if (PIXMAN_FORMAT_BPP (format) == 128)
  ------------------
  |  |  843|     69|#define PIXMAN_FORMAT_BPP(f)	PIXMAN_FORMAT_RESHIFT(f, 24, 8)
  |  |  ------------------
  |  |  |  |  841|     69|	(((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
  |  |  ------------------
  ------------------
  |  Branch (1289:9): [True: 14, False: 55]
  ------------------
 1290|     14|	return_val_if_fail(!(rowstride % 4), FALSE);
  ------------------
  |  | 1071|     14|    do                                                                  \
  |  | 1072|     14|    {                                                                   \
  |  | 1073|     14|	if (unlikely (!(expr)))                                         \
  |  |  ------------------
  |  |  |  |   22|     14|#  define unlikely(expr) __builtin_expect ((expr), 0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (22:26): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1074|     14|	{								\
  |  | 1075|      0|	    _pixman_log_error (FUNC, "The expression " # expr " was false"); \
  |  |  ------------------
  |  |  |  |   14|      0|#  define FUNC     ((const char*) (__PRETTY_FUNCTION__))
  |  |  ------------------
  |  | 1076|      0|	    return (retval);						\
  |  | 1077|      0|	}								\
  |  | 1078|     14|    }                                                                   \
  |  | 1079|     14|    while (0)
  |  |  ------------------
  |  |  |  Branch (1079:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1291|       |
 1292|     69|    if (!bits && width && height)
  ------------------
  |  Branch (1292:9): [True: 0, False: 69]
  |  Branch (1292:18): [True: 0, False: 0]
  |  Branch (1292:27): [True: 0, False: 0]
  ------------------
 1293|      0|    {
 1294|      0|	int rowstride_bytes;
 1295|       |
 1296|      0|	free_me = bits = create_bits (format, width, height, &rowstride_bytes, clear);
 1297|       |
 1298|      0|	if (!bits)
  ------------------
  |  Branch (1298:6): [True: 0, False: 0]
  ------------------
 1299|      0|	    return FALSE;
  ------------------
  |  |  913|      0|#   define FALSE 0
  ------------------
 1300|       |
 1301|      0|	rowstride = rowstride_bytes / (int) sizeof (uint32_t);
 1302|      0|    }
 1303|       |
 1304|     69|    _pixman_image_init (image);
 1305|       |
 1306|     69|    image->type = BITS;
 1307|     69|    image->bits.format = format;
 1308|     69|    image->bits.width = width;
 1309|     69|    image->bits.height = height;
 1310|     69|    image->bits.bits = bits;
 1311|     69|    image->bits.free_me = free_me;
 1312|     69|    image->bits.dither = PIXMAN_DITHER_NONE;
 1313|     69|    image->bits.dither_offset_x = 0;
 1314|     69|    image->bits.dither_offset_y = 0;
 1315|     69|    image->bits.read_func = NULL;
 1316|     69|    image->bits.write_func = NULL;
 1317|     69|    image->bits.rowstride = rowstride;
 1318|     69|    image->bits.indexed = NULL;
 1319|       |
 1320|     69|    image->common.property_changed = bits_image_property_changed;
 1321|       |
 1322|     69|    _pixman_image_reset_clip_region (image);
 1323|       |
 1324|     69|    return TRUE;
  ------------------
  |  |  917|     69|#   define TRUE 1
  ------------------
 1325|     69|}
pixman_image_create_bits:
 1367|     69|{
 1368|     69|    return create_bits_image_internal (
 1369|     69|	format, width, height, bits, rowstride_bytes, TRUE);
  ------------------
  |  |  917|     69|#   define TRUE 1
  ------------------
 1370|     69|}
pixman-bits-image.c:create_bits_image_internal:
 1334|     69|{
 1335|     69|    pixman_image_t *image;
 1336|       |
 1337|       |    /* must be a whole number of uint32_t's
 1338|       |     */
 1339|     69|    return_val_if_fail (
  ------------------
  |  | 1071|     69|    do                                                                  \
  |  | 1072|     69|    {                                                                   \
  |  | 1073|     69|	if (unlikely (!(expr)))                                         \
  |  |  ------------------
  |  |  |  |   22|    138|#  define unlikely(expr) __builtin_expect ((expr), 0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (22:26): [True: 0, False: 69]
  |  |  |  |  |  Branch (22:45): [True: 0, False: 69]
  |  |  |  |  |  Branch (22:45): [True: 69, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1074|     69|	{								\
  |  | 1075|      0|	    _pixman_log_error (FUNC, "The expression " # expr " was false"); \
  |  |  ------------------
  |  |  |  |   14|      0|#  define FUNC     ((const char*) (__PRETTY_FUNCTION__))
  |  |  ------------------
  |  | 1076|      0|	    return (retval);						\
  |  | 1077|      0|	}								\
  |  | 1078|     69|    }                                                                   \
  |  | 1079|     69|    while (0)
  |  |  ------------------
  |  |  |  Branch (1079:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1340|     69|	bits == NULL || (rowstride_bytes % sizeof (uint32_t)) == 0, NULL);
 1341|       |
 1342|     69|    return_val_if_fail (PIXMAN_FORMAT_BPP (format) >= PIXMAN_FORMAT_DEPTH (format), NULL);
  ------------------
  |  | 1071|     69|    do                                                                  \
  |  | 1072|     69|    {                                                                   \
  |  | 1073|     69|	if (unlikely (!(expr)))                                         \
  |  |  ------------------
  |  |  |  |   22|     69|#  define unlikely(expr) __builtin_expect ((expr), 0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (22:26): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1074|     69|	{								\
  |  | 1075|      0|	    _pixman_log_error (FUNC, "The expression " # expr " was false"); \
  |  |  ------------------
  |  |  |  |   14|      0|#  define FUNC     ((const char*) (__PRETTY_FUNCTION__))
  |  |  ------------------
  |  | 1076|      0|	    return (retval);						\
  |  | 1077|      0|	}								\
  |  | 1078|     69|    }                                                                   \
  |  | 1079|     69|    while (0)
  |  |  ------------------
  |  |  |  Branch (1079:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1343|       |
 1344|     69|    image = _pixman_image_allocate ();
 1345|       |
 1346|     69|    if (!image)
  ------------------
  |  Branch (1346:9): [True: 0, False: 69]
  ------------------
 1347|      0|	return NULL;
 1348|       |
 1349|     69|    if (!_pixman_bits_image_init (image, format, width, height, bits,
  ------------------
  |  Branch (1349:9): [True: 0, False: 69]
  ------------------
 1350|     69|				  rowstride_bytes / (int) sizeof (uint32_t),
 1351|     69|				  clear))
 1352|      0|    {
 1353|      0|	free (image);
 1354|      0|	return NULL;
 1355|      0|    }
 1356|       |
 1357|     69|    return image;
 1358|     69|}

_pixman_setup_combiner_functions_float:
 1033|      2|{
 1034|       |    /* Unified alpha */
 1035|      2|    imp->combine_float[PIXMAN_OP_CLEAR] = combine_clear_u_float;
 1036|      2|    imp->combine_float[PIXMAN_OP_SRC] = combine_src_u_float;
 1037|      2|    imp->combine_float[PIXMAN_OP_DST] = combine_dst_u_float;
 1038|      2|    imp->combine_float[PIXMAN_OP_OVER] = combine_over_u_float;
 1039|      2|    imp->combine_float[PIXMAN_OP_OVER_REVERSE] = combine_over_reverse_u_float;
 1040|      2|    imp->combine_float[PIXMAN_OP_IN] = combine_in_u_float;
 1041|      2|    imp->combine_float[PIXMAN_OP_IN_REVERSE] = combine_in_reverse_u_float;
 1042|      2|    imp->combine_float[PIXMAN_OP_OUT] = combine_out_u_float;
 1043|      2|    imp->combine_float[PIXMAN_OP_OUT_REVERSE] = combine_out_reverse_u_float;
 1044|      2|    imp->combine_float[PIXMAN_OP_ATOP] = combine_atop_u_float;
 1045|      2|    imp->combine_float[PIXMAN_OP_ATOP_REVERSE] = combine_atop_reverse_u_float;
 1046|      2|    imp->combine_float[PIXMAN_OP_XOR] = combine_xor_u_float;
 1047|      2|    imp->combine_float[PIXMAN_OP_ADD] = combine_add_u_float;
 1048|      2|    imp->combine_float[PIXMAN_OP_SATURATE] = combine_saturate_u_float;
 1049|       |
 1050|       |    /* Disjoint, unified */
 1051|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_CLEAR] = combine_disjoint_clear_u_float;
 1052|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_SRC] = combine_disjoint_src_u_float;
 1053|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_DST] = combine_disjoint_dst_u_float;
 1054|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_OVER] = combine_disjoint_over_u_float;
 1055|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_OVER_REVERSE] = combine_disjoint_over_reverse_u_float;
 1056|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_IN] = combine_disjoint_in_u_float;
 1057|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_IN_REVERSE] = combine_disjoint_in_reverse_u_float;
 1058|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_OUT] = combine_disjoint_out_u_float;
 1059|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_OUT_REVERSE] = combine_disjoint_out_reverse_u_float;
 1060|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_ATOP] = combine_disjoint_atop_u_float;
 1061|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = combine_disjoint_atop_reverse_u_float;
 1062|      2|    imp->combine_float[PIXMAN_OP_DISJOINT_XOR] = combine_disjoint_xor_u_float;
 1063|       |
 1064|       |    /* Conjoint, unified */
 1065|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_CLEAR] = combine_conjoint_clear_u_float;
 1066|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_SRC] = combine_conjoint_src_u_float;
 1067|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_DST] = combine_conjoint_dst_u_float;
 1068|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_OVER] = combine_conjoint_over_u_float;
 1069|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_OVER_REVERSE] = combine_conjoint_over_reverse_u_float;
 1070|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_IN] = combine_conjoint_in_u_float;
 1071|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_IN_REVERSE] = combine_conjoint_in_reverse_u_float;
 1072|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_OUT] = combine_conjoint_out_u_float;
 1073|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_OUT_REVERSE] = combine_conjoint_out_reverse_u_float;
 1074|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_ATOP] = combine_conjoint_atop_u_float;
 1075|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = combine_conjoint_atop_reverse_u_float;
 1076|      2|    imp->combine_float[PIXMAN_OP_CONJOINT_XOR] = combine_conjoint_xor_u_float;
 1077|       |
 1078|       |    /* PDF operators, unified */
 1079|      2|    imp->combine_float[PIXMAN_OP_MULTIPLY] = combine_multiply_u_float;
 1080|      2|    imp->combine_float[PIXMAN_OP_SCREEN] = combine_screen_u_float;
 1081|      2|    imp->combine_float[PIXMAN_OP_OVERLAY] = combine_overlay_u_float;
 1082|      2|    imp->combine_float[PIXMAN_OP_DARKEN] = combine_darken_u_float;
 1083|      2|    imp->combine_float[PIXMAN_OP_LIGHTEN] = combine_lighten_u_float;
 1084|      2|    imp->combine_float[PIXMAN_OP_COLOR_DODGE] = combine_color_dodge_u_float;
 1085|      2|    imp->combine_float[PIXMAN_OP_COLOR_BURN] = combine_color_burn_u_float;
 1086|      2|    imp->combine_float[PIXMAN_OP_HARD_LIGHT] = combine_hard_light_u_float;
 1087|      2|    imp->combine_float[PIXMAN_OP_SOFT_LIGHT] = combine_soft_light_u_float;
 1088|      2|    imp->combine_float[PIXMAN_OP_DIFFERENCE] = combine_difference_u_float;
 1089|      2|    imp->combine_float[PIXMAN_OP_EXCLUSION] = combine_exclusion_u_float;
 1090|       |
 1091|      2|    imp->combine_float[PIXMAN_OP_HSL_HUE] = combine_hsl_hue_u_float;
 1092|      2|    imp->combine_float[PIXMAN_OP_HSL_SATURATION] = combine_hsl_saturation_u_float;
 1093|      2|    imp->combine_float[PIXMAN_OP_HSL_COLOR] = combine_hsl_color_u_float;
 1094|      2|    imp->combine_float[PIXMAN_OP_HSL_LUMINOSITY] = combine_hsl_luminosity_u_float;
 1095|       |
 1096|       |    /* Component alpha combiners */
 1097|      2|    imp->combine_float_ca[PIXMAN_OP_CLEAR] = combine_clear_ca_float;
 1098|      2|    imp->combine_float_ca[PIXMAN_OP_SRC] = combine_src_ca_float;
 1099|      2|    imp->combine_float_ca[PIXMAN_OP_DST] = combine_dst_ca_float;
 1100|      2|    imp->combine_float_ca[PIXMAN_OP_OVER] = combine_over_ca_float;
 1101|      2|    imp->combine_float_ca[PIXMAN_OP_OVER_REVERSE] = combine_over_reverse_ca_float;
 1102|      2|    imp->combine_float_ca[PIXMAN_OP_IN] = combine_in_ca_float;
 1103|      2|    imp->combine_float_ca[PIXMAN_OP_IN_REVERSE] = combine_in_reverse_ca_float;
 1104|      2|    imp->combine_float_ca[PIXMAN_OP_OUT] = combine_out_ca_float;
 1105|      2|    imp->combine_float_ca[PIXMAN_OP_OUT_REVERSE] = combine_out_reverse_ca_float;
 1106|      2|    imp->combine_float_ca[PIXMAN_OP_ATOP] = combine_atop_ca_float;
 1107|      2|    imp->combine_float_ca[PIXMAN_OP_ATOP_REVERSE] = combine_atop_reverse_ca_float;
 1108|      2|    imp->combine_float_ca[PIXMAN_OP_XOR] = combine_xor_ca_float;
 1109|      2|    imp->combine_float_ca[PIXMAN_OP_ADD] = combine_add_ca_float;
 1110|      2|    imp->combine_float_ca[PIXMAN_OP_SATURATE] = combine_saturate_ca_float;
 1111|       |
 1112|       |    /* Disjoint CA */
 1113|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_CLEAR] = combine_disjoint_clear_ca_float;
 1114|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_SRC] = combine_disjoint_src_ca_float;
 1115|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_DST] = combine_disjoint_dst_ca_float;
 1116|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_OVER] = combine_disjoint_over_ca_float;
 1117|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_OVER_REVERSE] = combine_disjoint_over_reverse_ca_float;
 1118|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_IN] = combine_disjoint_in_ca_float;
 1119|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_IN_REVERSE] = combine_disjoint_in_reverse_ca_float;
 1120|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_OUT] = combine_disjoint_out_ca_float;
 1121|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_OUT_REVERSE] = combine_disjoint_out_reverse_ca_float;
 1122|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_ATOP] = combine_disjoint_atop_ca_float;
 1123|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = combine_disjoint_atop_reverse_ca_float;
 1124|      2|    imp->combine_float_ca[PIXMAN_OP_DISJOINT_XOR] = combine_disjoint_xor_ca_float;
 1125|       |
 1126|       |    /* Conjoint CA */
 1127|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_CLEAR] = combine_conjoint_clear_ca_float;
 1128|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_SRC] = combine_conjoint_src_ca_float;
 1129|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_DST] = combine_conjoint_dst_ca_float;
 1130|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_OVER] = combine_conjoint_over_ca_float;
 1131|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_OVER_REVERSE] = combine_conjoint_over_reverse_ca_float;
 1132|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_IN] = combine_conjoint_in_ca_float;
 1133|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_IN_REVERSE] = combine_conjoint_in_reverse_ca_float;
 1134|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_OUT] = combine_conjoint_out_ca_float;
 1135|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_OUT_REVERSE] = combine_conjoint_out_reverse_ca_float;
 1136|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_ATOP] = combine_conjoint_atop_ca_float;
 1137|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = combine_conjoint_atop_reverse_ca_float;
 1138|      2|    imp->combine_float_ca[PIXMAN_OP_CONJOINT_XOR] = combine_conjoint_xor_ca_float;
 1139|       |
 1140|       |    /* PDF operators CA */
 1141|      2|    imp->combine_float_ca[PIXMAN_OP_MULTIPLY] = combine_multiply_ca_float;
 1142|      2|    imp->combine_float_ca[PIXMAN_OP_SCREEN] = combine_screen_ca_float;
 1143|      2|    imp->combine_float_ca[PIXMAN_OP_OVERLAY] = combine_overlay_ca_float;
 1144|      2|    imp->combine_float_ca[PIXMAN_OP_DARKEN] = combine_darken_ca_float;
 1145|      2|    imp->combine_float_ca[PIXMAN_OP_LIGHTEN] = combine_lighten_ca_float;
 1146|      2|    imp->combine_float_ca[PIXMAN_OP_COLOR_DODGE] = combine_color_dodge_ca_float;
 1147|      2|    imp->combine_float_ca[PIXMAN_OP_COLOR_BURN] = combine_color_burn_ca_float;
 1148|      2|    imp->combine_float_ca[PIXMAN_OP_HARD_LIGHT] = combine_hard_light_ca_float;
 1149|      2|    imp->combine_float_ca[PIXMAN_OP_SOFT_LIGHT] = combine_soft_light_ca_float;
 1150|      2|    imp->combine_float_ca[PIXMAN_OP_DIFFERENCE] = combine_difference_ca_float;
 1151|      2|    imp->combine_float_ca[PIXMAN_OP_EXCLUSION] = combine_exclusion_ca_float;
 1152|       |
 1153|       |    /* It is not clear that these make sense, so make them noops for now */
 1154|      2|    imp->combine_float_ca[PIXMAN_OP_HSL_HUE] = combine_dst_u_float;
 1155|      2|    imp->combine_float_ca[PIXMAN_OP_HSL_SATURATION] = combine_dst_u_float;
 1156|      2|    imp->combine_float_ca[PIXMAN_OP_HSL_COLOR] = combine_dst_u_float;
 1157|      2|    imp->combine_float_ca[PIXMAN_OP_HSL_LUMINOSITY] = combine_dst_u_float;
 1158|      2|}

_pixman_setup_combiner_functions_32:
 1141|      2|{
 1142|       |    /* Unified alpha */
 1143|      2|    imp->combine_32[PIXMAN_OP_CLEAR] = combine_clear;
 1144|      2|    imp->combine_32[PIXMAN_OP_SRC] = combine_src_u;
 1145|      2|    imp->combine_32[PIXMAN_OP_DST] = combine_dst;
 1146|      2|    imp->combine_32[PIXMAN_OP_OVER] = combine_over_u;
 1147|      2|    imp->combine_32[PIXMAN_OP_OVER_REVERSE] = combine_over_reverse_u;
 1148|      2|    imp->combine_32[PIXMAN_OP_IN] = combine_in_u;
 1149|      2|    imp->combine_32[PIXMAN_OP_IN_REVERSE] = combine_in_reverse_u;
 1150|      2|    imp->combine_32[PIXMAN_OP_OUT] = combine_out_u;
 1151|      2|    imp->combine_32[PIXMAN_OP_OUT_REVERSE] = combine_out_reverse_u;
 1152|      2|    imp->combine_32[PIXMAN_OP_ATOP] = combine_atop_u;
 1153|      2|    imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = combine_atop_reverse_u;
 1154|      2|    imp->combine_32[PIXMAN_OP_XOR] = combine_xor_u;
 1155|      2|    imp->combine_32[PIXMAN_OP_ADD] = combine_add_u;
 1156|       |
 1157|      2|    imp->combine_32[PIXMAN_OP_MULTIPLY] = combine_multiply_u;
 1158|      2|    imp->combine_32[PIXMAN_OP_SCREEN] = combine_screen_u;
 1159|      2|    imp->combine_32[PIXMAN_OP_OVERLAY] = combine_overlay_u;
 1160|      2|    imp->combine_32[PIXMAN_OP_DARKEN] = combine_darken_u;
 1161|      2|    imp->combine_32[PIXMAN_OP_LIGHTEN] = combine_lighten_u;
 1162|      2|    imp->combine_32[PIXMAN_OP_HARD_LIGHT] = combine_hard_light_u;
 1163|      2|    imp->combine_32[PIXMAN_OP_DIFFERENCE] = combine_difference_u;
 1164|      2|    imp->combine_32[PIXMAN_OP_EXCLUSION] = combine_exclusion_u;
 1165|       |
 1166|       |    /* Component alpha combiners */
 1167|      2|    imp->combine_32_ca[PIXMAN_OP_CLEAR] = combine_clear_ca;
 1168|      2|    imp->combine_32_ca[PIXMAN_OP_SRC] = combine_src_ca;
 1169|       |    /* dest */
 1170|      2|    imp->combine_32_ca[PIXMAN_OP_OVER] = combine_over_ca;
 1171|      2|    imp->combine_32_ca[PIXMAN_OP_OVER_REVERSE] = combine_over_reverse_ca;
 1172|      2|    imp->combine_32_ca[PIXMAN_OP_IN] = combine_in_ca;
 1173|      2|    imp->combine_32_ca[PIXMAN_OP_IN_REVERSE] = combine_in_reverse_ca;
 1174|      2|    imp->combine_32_ca[PIXMAN_OP_OUT] = combine_out_ca;
 1175|      2|    imp->combine_32_ca[PIXMAN_OP_OUT_REVERSE] = combine_out_reverse_ca;
 1176|      2|    imp->combine_32_ca[PIXMAN_OP_ATOP] = combine_atop_ca;
 1177|      2|    imp->combine_32_ca[PIXMAN_OP_ATOP_REVERSE] = combine_atop_reverse_ca;
 1178|      2|    imp->combine_32_ca[PIXMAN_OP_XOR] = combine_xor_ca;
 1179|      2|    imp->combine_32_ca[PIXMAN_OP_ADD] = combine_add_ca;
 1180|       |
 1181|      2|    imp->combine_32_ca[PIXMAN_OP_MULTIPLY] = combine_multiply_ca;
 1182|      2|    imp->combine_32_ca[PIXMAN_OP_SCREEN] = combine_screen_ca;
 1183|      2|    imp->combine_32_ca[PIXMAN_OP_OVERLAY] = combine_overlay_ca;
 1184|      2|    imp->combine_32_ca[PIXMAN_OP_DARKEN] = combine_darken_ca;
 1185|      2|    imp->combine_32_ca[PIXMAN_OP_LIGHTEN] = combine_lighten_ca;
 1186|      2|    imp->combine_32_ca[PIXMAN_OP_HARD_LIGHT] = combine_hard_light_ca;
 1187|      2|    imp->combine_32_ca[PIXMAN_OP_DIFFERENCE] = combine_difference_ca;
 1188|      2|    imp->combine_32_ca[PIXMAN_OP_EXCLUSION] = combine_exclusion_ca;
 1189|      2|}

_pixman_implementation_create_fast_path:
 3287|      2|{
 3288|      2|    pixman_implementation_t *imp = _pixman_implementation_create (fallback, c_fast_paths);
 3289|       |
 3290|      2|    imp->fill = fast_path_fill;
 3291|      2|    imp->iter_info = fast_iters;
 3292|       |
 3293|      2|    return imp;
 3294|      2|}

_pixman_implementation_create_general:
  254|      2|{
  255|      2|    pixman_implementation_t *imp = _pixman_implementation_create (NULL, general_fast_path);
  256|       |
  257|      2|    _pixman_setup_combiner_functions_32 (imp);
  258|      2|    _pixman_setup_combiner_functions_float (imp);
  259|       |
  260|      2|    imp->iter_info = general_iters;
  261|       |
  262|      2|    return imp;
  263|      2|}

_pixman_image_init:
  111|    138|{
  112|    138|    image_common_t *common = &image->common;
  113|       |
  114|    138|    pixman_region32_init (&common->clip_region);
  115|       |
  116|    138|    common->alpha_count = 0;
  117|    138|    common->have_clip_region = FALSE;
  ------------------
  |  |  913|    138|#   define FALSE 0
  ------------------
  118|    138|    common->clip_sources = FALSE;
  ------------------
  |  |  913|    138|#   define FALSE 0
  ------------------
  119|    138|    common->transform = NULL;
  120|    138|    common->repeat = PIXMAN_REPEAT_NONE;
  121|    138|    common->filter = PIXMAN_FILTER_NEAREST;
  122|    138|    common->filter_params = NULL;
  123|    138|    common->n_filter_params = 0;
  124|    138|    common->alpha_map = NULL;
  125|    138|    common->component_alpha = FALSE;
  ------------------
  |  |  913|    138|#   define FALSE 0
  ------------------
  126|    138|    common->ref_count = 1;
  127|    138|    common->property_changed = NULL;
  128|    138|    common->client_clip = FALSE;
  ------------------
  |  |  913|    138|#   define FALSE 0
  ------------------
  129|    138|    common->destroy_func = NULL;
  130|    138|    common->destroy_data = NULL;
  131|    138|    common->dirty = TRUE;
  ------------------
  |  |  917|    138|#   define TRUE 1
  ------------------
  132|    138|}
_pixman_image_fini:
  136|     69|{
  137|     69|    image_common_t *common = (image_common_t *)image;
  138|       |
  139|     69|    common->ref_count--;
  140|       |
  141|     69|    if (common->ref_count == 0)
  ------------------
  |  Branch (141:9): [True: 69, False: 0]
  ------------------
  142|     69|    {
  143|     69|	if (image->common.destroy_func)
  ------------------
  |  Branch (143:6): [True: 0, False: 69]
  ------------------
  144|      0|	    image->common.destroy_func (image, image->common.destroy_data);
  145|       |
  146|     69|	pixman_region32_fini (&common->clip_region);
  147|       |
  148|     69|	free (common->transform);
  149|     69|	free (common->filter_params);
  150|       |
  151|     69|	if (common->alpha_map)
  ------------------
  |  Branch (151:6): [True: 0, False: 69]
  ------------------
  152|      0|	    pixman_image_unref ((pixman_image_t *)common->alpha_map);
  153|       |
  154|     69|	if (image->type == LINEAR ||
  ------------------
  |  Branch (154:6): [True: 0, False: 69]
  ------------------
  155|     69|	    image->type == RADIAL ||
  ------------------
  |  Branch (155:6): [True: 0, False: 69]
  ------------------
  156|     69|	    image->type == CONICAL)
  ------------------
  |  Branch (156:6): [True: 0, False: 69]
  ------------------
  157|      0|	{
  158|      0|	    if (image->gradient.stops)
  ------------------
  |  Branch (158:10): [True: 0, False: 0]
  ------------------
  159|      0|	    {
  160|       |		/* See _pixman_init_gradient() for an explanation of the - 1 */
  161|      0|		free (image->gradient.stops - 1);
  162|      0|	    }
  163|       |
  164|       |	    /* This will trigger if someone adds a property_changed
  165|       |	     * method to the linear/radial/conical gradient overwriting
  166|       |	     * the general one.
  167|       |	     */
  168|      0|	    assert (
  169|      0|		image->common.property_changed == gradient_property_changed);
  170|      0|	}
  171|       |
  172|     69|	if (image->type == BITS && image->bits.free_me)
  ------------------
  |  Branch (172:6): [True: 69, False: 0]
  |  Branch (172:29): [True: 0, False: 69]
  ------------------
  173|      0|	    free (image->bits.free_me);
  174|       |
  175|     69|	return TRUE;
  ------------------
  |  |  917|     69|#   define TRUE 1
  ------------------
  176|     69|    }
  177|       |
  178|      0|    return FALSE;
  ------------------
  |  |  913|      0|#   define FALSE 0
  ------------------
  179|     69|}
_pixman_image_allocate:
  183|     69|{
  184|     69|    pixman_image_t *image = malloc (sizeof (pixman_image_t));
  185|       |
  186|     69|    if (image)
  ------------------
  |  Branch (186:9): [True: 69, False: 0]
  ------------------
  187|     69|	_pixman_image_init (image);
  188|       |
  189|     69|    return image;
  190|     69|}
pixman_image_unref:
  210|     69|{
  211|     69|    if (_pixman_image_fini (image))
  ------------------
  |  Branch (211:9): [True: 69, False: 0]
  ------------------
  212|     69|    {
  213|     69|	free (image);
  214|     69|	return TRUE;
  ------------------
  |  |  917|     69|#   define TRUE 1
  ------------------
  215|     69|    }
  216|       |
  217|      0|    return FALSE;
  ------------------
  |  |  913|      0|#   define FALSE 0
  ------------------
  218|     69|}
_pixman_image_reset_clip_region:
  237|     69|{
  238|     69|    image->common.have_clip_region = FALSE;
  ------------------
  |  |  913|     69|#   define FALSE 0
  ------------------
  239|     69|}
pixman_image_get_data:
  893|     69|{
  894|     69|    if (image->type == BITS)
  ------------------
  |  Branch (894:9): [True: 69, False: 0]
  ------------------
  895|     69|	return image->bits.bits;
  896|       |
  897|      0|    return NULL;
  898|     69|}
pixman_image_get_width:
  902|     69|{
  903|     69|    if (image->type == BITS)
  ------------------
  |  Branch (903:9): [True: 69, False: 0]
  ------------------
  904|     69|	return image->bits.width;
  905|       |
  906|      0|    return 0;
  907|     69|}
pixman_image_get_height:
  911|     69|{
  912|     69|    if (image->type == BITS)
  ------------------
  |  Branch (912:9): [True: 69, False: 0]
  ------------------
  913|     69|	return image->bits.height;
  914|       |
  915|      0|    return 0;
  916|     69|}
pixman_image_get_stride:
  920|     69|{
  921|     69|    if (image->type == BITS)
  ------------------
  |  Branch (921:9): [True: 69, False: 0]
  ------------------
  922|     69|	return image->bits.rowstride * (int) sizeof (uint32_t);
  923|       |
  924|      0|    return 0;
  925|     69|}
pixman_image_get_depth:
  929|     69|{
  930|     69|    if (image->type == BITS)
  ------------------
  |  Branch (930:9): [True: 69, False: 0]
  ------------------
  931|     69|	return PIXMAN_FORMAT_DEPTH (image->bits.format);
  ------------------
  |  |  852|     69|#define PIXMAN_FORMAT_DEPTH(f)	(PIXMAN_FORMAT_A(f) +	\
  |  |  ------------------
  |  |  |  |  846|     69|#define PIXMAN_FORMAT_A(f)	PIXMAN_FORMAT_RESHIFT(f, 12, 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |  841|     69|	(((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  853|     69|				 PIXMAN_FORMAT_R(f) +	\
  |  |  ------------------
  |  |  |  |  847|     69|#define PIXMAN_FORMAT_R(f)	PIXMAN_FORMAT_RESHIFT(f, 8, 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |  841|     69|	(((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  854|     69|				 PIXMAN_FORMAT_G(f) +	\
  |  |  ------------------
  |  |  |  |  848|     69|#define PIXMAN_FORMAT_G(f)	PIXMAN_FORMAT_RESHIFT(f, 4, 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |  841|     69|	(((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  855|     69|				 PIXMAN_FORMAT_B(f))
  |  |  ------------------
  |  |  |  |  849|     69|#define PIXMAN_FORMAT_B(f)	PIXMAN_FORMAT_RESHIFT(f, 0, 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |  841|     69|	(((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  932|       |
  933|      0|    return 0;
  934|     69|}

_pixman_implementation_create:
   33|     12|{
   34|     12|    pixman_implementation_t *imp;
   35|       |
   36|     12|    assert (fast_paths);
   37|       |
   38|     12|    if ((imp = malloc (sizeof (pixman_implementation_t))))
  ------------------
  |  Branch (38:9): [True: 12, False: 0]
  ------------------
   39|     12|    {
   40|     12|	pixman_implementation_t *d;
   41|       |
   42|     12|	memset (imp, 0, sizeof *imp);
   43|       |
   44|     12|	imp->fallback = fallback;
   45|     12|	imp->fast_paths = fast_paths;
   46|       |	
   47|       |	/* Make sure the whole fallback chain has the right toplevel */
   48|     54|	for (d = imp; d != NULL; d = d->fallback)
  ------------------
  |  Branch (48:16): [True: 42, False: 12]
  ------------------
   49|     42|	    d->toplevel = imp;
   50|     12|    }
   51|       |
   52|     12|    return imp;
   53|     12|}
_pixman_disabled:
  354|     10|{
  355|     10|    const char *env;
  356|       |
  357|     10|    if ((env = getenv ("PIXMAN_DISABLE")))
  ------------------
  |  Branch (357:9): [True: 0, False: 10]
  ------------------
  358|      0|    {
  359|      0|	do
  360|      0|	{
  361|      0|	    const char *end;
  362|      0|	    int len;
  363|       |
  364|      0|	    if ((end = strchr (env, ' ')))
  ------------------
  |  Branch (364:10): [True: 0, False: 0]
  ------------------
  365|      0|		len = end - env;
  366|      0|	    else
  367|      0|		len = strlen (env);
  368|       |
  369|      0|	    if (strlen (name) == len && strncmp (name, env, len) == 0)
  ------------------
  |  Branch (369:10): [True: 0, False: 0]
  |  Branch (369:34): [True: 0, False: 0]
  ------------------
  370|      0|	    {
  371|      0|		printf ("pixman: Disabled %s implementation\n", name);
  372|      0|		return TRUE;
  ------------------
  |  |  917|      0|#   define TRUE 1
  ------------------
  373|      0|	    }
  374|       |
  375|      0|	    env += len;
  376|      0|	}
  377|      0|	while (*env++);
  ------------------
  |  Branch (377:9): [True: 0, False: 0]
  ------------------
  378|      0|    }
  379|       |
  380|     10|    return FALSE;
  ------------------
  |  |  913|     10|#   define FALSE 0
  ------------------
  381|     10|}
_pixman_choose_implementation:
  390|      2|{
  391|      2|    pixman_implementation_t *imp;
  392|       |
  393|      2|    imp = _pixman_implementation_create_general();
  394|       |
  395|      2|    if (!_pixman_disabled ("fast"))
  ------------------
  |  Branch (395:9): [True: 2, False: 0]
  ------------------
  396|      2|	imp = _pixman_implementation_create_fast_path (imp);
  397|       |
  398|      2|    imp = _pixman_x86_get_implementations (imp);
  399|      2|    imp = _pixman_arm_get_implementations (imp);
  400|      2|    imp = _pixman_ppc_get_implementations (imp);
  401|      2|    imp = _pixman_mips_get_implementations (imp);
  402|       |
  403|      2|    imp = _pixman_implementation_create_noop (imp);
  404|       |
  405|      2|    if (_pixman_disabled ("wholeops"))
  ------------------
  |  Branch (405:9): [True: 0, False: 2]
  ------------------
  406|      0|    {
  407|      0|        pixman_implementation_t *cur;
  408|       |
  409|       |        /* Disable all whole-operation paths except the general one,
  410|       |         * so that optimized iterators are used as much as possible.
  411|       |         */
  412|      0|        for (cur = imp; cur->fallback; cur = cur->fallback)
  ------------------
  |  Branch (412:25): [True: 0, False: 0]
  ------------------
  413|      0|            cur->fast_paths = empty_fast_path;
  414|      0|    }
  415|       |
  416|      2|    return imp;
  417|      2|}

_pixman_mips_get_implementations:
   70|      2|{
   71|       |#ifdef USE_LOONGSON_MMI
   72|       |    /* I really don't know if some Loongson CPUs don't have MMI. */
   73|       |    if (!_pixman_disabled ("loongson-mmi") && have_feature ("Loongson"))
   74|       |	imp = _pixman_implementation_create_mmx (imp);
   75|       |#endif
   76|       |
   77|       |#ifdef USE_MIPS_DSPR2
   78|       |    if (!_pixman_disabled ("mips-dspr2"))
   79|       |    {
   80|       |	int already_compiling_everything_for_dspr2 = 0;
   81|       |#if defined(__mips_dsp) && (__mips_dsp_rev >= 2)
   82|       |	already_compiling_everything_for_dspr2 = 1;
   83|       |#endif
   84|       |	if (already_compiling_everything_for_dspr2 ||
   85|       |	    /* Only currently available MIPS core that supports DSPr2 is 74K. */
   86|       |	    have_feature ("MIPS 74K"))
   87|       |	{
   88|       |	    imp = _pixman_implementation_create_mips_dspr2 (imp);
   89|       |	}
   90|       |    }
   91|       |#endif
   92|       |
   93|      2|    return imp;
   94|      2|}

_pixman_implementation_create_mmx:
 4118|      2|{
 4119|      2|    pixman_implementation_t *imp = _pixman_implementation_create (fallback, mmx_fast_paths);
 4120|       |
 4121|      2|    imp->combine_32[PIXMAN_OP_OVER] = mmx_combine_over_u;
 4122|      2|    imp->combine_32[PIXMAN_OP_OVER_REVERSE] = mmx_combine_over_reverse_u;
 4123|      2|    imp->combine_32[PIXMAN_OP_IN] = mmx_combine_in_u;
 4124|      2|    imp->combine_32[PIXMAN_OP_IN_REVERSE] = mmx_combine_in_reverse_u;
 4125|      2|    imp->combine_32[PIXMAN_OP_OUT] = mmx_combine_out_u;
 4126|      2|    imp->combine_32[PIXMAN_OP_OUT_REVERSE] = mmx_combine_out_reverse_u;
 4127|      2|    imp->combine_32[PIXMAN_OP_ATOP] = mmx_combine_atop_u;
 4128|      2|    imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = mmx_combine_atop_reverse_u;
 4129|      2|    imp->combine_32[PIXMAN_OP_XOR] = mmx_combine_xor_u;
 4130|      2|    imp->combine_32[PIXMAN_OP_ADD] = mmx_combine_add_u;
 4131|      2|    imp->combine_32[PIXMAN_OP_SATURATE] = mmx_combine_saturate_u;
 4132|       |
 4133|      2|    imp->combine_32_ca[PIXMAN_OP_SRC] = mmx_combine_src_ca;
 4134|      2|    imp->combine_32_ca[PIXMAN_OP_OVER] = mmx_combine_over_ca;
 4135|      2|    imp->combine_32_ca[PIXMAN_OP_OVER_REVERSE] = mmx_combine_over_reverse_ca;
 4136|      2|    imp->combine_32_ca[PIXMAN_OP_IN] = mmx_combine_in_ca;
 4137|      2|    imp->combine_32_ca[PIXMAN_OP_IN_REVERSE] = mmx_combine_in_reverse_ca;
 4138|      2|    imp->combine_32_ca[PIXMAN_OP_OUT] = mmx_combine_out_ca;
 4139|      2|    imp->combine_32_ca[PIXMAN_OP_OUT_REVERSE] = mmx_combine_out_reverse_ca;
 4140|      2|    imp->combine_32_ca[PIXMAN_OP_ATOP] = mmx_combine_atop_ca;
 4141|      2|    imp->combine_32_ca[PIXMAN_OP_ATOP_REVERSE] = mmx_combine_atop_reverse_ca;
 4142|      2|    imp->combine_32_ca[PIXMAN_OP_XOR] = mmx_combine_xor_ca;
 4143|      2|    imp->combine_32_ca[PIXMAN_OP_ADD] = mmx_combine_add_ca;
 4144|       |
 4145|      2|    imp->blt = mmx_blt;
 4146|      2|    imp->fill = mmx_fill;
 4147|       |
 4148|      2|    imp->iter_info = mmx_iters;
 4149|       |
 4150|      2|    return imp;
 4151|      2|}

_pixman_implementation_create_noop:
  154|      2|{
  155|      2|    pixman_implementation_t *imp =
  156|      2|	_pixman_implementation_create (fallback, noop_fast_paths);
  157|       | 
  158|      2|    imp->iter_info = noop_iters;
  159|       |
  160|      2|    return imp;
  161|      2|}

_pixman_ppc_get_implementations:
  166|      2|{
  167|       |#ifdef USE_VMX
  168|       |    if (!_pixman_disabled ("vmx") && pixman_have_vmx ())
  169|       |	imp = _pixman_implementation_create_vmx (imp);
  170|       |#endif
  171|       |
  172|      2|    return imp;
  173|      2|}

pixman_region32_init:
  369|    138|{
  370|    138|    region->extents = *pixman_region_empty_box;
  371|    138|    region->data = pixman_region_empty_data;
  372|    138|}
pixman_region32_fini:
  414|     69|{
  415|     69|    GOOD (region);
  416|     69|    FREE_DATA (region);
  ------------------
  |  |  216|     69|#define FREE_DATA(reg) if ((reg)->data && (reg)->data->size) free ((reg)->data)
  |  |  ------------------
  |  |  |  Branch (216:28): [True: 69, False: 0]
  |  |  |  Branch (216:43): [True: 0, False: 69]
  |  |  ------------------
  ------------------
  417|     69|}

_pixman_implementation_create_sse2:
 6456|      2|{
 6457|      2|    pixman_implementation_t *imp = _pixman_implementation_create (fallback, sse2_fast_paths);
 6458|       |
 6459|       |    /* SSE2 constants */
 6460|      2|    mask_565_r  = create_mask_2x32_128 (0x00f80000, 0x00f80000);
 6461|      2|    mask_565_g1 = create_mask_2x32_128 (0x00070000, 0x00070000);
 6462|      2|    mask_565_g2 = create_mask_2x32_128 (0x000000e0, 0x000000e0);
 6463|      2|    mask_565_b  = create_mask_2x32_128 (0x0000001f, 0x0000001f);
 6464|      2|    mask_red   = create_mask_2x32_128 (0x00f80000, 0x00f80000);
 6465|      2|    mask_green = create_mask_2x32_128 (0x0000fc00, 0x0000fc00);
 6466|      2|    mask_blue  = create_mask_2x32_128 (0x000000f8, 0x000000f8);
 6467|      2|    mask_565_fix_rb = create_mask_2x32_128 (0x00e000e0, 0x00e000e0);
 6468|      2|    mask_565_fix_g = create_mask_2x32_128  (0x0000c000, 0x0000c000);
 6469|      2|    mask_0080 = create_mask_16_128 (0x0080);
 6470|      2|    mask_00ff = create_mask_16_128 (0x00ff);
 6471|      2|    mask_0101 = create_mask_16_128 (0x0101);
 6472|      2|    mask_ffff = create_mask_16_128 (0xffff);
 6473|      2|    mask_ff000000 = create_mask_2x32_128 (0xff000000, 0xff000000);
 6474|      2|    mask_alpha = create_mask_2x32_128 (0x00ff0000, 0x00000000);
 6475|      2|    mask_565_rb = create_mask_2x32_128 (0x00f800f8, 0x00f800f8);
 6476|      2|    mask_565_pack_multiplier = create_mask_2x32_128 (0x20000004, 0x20000004);
 6477|       |
 6478|       |    /* Set up function pointers */
 6479|      2|    imp->combine_32[PIXMAN_OP_OVER] = sse2_combine_over_u;
 6480|      2|    imp->combine_32[PIXMAN_OP_OVER_REVERSE] = sse2_combine_over_reverse_u;
 6481|      2|    imp->combine_32[PIXMAN_OP_IN] = sse2_combine_in_u;
 6482|      2|    imp->combine_32[PIXMAN_OP_IN_REVERSE] = sse2_combine_in_reverse_u;
 6483|      2|    imp->combine_32[PIXMAN_OP_OUT] = sse2_combine_out_u;
 6484|      2|    imp->combine_32[PIXMAN_OP_OUT_REVERSE] = sse2_combine_out_reverse_u;
 6485|      2|    imp->combine_32[PIXMAN_OP_ATOP] = sse2_combine_atop_u;
 6486|      2|    imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = sse2_combine_atop_reverse_u;
 6487|      2|    imp->combine_32[PIXMAN_OP_XOR] = sse2_combine_xor_u;
 6488|      2|    imp->combine_32[PIXMAN_OP_ADD] = sse2_combine_add_u;
 6489|       |
 6490|      2|    imp->combine_32[PIXMAN_OP_SATURATE] = sse2_combine_saturate_u;
 6491|       |
 6492|      2|    imp->combine_32_ca[PIXMAN_OP_SRC] = sse2_combine_src_ca;
 6493|      2|    imp->combine_32_ca[PIXMAN_OP_OVER] = sse2_combine_over_ca;
 6494|      2|    imp->combine_32_ca[PIXMAN_OP_OVER_REVERSE] = sse2_combine_over_reverse_ca;
 6495|      2|    imp->combine_32_ca[PIXMAN_OP_IN] = sse2_combine_in_ca;
 6496|      2|    imp->combine_32_ca[PIXMAN_OP_IN_REVERSE] = sse2_combine_in_reverse_ca;
 6497|      2|    imp->combine_32_ca[PIXMAN_OP_OUT] = sse2_combine_out_ca;
 6498|      2|    imp->combine_32_ca[PIXMAN_OP_OUT_REVERSE] = sse2_combine_out_reverse_ca;
 6499|      2|    imp->combine_32_ca[PIXMAN_OP_ATOP] = sse2_combine_atop_ca;
 6500|      2|    imp->combine_32_ca[PIXMAN_OP_ATOP_REVERSE] = sse2_combine_atop_reverse_ca;
 6501|      2|    imp->combine_32_ca[PIXMAN_OP_XOR] = sse2_combine_xor_ca;
 6502|      2|    imp->combine_32_ca[PIXMAN_OP_ADD] = sse2_combine_add_ca;
 6503|       |
 6504|      2|    imp->blt = sse2_blt;
 6505|      2|    imp->fill = sse2_fill;
 6506|       |
 6507|      2|    imp->iter_info = sse2_iters;
 6508|       |
 6509|      2|    return imp;
 6510|      2|}
pixman-sse2.c:create_mask_2x32_128:
 2368|     26|{
 2369|     26|    return _mm_set_epi32 (mask0, mask1, mask0, mask1);
 2370|     26|}
pixman-sse2.c:create_mask_16_128:
 2356|      8|{
 2357|      8|    return _mm_set1_epi16 (mask);
 2358|      8|}

_pixman_implementation_create_ssse3:
  344|      2|{
  345|      2|    pixman_implementation_t *imp =
  346|      2|	_pixman_implementation_create (fallback, ssse3_fast_paths);
  347|       |
  348|      2|    imp->iter_info = ssse3_iters;
  349|       |
  350|      2|    return imp;
  351|      2|}

_pixman_x86_get_implementations:
  173|      2|{
  174|      2|#define MMX_BITS  (X86_MMX | X86_MMX_EXTENSIONS)
  175|      2|#define SSE2_BITS (X86_MMX | X86_MMX_EXTENSIONS | X86_SSE | X86_SSE2)
  176|      2|#define SSSE3_BITS (X86_SSE | X86_SSE2 | X86_SSSE3)
  177|       |
  178|      2|#ifdef USE_X86_MMX
  179|      2|    if (!_pixman_disabled ("mmx") && have_feature (MMX_BITS))
  ------------------
  |  |  174|      2|#define MMX_BITS  (X86_MMX | X86_MMX_EXTENSIONS)
  ------------------
  |  Branch (179:9): [True: 2, False: 0]
  |  Branch (179:38): [True: 2, False: 0]
  ------------------
  180|      2|	imp = _pixman_implementation_create_mmx (imp);
  181|      2|#endif
  182|       |
  183|      2|#ifdef USE_SSE2
  184|      2|    if (!_pixman_disabled ("sse2") && have_feature (SSE2_BITS))
  ------------------
  |  |  175|      2|#define SSE2_BITS (X86_MMX | X86_MMX_EXTENSIONS | X86_SSE | X86_SSE2)
  ------------------
  |  Branch (184:9): [True: 2, False: 0]
  |  Branch (184:39): [True: 2, False: 0]
  ------------------
  185|      2|	imp = _pixman_implementation_create_sse2 (imp);
  186|      2|#endif
  187|       |
  188|      2|#ifdef USE_SSSE3
  189|      2|    if (!_pixman_disabled ("ssse3") && have_feature (SSSE3_BITS))
  ------------------
  |  |  176|      2|#define SSSE3_BITS (X86_SSE | X86_SSE2 | X86_SSSE3)
  ------------------
  |  Branch (189:9): [True: 2, False: 0]
  |  Branch (189:40): [True: 2, False: 0]
  ------------------
  190|      2|	imp = _pixman_implementation_create_ssse3 (imp);
  191|      2|#endif
  192|       |
  193|      2|    return imp;
  194|      2|}
pixman-x86.c:have_feature:
  156|      6|{
  157|      6|    static pixman_bool_t initialized;
  158|      6|    static cpu_features_t features;
  159|       |
  160|      6|    if (!initialized)
  ------------------
  |  Branch (160:9): [True: 2, False: 4]
  ------------------
  161|      2|    {
  162|      2|	features = detect_cpu_features();
  163|      2|	initialized = TRUE;
  ------------------
  |  |  917|      2|#   define TRUE 1
  ------------------
  164|      2|    }
  165|       |
  166|      6|    return (features & feature) == feature;
  167|      6|}
pixman-x86.c:detect_cpu_features:
  104|      2|{
  105|      2|    uint32_t a, b, c, d;
  106|      2|    cpu_features_t features = 0;
  107|       |
  108|       |    /* Get feature bits */
  109|      2|    pixman_cpuid (0x01, &a, &b, &c, &d);
  110|      2|    if (d & (1 << 15))
  ------------------
  |  Branch (110:9): [True: 2, False: 0]
  ------------------
  111|      2|	features |= X86_CMOV;
  112|      2|    if (d & (1 << 23))
  ------------------
  |  Branch (112:9): [True: 2, False: 0]
  ------------------
  113|      2|	features |= X86_MMX;
  114|      2|    if (d & (1 << 25))
  ------------------
  |  Branch (114:9): [True: 2, False: 0]
  ------------------
  115|      2|	features |= X86_SSE;
  116|      2|    if (d & (1 << 26))
  ------------------
  |  Branch (116:9): [True: 2, False: 0]
  ------------------
  117|      2|	features |= X86_SSE2;
  118|      2|    if (c & (1 << 9))
  ------------------
  |  Branch (118:9): [True: 2, False: 0]
  ------------------
  119|      2|	features |= X86_SSSE3;
  120|       |
  121|       |    /* Check for AMD specific features */
  122|      2|    if ((features & X86_MMX) && !(features & X86_SSE))
  ------------------
  |  Branch (122:9): [True: 2, False: 0]
  |  Branch (122:33): [True: 0, False: 2]
  ------------------
  123|      0|    {
  124|      0|	char vendor[13];
  125|       |
  126|       |	/* Get vendor string */
  127|      0|	memset (vendor, 0, sizeof vendor);
  128|       |
  129|      0|	pixman_cpuid (0x00, &a, &b, &c, &d);
  130|      0|	memcpy (vendor + 0, &b, 4);
  131|      0|	memcpy (vendor + 4, &d, 4);
  132|      0|	memcpy (vendor + 8, &c, 4);
  133|       |
  134|      0|	if (strcmp (vendor, "AuthenticAMD") == 0 ||
  ------------------
  |  Branch (134:6): [True: 0, False: 0]
  ------------------
  135|      0|	    strcmp (vendor, "HygonGenuine") == 0 ||
  ------------------
  |  Branch (135:6): [True: 0, False: 0]
  ------------------
  136|      0|	    strcmp (vendor, "Geode by NSC") == 0)
  ------------------
  |  Branch (136:6): [True: 0, False: 0]
  ------------------
  137|      0|	{
  138|      0|	    pixman_cpuid (0x80000000, &a, &b, &c, &d);
  139|      0|	    if (a >= 0x80000001)
  ------------------
  |  Branch (139:10): [True: 0, False: 0]
  ------------------
  140|      0|	    {
  141|      0|		pixman_cpuid (0x80000001, &a, &b, &c, &d);
  142|       |
  143|      0|		if (d & (1 << 22))
  ------------------
  |  Branch (143:7): [True: 0, False: 0]
  ------------------
  144|      0|		    features |= X86_MMX_EXTENSIONS;
  145|      0|	    }
  146|      0|	}
  147|      0|    }
  148|       |
  149|      2|    return features;
  150|      2|}
pixman-x86.c:pixman_cpuid:
   84|      2|{
   85|      2|#if defined (__GNUC__)
   86|      2|    *a = *b = *c = *d = 0;
   87|      2|    __get_cpuid(feature, a, b, c, d);
   88|       |#elif defined (_MSC_VER)
   89|       |    int info[4];
   90|       |
   91|       |    __cpuid (info, feature);
   92|       |
   93|       |    *a = info[0];
   94|       |    *b = info[1];
   95|       |    *c = info[2];
   96|       |    *d = info[3];
   97|       |#else
   98|       |#error Unknown compiler
   99|       |#endif
  100|      2|}

pixman.c:pixman_constructor:
   38|      2|{
   39|      2|    global_implementation = _pixman_choose_implementation ();
   40|      2|}

raster_fuzzer.c:fuzzer_get_tmpfile:
   29|  4.74k|static char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {
   30|  4.74k|    char* filename_buffer = strdup("/tmp/generate_temporary_file.XXXXXX");
   31|  4.74k|    if (!filename_buffer) {
  ------------------
  |  Branch (31:9): [True: 0, False: 4.74k]
  ------------------
   32|      0|        perror("Failed to allocate file name buffer.");
   33|      0|        abort();
   34|      0|    }
   35|  4.74k|    const int file_descriptor = mkstemp(filename_buffer);
   36|  4.74k|    if (file_descriptor < 0) {
  ------------------
  |  Branch (36:9): [True: 0, False: 4.74k]
  ------------------
   37|      0|        perror("Failed to make temporary file.");
   38|      0|        abort();
   39|      0|    }
   40|  4.74k|    FILE* file = fdopen(file_descriptor, "wb");
   41|  4.74k|    if (!file) {
  ------------------
  |  Branch (41:9): [True: 0, False: 4.74k]
  ------------------
   42|      0|        perror("Failed to open file descriptor.");
   43|      0|        close(file_descriptor);
   44|      0|        abort();
   45|      0|    }
   46|  4.74k|    const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);
   47|  4.74k|    if (bytes_written < size) {
  ------------------
  |  Branch (47:9): [True: 0, False: 4.74k]
  ------------------
   48|      0|        close(file_descriptor);
   49|      0|        fprintf(stderr, "Failed to write all bytes to file (%zu out of %zu)",
   50|      0|                bytes_written, size);
   51|      0|        abort();
   52|      0|    }
   53|  4.74k|    fclose(file);
   54|  4.74k|    return filename_buffer;
   55|  4.74k|}
raster_fuzzer.c:fuzzer_release_tmpfile:
   57|  4.74k|static void fuzzer_release_tmpfile(char* filename) {
   58|  4.74k|    if (unlink(filename) != 0) {
  ------------------
  |  Branch (58:9): [True: 0, False: 4.74k]
  ------------------
   59|      0|        perror("WARNING: Failed to delete temporary file.");
   60|      0|    }
   61|  4.74k|    free(filename);
   62|  4.74k|}

LLVMFuzzerTestOneInput:
   33|  4.74k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   34|  4.74k|    cairo_t *cr;
   35|  4.74k|    cairo_surface_t *surface;
   36|  4.74k|    cairo_pattern_t *pattern;
   37|  4.74k|    cairo_content_t content;
   38|  4.74k|    cairo_status_t status;
   39|  4.74k|    int w, h;
   40|       |
   41|  4.74k|    char *tmpfile = fuzzer_get_tmpfile(data, size);
   42|  4.74k|    surface = cairo_image_surface_create_from_png(tmpfile);
   43|  4.74k|    status = cairo_surface_status (surface);
   44|  4.74k|    if (status != CAIRO_STATUS_SUCCESS) {
  ------------------
  |  Branch (44:9): [True: 4.67k, False: 69]
  ------------------
   45|  4.67k|        fuzzer_release_tmpfile(tmpfile);
   46|  4.67k|        return 0;
   47|  4.67k|    }
   48|       |
   49|     69|    cr = cairo_create(surface);
   50|     69|    content = cairo_surface_get_content(surface);
   51|     69|    w = cairo_image_surface_get_width(surface);
   52|     69|    h = cairo_image_surface_get_height(surface);
   53|       |
   54|     69|    char *buf = (char *) calloc(size + 1, sizeof(char));
   55|     69|    memcpy(buf, data, size);
   56|     69|    buf[size] = '\0';
   57|       |
   58|     69|    pattern = cairo_pattern_create_raster_source(buf, content, w, h);
   59|     69|    cairo_raster_source_pattern_set_acquire (pattern, acquire, release);
   60|     69|    cairo_set_source(cr, pattern);
   61|     69|    cairo_pdf_surface_set_page_label(surface, buf);
   62|     69|    cairo_pdf_surface_set_metadata(surface, CAIRO_PDF_METADATA_KEYWORDS, buf);
   63|     69|    cairo_paint(cr);
   64|       |
   65|     69|    cairo_destroy(cr);
   66|     69|    cairo_pattern_destroy(pattern);
   67|     69|    cairo_surface_destroy(surface);
   68|     69|    free(buf);
   69|     69|    fuzzer_release_tmpfile(tmpfile);
   70|     69|    return 0;
   71|  4.74k|}

