pn_amqp_decode_attach:
    7|  1.38M|{
    8|  1.38M|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
    9|  1.38M|    {
   10|  1.38M|        pni_consumer_t subconsumer;
   11|  1.38M|        consume_described(&consumer, &subconsumer);
   12|  1.38M|        pni_consumer_t consumer = subconsumer;
   13|  1.38M|        {
   14|  1.38M|            pni_consumer_t subconsumer;
   15|  1.38M|            uint32_t count;
   16|  1.38M|            consume_list(&consumer, &subconsumer, &count);
   17|  1.38M|            pni_consumer_t consumer = subconsumer;
   18|  1.38M|            consume_string(&consumer, arg0);
   19|  1.38M|            consume_uint(&consumer, arg1);
   20|  1.38M|            consume_bool(&consumer, arg2);
   21|  1.38M|            *arg3 = consume_ubyte(&consumer, arg4);;
   22|  1.38M|            *arg5 = consume_ubyte(&consumer, arg6);;
   23|  1.38M|            {
   24|  1.38M|                pni_consumer_t subconsumer;
   25|  1.38M|                consume_described(&consumer, &subconsumer);
   26|  1.38M|                pni_consumer_t consumer = subconsumer;
   27|  1.38M|                {
   28|  1.38M|                    pni_consumer_t subconsumer;
   29|  1.38M|                    uint32_t count;
   30|  1.38M|                    consume_list(&consumer, &subconsumer, &count);
   31|  1.38M|                    pni_consumer_t consumer = subconsumer;
   32|  1.38M|                    consume_string(&consumer, arg7);
   33|  1.38M|                    consume_uint(&consumer, arg8);
   34|  1.38M|                    consume_symbol(&consumer, arg9);
   35|  1.38M|                    consume_uint(&consumer, arg10);
   36|  1.38M|                    consume_bool(&consumer, arg11);
   37|  1.38M|                    consume_anything(&consumer);
   38|  1.38M|                    consume_symbol(&consumer, arg12);
   39|  1.38M|                    consume_end_list(&consumer);
   40|  1.38M|                }
   41|  1.38M|            }
   42|  1.38M|            {
   43|  1.38M|                pni_consumer_t subconsumer;
   44|  1.38M|                consume_described(&consumer, &subconsumer);
   45|  1.38M|                pni_consumer_t consumer = subconsumer;
   46|  1.38M|                {
   47|  1.38M|                    pni_consumer_t subconsumer;
   48|  1.38M|                    uint32_t count;
   49|  1.38M|                    consume_list(&consumer, &subconsumer, &count);
   50|  1.38M|                    pni_consumer_t consumer = subconsumer;
   51|  1.38M|                    consume_string(&consumer, arg13);
   52|  1.38M|                    consume_uint(&consumer, arg14);
   53|  1.38M|                    consume_symbol(&consumer, arg15);
   54|  1.38M|                    consume_uint(&consumer, arg16);
   55|  1.38M|                    consume_bool(&consumer, arg17);
   56|  1.38M|                    consume_end_list(&consumer);
   57|  1.38M|                }
   58|  1.38M|            }
   59|  1.38M|            consume_anything(&consumer);
   60|  1.38M|            consume_anything(&consumer);
   61|  1.38M|            consume_uint(&consumer, arg18);
   62|  1.38M|            consume_ulong(&consumer, arg19);
   63|  1.38M|            consume_anything(&consumer);
   64|  1.38M|            consume_anything(&consumer);
   65|  1.38M|            *arg20 = consume_raw(&consumer, arg21);;
   66|  1.38M|            consume_end_list(&consumer);
   67|  1.38M|        }
   68|  1.38M|    }
   69|  1.38M|    return consumer.position;
   70|  1.38M|}
pn_amqp_decode_attach_coordinator_caps:
   74|   156k|{
   75|   156k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
   76|   156k|    {
   77|   156k|        pni_consumer_t subconsumer;
   78|   156k|        consume_described(&consumer, &subconsumer);
   79|   156k|        pni_consumer_t consumer = subconsumer;
   80|   156k|        {
   81|   156k|            pni_consumer_t subconsumer;
   82|   156k|            uint32_t count;
   83|   156k|            consume_list(&consumer, &subconsumer, &count);
   84|   156k|            pni_consumer_t consumer = subconsumer;
   85|   156k|            consume_anything(&consumer);
   86|   156k|            consume_anything(&consumer);
   87|   156k|            consume_anything(&consumer);
   88|   156k|            consume_anything(&consumer);
   89|   156k|            consume_anything(&consumer);
   90|   156k|            consume_described_anything(&consumer);
   91|   156k|            {
   92|   156k|                pni_consumer_t subconsumer;
   93|   156k|                consume_described(&consumer, &subconsumer);
   94|   156k|                pni_consumer_t consumer = subconsumer;
   95|   156k|                {
   96|   156k|                    pni_consumer_t subconsumer;
   97|   156k|                    uint32_t count;
   98|   156k|                    consume_list(&consumer, &subconsumer, &count);
   99|   156k|                    pni_consumer_t consumer = subconsumer;
  100|   156k|                    consume_raw(&consumer, arg0);
  101|   156k|                    consume_end_list(&consumer);
  102|   156k|                }
  103|   156k|            }
  104|   156k|            consume_anything(&consumer);
  105|   156k|            consume_anything(&consumer);
  106|   156k|            consume_anything(&consumer);
  107|   156k|            consume_end_list(&consumer);
  108|   156k|        }
  109|   156k|    }
  110|   156k|    return consumer.position;
  111|   156k|}
pn_amqp_decode_attach_source_props:
  115|  1.38M|{
  116|  1.38M|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  117|  1.38M|    {
  118|  1.38M|        pni_consumer_t subconsumer;
  119|  1.38M|        consume_described(&consumer, &subconsumer);
  120|  1.38M|        pni_consumer_t consumer = subconsumer;
  121|  1.38M|        {
  122|  1.38M|            pni_consumer_t subconsumer;
  123|  1.38M|            uint32_t count;
  124|  1.38M|            consume_list(&consumer, &subconsumer, &count);
  125|  1.38M|            pni_consumer_t consumer = subconsumer;
  126|  1.38M|            consume_anything(&consumer);
  127|  1.38M|            consume_anything(&consumer);
  128|  1.38M|            consume_anything(&consumer);
  129|  1.38M|            consume_anything(&consumer);
  130|  1.38M|            consume_anything(&consumer);
  131|  1.38M|            {
  132|  1.38M|                pni_consumer_t subconsumer;
  133|  1.38M|                consume_described(&consumer, &subconsumer);
  134|  1.38M|                pni_consumer_t consumer = subconsumer;
  135|  1.38M|                {
  136|  1.38M|                    pni_consumer_t subconsumer;
  137|  1.38M|                    uint32_t count;
  138|  1.38M|                    consume_list(&consumer, &subconsumer, &count);
  139|  1.38M|                    pni_consumer_t consumer = subconsumer;
  140|  1.38M|                    consume_anything(&consumer);
  141|  1.38M|                    consume_anything(&consumer);
  142|  1.38M|                    consume_anything(&consumer);
  143|  1.38M|                    consume_anything(&consumer);
  144|  1.38M|                    consume_anything(&consumer);
  145|  1.38M|                    consume_raw(&consumer, arg0);
  146|  1.38M|                    consume_anything(&consumer);
  147|  1.38M|                    consume_raw(&consumer, arg1);
  148|  1.38M|                    consume_anything(&consumer);
  149|  1.38M|                    consume_raw(&consumer, arg2);
  150|  1.38M|                    consume_raw(&consumer, arg3);
  151|  1.38M|                    consume_end_list(&consumer);
  152|  1.38M|                }
  153|  1.38M|            }
  154|  1.38M|            consume_end_list(&consumer);
  155|  1.38M|        }
  156|  1.38M|    }
  157|  1.38M|    return consumer.position;
  158|  1.38M|}
pn_amqp_decode_attach_target_props:
  162|  1.22M|{
  163|  1.22M|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  164|  1.22M|    {
  165|  1.22M|        pni_consumer_t subconsumer;
  166|  1.22M|        consume_described(&consumer, &subconsumer);
  167|  1.22M|        pni_consumer_t consumer = subconsumer;
  168|  1.22M|        {
  169|  1.22M|            pni_consumer_t subconsumer;
  170|  1.22M|            uint32_t count;
  171|  1.22M|            consume_list(&consumer, &subconsumer, &count);
  172|  1.22M|            pni_consumer_t consumer = subconsumer;
  173|  1.22M|            consume_anything(&consumer);
  174|  1.22M|            consume_anything(&consumer);
  175|  1.22M|            consume_anything(&consumer);
  176|  1.22M|            consume_anything(&consumer);
  177|  1.22M|            consume_anything(&consumer);
  178|  1.22M|            consume_described_anything(&consumer);
  179|  1.22M|            {
  180|  1.22M|                pni_consumer_t subconsumer;
  181|  1.22M|                consume_described(&consumer, &subconsumer);
  182|  1.22M|                pni_consumer_t consumer = subconsumer;
  183|  1.22M|                {
  184|  1.22M|                    pni_consumer_t subconsumer;
  185|  1.22M|                    uint32_t count;
  186|  1.22M|                    consume_list(&consumer, &subconsumer, &count);
  187|  1.22M|                    pni_consumer_t consumer = subconsumer;
  188|  1.22M|                    consume_anything(&consumer);
  189|  1.22M|                    consume_anything(&consumer);
  190|  1.22M|                    consume_anything(&consumer);
  191|  1.22M|                    consume_anything(&consumer);
  192|  1.22M|                    consume_anything(&consumer);
  193|  1.22M|                    consume_raw(&consumer, arg0);
  194|  1.22M|                    consume_raw(&consumer, arg1);
  195|  1.22M|                    consume_end_list(&consumer);
  196|  1.22M|                }
  197|  1.22M|            }
  198|  1.22M|            consume_end_list(&consumer);
  199|  1.22M|        }
  200|  1.22M|    }
  201|  1.22M|    return consumer.position;
  202|  1.22M|}
pn_amqp_decode_attach_target_type:
  206|  1.37M|{
  207|  1.37M|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  208|  1.37M|    {
  209|  1.37M|        pni_consumer_t subconsumer;
  210|  1.37M|        consume_described(&consumer, &subconsumer);
  211|  1.37M|        pni_consumer_t consumer = subconsumer;
  212|  1.37M|        {
  213|  1.37M|            pni_consumer_t subconsumer;
  214|  1.37M|            uint32_t count;
  215|  1.37M|            consume_list(&consumer, &subconsumer, &count);
  216|  1.37M|            pni_consumer_t consumer = subconsumer;
  217|  1.37M|            consume_anything(&consumer);
  218|  1.37M|            consume_anything(&consumer);
  219|  1.37M|            consume_anything(&consumer);
  220|  1.37M|            consume_anything(&consumer);
  221|  1.37M|            consume_anything(&consumer);
  222|  1.37M|            consume_described_anything(&consumer);
  223|  1.37M|            consume_described_type_anything(&consumer, arg0);
  224|  1.37M|            consume_anything(&consumer);
  225|  1.37M|            consume_anything(&consumer);
  226|  1.37M|            consume_anything(&consumer);
  227|  1.37M|            consume_end_list(&consumer);
  228|  1.37M|        }
  229|  1.37M|    }
  230|  1.37M|    return consumer.position;
  231|  1.37M|}
pn_amqp_decode_begin:
  235|  1.28M|{
  236|  1.28M|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  237|  1.28M|    {
  238|  1.28M|        pni_consumer_t subconsumer;
  239|  1.28M|        consume_described(&consumer, &subconsumer);
  240|  1.28M|        pni_consumer_t consumer = subconsumer;
  241|  1.28M|        {
  242|  1.28M|            pni_consumer_t subconsumer;
  243|  1.28M|            uint32_t count;
  244|  1.28M|            consume_list(&consumer, &subconsumer, &count);
  245|  1.28M|            pni_consumer_t consumer = subconsumer;
  246|  1.28M|            *arg0 = consume_ushort(&consumer, arg1);;
  247|  1.28M|            consume_uint(&consumer, arg2);
  248|  1.28M|            consume_uint(&consumer, arg3);
  249|  1.28M|            consume_uint(&consumer, arg4);
  250|  1.28M|            *arg5 = consume_uint(&consumer, arg6);;
  251|  1.28M|            consume_end_list(&consumer);
  252|  1.28M|        }
  253|  1.28M|    }
  254|  1.28M|    return consumer.position;
  255|  1.28M|}
pn_amqp_decode_close:
  259|  99.0k|{
  260|  99.0k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  261|  99.0k|    {
  262|  99.0k|        pni_consumer_t subconsumer;
  263|  99.0k|        consume_described(&consumer, &subconsumer);
  264|  99.0k|        pni_consumer_t consumer = subconsumer;
  265|  99.0k|        {
  266|  99.0k|            pni_consumer_t subconsumer;
  267|  99.0k|            uint32_t count;
  268|  99.0k|            consume_list(&consumer, &subconsumer, &count);
  269|  99.0k|            pni_consumer_t consumer = subconsumer;
  270|  99.0k|            {
  271|  99.0k|                pni_consumer_t subconsumer;
  272|  99.0k|                consume_described(&consumer, &subconsumer);
  273|  99.0k|                pni_consumer_t consumer = subconsumer;
  274|  99.0k|                {
  275|  99.0k|                    pni_consumer_t subconsumer;
  276|  99.0k|                    uint32_t count;
  277|  99.0k|                    consume_list(&consumer, &subconsumer, &count);
  278|  99.0k|                    pni_consumer_t consumer = subconsumer;
  279|  99.0k|                    consume_symbol(&consumer, arg0);
  280|  99.0k|                    consume_string(&consumer, arg1);
  281|  99.0k|                    consume_raw(&consumer, arg2);
  282|  99.0k|                    consume_end_list(&consumer);
  283|  99.0k|                }
  284|  99.0k|            }
  285|  99.0k|            consume_end_list(&consumer);
  286|  99.0k|        }
  287|  99.0k|    }
  288|  99.0k|    return consumer.position;
  289|  99.0k|}
pn_amqp_decode_described_raw:
  313|  5.59k|{
  314|  5.59k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  315|  5.59k|    consume_described_raw(&consumer, arg0);
  316|  5.59k|    return consumer.position;
  317|  5.59k|}
pn_amqp_decode_described_type_anything:
  321|   148k|{
  322|   148k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  323|   148k|    consume_described_maybe_type_anything(&consumer, arg0, arg1);
  324|   148k|    return consumer.position;
  325|   148k|}
pn_amqp_decode_detach:
  329|   137k|{
  330|   137k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  331|   137k|    {
  332|   137k|        pni_consumer_t subconsumer;
  333|   137k|        consume_described(&consumer, &subconsumer);
  334|   137k|        pni_consumer_t consumer = subconsumer;
  335|   137k|        {
  336|   137k|            pni_consumer_t subconsumer;
  337|   137k|            uint32_t count;
  338|   137k|            consume_list(&consumer, &subconsumer, &count);
  339|   137k|            pni_consumer_t consumer = subconsumer;
  340|   137k|            consume_uint(&consumer, arg0);
  341|   137k|            consume_bool(&consumer, arg1);
  342|   137k|            consume_raw(&consumer, arg2);
  343|   137k|            consume_end_list(&consumer);
  344|   137k|        }
  345|   137k|    }
  346|   137k|    return consumer.position;
  347|   137k|}
pn_amqp_decode_disposition:
  351|  34.3k|{
  352|  34.3k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  353|  34.3k|    {
  354|  34.3k|        pni_consumer_t subconsumer;
  355|  34.3k|        consume_described(&consumer, &subconsumer);
  356|  34.3k|        pni_consumer_t consumer = subconsumer;
  357|  34.3k|        {
  358|  34.3k|            pni_consumer_t subconsumer;
  359|  34.3k|            uint32_t count;
  360|  34.3k|            consume_list(&consumer, &subconsumer, &count);
  361|  34.3k|            pni_consumer_t consumer = subconsumer;
  362|  34.3k|            consume_bool(&consumer, arg0);
  363|  34.3k|            consume_uint(&consumer, arg1);
  364|  34.3k|            *arg2 = consume_uint(&consumer, arg3);;
  365|  34.3k|            consume_bool(&consumer, arg4);
  366|  34.3k|            consume_described_maybe_type_raw(&consumer, arg5, arg6, arg7);
  367|  34.3k|            consume_end_list(&consumer);
  368|  34.3k|        }
  369|  34.3k|    }
  370|  34.3k|    return consumer.position;
  371|  34.3k|}
pn_amqp_decode_disposition_declared:
  375|    221|{
  376|    221|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  377|    221|    {
  378|    221|        pni_consumer_t subconsumer;
  379|    221|        uint32_t count;
  380|    221|        consume_list(&consumer, &subconsumer, &count);
  381|    221|        pni_consumer_t consumer = subconsumer;
  382|    221|        consume_binaryornull(&consumer, arg0);
  383|    221|        consume_end_list(&consumer);
  384|    221|    }
  385|    221|    return consumer.position;
  386|    221|}
pn_amqp_decode_disposition_modified:
  390|  11.0k|{
  391|  11.0k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  392|  11.0k|    {
  393|  11.0k|        pni_consumer_t subconsumer;
  394|  11.0k|        uint32_t count;
  395|  11.0k|        consume_list(&consumer, &subconsumer, &count);
  396|  11.0k|        pni_consumer_t consumer = subconsumer;
  397|  11.0k|        *arg0 = consume_bool(&consumer, arg1);;
  398|  11.0k|        *arg2 = consume_bool(&consumer, arg3);;
  399|  11.0k|        consume_raw(&consumer, arg4);
  400|  11.0k|        consume_end_list(&consumer);
  401|  11.0k|    }
  402|  11.0k|    return consumer.position;
  403|  11.0k|}
pn_amqp_decode_disposition_received:
  407|    103|{
  408|    103|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  409|    103|    {
  410|    103|        pni_consumer_t subconsumer;
  411|    103|        uint32_t count;
  412|    103|        consume_list(&consumer, &subconsumer, &count);
  413|    103|        pni_consumer_t consumer = subconsumer;
  414|    103|        *arg0 = consume_uint(&consumer, arg1);;
  415|    103|        *arg2 = consume_ulong(&consumer, arg3);;
  416|    103|        consume_end_list(&consumer);
  417|    103|    }
  418|    103|    return consumer.position;
  419|    103|}
pn_amqp_decode_disposition_rejected:
  423|  7.63k|{
  424|  7.63k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  425|  7.63k|    {
  426|  7.63k|        pni_consumer_t subconsumer;
  427|  7.63k|        uint32_t count;
  428|  7.63k|        consume_list(&consumer, &subconsumer, &count);
  429|  7.63k|        pni_consumer_t consumer = subconsumer;
  430|  7.63k|        {
  431|  7.63k|            pni_consumer_t subconsumer;
  432|  7.63k|            consume_described(&consumer, &subconsumer);
  433|  7.63k|            pni_consumer_t consumer = subconsumer;
  434|  7.63k|            {
  435|  7.63k|                pni_consumer_t subconsumer;
  436|  7.63k|                uint32_t count;
  437|  7.63k|                consume_list(&consumer, &subconsumer, &count);
  438|  7.63k|                pni_consumer_t consumer = subconsumer;
  439|  7.63k|                consume_symbol(&consumer, arg0);
  440|  7.63k|                consume_string(&consumer, arg1);
  441|  7.63k|                consume_raw(&consumer, arg2);
  442|  7.63k|                consume_end_list(&consumer);
  443|  7.63k|            }
  444|  7.63k|        }
  445|  7.63k|        consume_end_list(&consumer);
  446|  7.63k|    }
  447|  7.63k|    return consumer.position;
  448|  7.63k|}
pn_amqp_decode_disposition_transactional_state:
  452|  4.19k|{
  453|  4.19k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  454|  4.19k|    {
  455|  4.19k|        pni_consumer_t subconsumer;
  456|  4.19k|        uint32_t count;
  457|  4.19k|        consume_list(&consumer, &subconsumer, &count);
  458|  4.19k|        pni_consumer_t consumer = subconsumer;
  459|  4.19k|        consume_binaryornull(&consumer, arg0);
  460|  4.19k|        *arg1 = consume_raw(&consumer, arg2);;
  461|  4.19k|        consume_end_list(&consumer);
  462|  4.19k|    }
  463|  4.19k|    return consumer.position;
  464|  4.19k|}
pn_amqp_decode_error_condition:
  468|   137k|{
  469|   137k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  470|   137k|    {
  471|   137k|        pni_consumer_t subconsumer;
  472|   137k|        consume_described(&consumer, &subconsumer);
  473|   137k|        pni_consumer_t consumer = subconsumer;
  474|   137k|        {
  475|   137k|            pni_consumer_t subconsumer;
  476|   137k|            uint32_t count;
  477|   137k|            consume_list(&consumer, &subconsumer, &count);
  478|   137k|            pni_consumer_t consumer = subconsumer;
  479|   137k|            consume_symbol(&consumer, arg0);
  480|   137k|            consume_string(&consumer, arg1);
  481|   137k|            consume_raw(&consumer, arg2);
  482|   137k|            consume_end_list(&consumer);
  483|   137k|        }
  484|   137k|    }
  485|   137k|    return consumer.position;
  486|   137k|}
pn_amqp_decode_flow:
  490|  28.1k|{
  491|  28.1k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  492|  28.1k|    {
  493|  28.1k|        pni_consumer_t subconsumer;
  494|  28.1k|        consume_described(&consumer, &subconsumer);
  495|  28.1k|        pni_consumer_t consumer = subconsumer;
  496|  28.1k|        {
  497|  28.1k|            pni_consumer_t subconsumer;
  498|  28.1k|            uint32_t count;
  499|  28.1k|            consume_list(&consumer, &subconsumer, &count);
  500|  28.1k|            pni_consumer_t consumer = subconsumer;
  501|  28.1k|            *arg0 = consume_uint(&consumer, arg1);;
  502|  28.1k|            consume_uint(&consumer, arg2);
  503|  28.1k|            consume_uint(&consumer, arg3);
  504|  28.1k|            consume_uint(&consumer, arg4);
  505|  28.1k|            *arg5 = consume_uint(&consumer, arg6);;
  506|  28.1k|            *arg7 = consume_uint(&consumer, arg8);;
  507|  28.1k|            consume_uint(&consumer, arg9);
  508|  28.1k|            consume_anything(&consumer);
  509|  28.1k|            consume_bool(&consumer, arg10);
  510|  28.1k|            consume_end_list(&consumer);
  511|  28.1k|        }
  512|  28.1k|    }
  513|  28.1k|    return consumer.position;
  514|  28.1k|}
pn_amqp_decode_message_header:
  518|  3.35k|{
  519|  3.35k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  520|  3.35k|    {
  521|  3.35k|        pni_consumer_t subconsumer;
  522|  3.35k|        consume_described(&consumer, &subconsumer);
  523|  3.35k|        pni_consumer_t consumer = subconsumer;
  524|  3.35k|        {
  525|  3.35k|            pni_consumer_t subconsumer;
  526|  3.35k|            uint32_t count;
  527|  3.35k|            consume_list(&consumer, &subconsumer, &count);
  528|  3.35k|            pni_consumer_t consumer = subconsumer;
  529|  3.35k|            consume_bool(&consumer, arg0);
  530|  3.35k|            *arg1 = consume_ubyte(&consumer, arg2);;
  531|  3.35k|            consume_uint(&consumer, arg3);
  532|  3.35k|            consume_bool(&consumer, arg4);
  533|  3.35k|            consume_uint(&consumer, arg5);
  534|  3.35k|            consume_end_list(&consumer);
  535|  3.35k|        }
  536|  3.35k|    }
  537|  3.35k|    return consumer.position;
  538|  3.35k|}
pn_amqp_decode_message_properties:
  542|  7.61k|{
  543|  7.61k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  544|  7.61k|    {
  545|  7.61k|        pni_consumer_t subconsumer;
  546|  7.61k|        consume_described(&consumer, &subconsumer);
  547|  7.61k|        pni_consumer_t consumer = subconsumer;
  548|  7.61k|        {
  549|  7.61k|            pni_consumer_t subconsumer;
  550|  7.61k|            uint32_t count;
  551|  7.61k|            consume_list(&consumer, &subconsumer, &count);
  552|  7.61k|            pni_consumer_t consumer = subconsumer;
  553|  7.61k|            consume_atom(&consumer, arg0);
  554|  7.61k|            consume_binaryornull(&consumer, arg1);
  555|  7.61k|            consume_string(&consumer, arg2);
  556|  7.61k|            consume_string(&consumer, arg3);
  557|  7.61k|            consume_string(&consumer, arg4);
  558|  7.61k|            consume_atom(&consumer, arg5);
  559|  7.61k|            consume_symbol(&consumer, arg6);
  560|  7.61k|            consume_symbol(&consumer, arg7);
  561|  7.61k|            consume_timestamp(&consumer, arg8);
  562|  7.61k|            consume_timestamp(&consumer, arg9);
  563|  7.61k|            consume_string(&consumer, arg10);
  564|  7.61k|            consume_uint(&consumer, arg11);
  565|  7.61k|            consume_string(&consumer, arg12);
  566|  7.61k|            consume_end_list(&consumer);
  567|  7.61k|        }
  568|  7.61k|    }
  569|  7.61k|    return consumer.position;
  570|  7.61k|}
pn_amqp_decode_open:
  574|   272k|{
  575|   272k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  576|   272k|    {
  577|   272k|        pni_consumer_t subconsumer;
  578|   272k|        consume_described(&consumer, &subconsumer);
  579|   272k|        pni_consumer_t consumer = subconsumer;
  580|   272k|        {
  581|   272k|            pni_consumer_t subconsumer;
  582|   272k|            uint32_t count;
  583|   272k|            consume_list(&consumer, &subconsumer, &count);
  584|   272k|            pni_consumer_t consumer = subconsumer;
  585|   272k|            *arg0 = consume_string(&consumer, arg1);;
  586|   272k|            *arg2 = consume_string(&consumer, arg3);;
  587|   272k|            *arg4 = consume_uint(&consumer, arg5);;
  588|   272k|            *arg6 = consume_ushort(&consumer, arg7);;
  589|   272k|            consume_uint(&consumer, arg8);
  590|   272k|            consume_anything(&consumer);
  591|   272k|            consume_anything(&consumer);
  592|   272k|            consume_raw(&consumer, arg9);
  593|   272k|            consume_raw(&consumer, arg10);
  594|   272k|            consume_raw(&consumer, arg11);
  595|   272k|            consume_end_list(&consumer);
  596|   272k|        }
  597|   272k|    }
  598|   272k|    return consumer.position;
  599|   272k|}
pn_amqp_decode_raw:
  603|   133k|{
  604|   133k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  605|   133k|    consume_raw(&consumer, arg0);
  606|   133k|    return consumer.position;
  607|   133k|}
pn_amqp_decode_transfer:
  693|   153k|{
  694|   153k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  695|   153k|    {
  696|   153k|        pni_consumer_t subconsumer;
  697|   153k|        consume_described(&consumer, &subconsumer);
  698|   153k|        pni_consumer_t consumer = subconsumer;
  699|   153k|        {
  700|   153k|            pni_consumer_t subconsumer;
  701|   153k|            uint32_t count;
  702|   153k|            consume_list(&consumer, &subconsumer, &count);
  703|   153k|            pni_consumer_t consumer = subconsumer;
  704|   153k|            consume_uint(&consumer, arg0);
  705|   153k|            *arg1 = consume_uint(&consumer, arg2);;
  706|   153k|            *arg3 = consume_binarynonull(&consumer, arg4);;
  707|   153k|            *arg5 = consume_uint(&consumer, arg6);;
  708|   153k|            *arg7 = consume_bool(&consumer, arg8);;
  709|   153k|            consume_bool(&consumer, arg9);
  710|   153k|            consume_anything(&consumer);
  711|   153k|            consume_described_maybe_type_raw(&consumer, arg10, arg11, arg12);
  712|   153k|            consume_bool(&consumer, arg13);
  713|   153k|            consume_bool(&consumer, arg14);
  714|   153k|            consume_bool(&consumer, arg15);
  715|   153k|            consume_end_list(&consumer);
  716|   153k|        }
  717|   153k|    }
  718|   153k|    return consumer.position;
  719|   153k|}

pn_amqp_encode_inner_attach:
    7|  34.6k|{
    8|  34.6k|    pni_compound_context compound = make_compound();
    9|  34.6k|    emit_descriptor(emitter, &compound, arg0);
   10|  34.6k|    for (bool small_encoding = true; ; small_encoding = false) {
   11|  34.6k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
   12|  34.6k|        pni_compound_context compound = c;
   13|  34.6k|        emit_string(emitter, &compound, arg1);
   14|  34.6k|        emit_uint(emitter, &compound, arg2);
   15|  34.6k|        emit_bool(emitter, &compound, arg3);
   16|  34.6k|        emit_ubyte(emitter, &compound, arg4);
   17|  34.6k|        emit_ubyte(emitter, &compound, arg5);
   18|  34.6k|        if (arg6) {
  ------------------
  |  Branch (18:13): [True: 34.6k, False: 0]
  ------------------
   19|  34.6k|            emit_descriptor(emitter, &compound, arg7);
   20|  34.6k|            for (bool small_encoding = true; ; small_encoding = false) {
   21|  34.6k|                pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
   22|  34.6k|                pni_compound_context compound = c;
   23|  34.6k|                emit_string(emitter, &compound, arg8);
   24|  34.6k|                emit_uint(emitter, &compound, arg9);
   25|  34.6k|                emit_symbol(emitter, &compound, arg10);
   26|  34.6k|                emit_uint(emitter, &compound, arg11);
   27|  34.6k|                emit_bool(emitter, &compound, arg12);
   28|  34.6k|                emit_raw(emitter, &compound, arg13);
   29|  34.6k|                if (arg14) {
  ------------------
  |  Branch (29:21): [True: 0, False: 34.6k]
  ------------------
   30|      0|                    emit_symbol(emitter, &compound, arg15);
   31|  34.6k|                } else {
   32|  34.6k|                    emit_null(emitter, &compound);
   33|  34.6k|                }
   34|  34.6k|                emit_raw(emitter, &compound, arg16);
   35|  34.6k|                emit_null(emitter, &compound);
   36|  34.6k|                emit_multiple(emitter, &compound, arg17);
   37|  34.6k|                emit_multiple(emitter, &compound, arg18);
   38|  34.6k|                emit_end_list(emitter, &compound, small_encoding);
   39|  34.6k|                if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (39:21): [True: 34.6k, False: 0]
  ------------------
   40|  34.6k|            }
   41|  34.6k|        } else {
   42|      0|            emit_null(emitter, &compound);
   43|      0|        }
   44|  34.6k|        if (arg19) {
  ------------------
  |  Branch (44:13): [True: 34.6k, False: 0]
  ------------------
   45|  34.6k|            emit_descriptor(emitter, &compound, arg20);
   46|  34.6k|            for (bool small_encoding = true; ; small_encoding = false) {
   47|  34.6k|                pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
   48|  34.6k|                pni_compound_context compound = c;
   49|  34.6k|                emit_string(emitter, &compound, arg21);
   50|  34.6k|                emit_uint(emitter, &compound, arg22);
   51|  34.6k|                emit_symbol(emitter, &compound, arg23);
   52|  34.6k|                emit_uint(emitter, &compound, arg24);
   53|  34.6k|                emit_bool(emitter, &compound, arg25);
   54|  34.6k|                emit_raw(emitter, &compound, arg26);
   55|  34.6k|                emit_multiple(emitter, &compound, arg27);
   56|  34.6k|                emit_end_list(emitter, &compound, small_encoding);
   57|  34.6k|                if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (57:21): [True: 34.6k, False: 0]
  ------------------
   58|  34.6k|            }
   59|  34.6k|        } else {
   60|      0|            emit_null(emitter, &compound);
   61|      0|        }
   62|  34.6k|        emit_null(emitter, &compound);
   63|  34.6k|        emit_null(emitter, &compound);
   64|  34.6k|        emit_uint(emitter, &compound, arg28);
   65|  34.6k|        emit_ulong(emitter, &compound, arg29);
   66|  34.6k|        emit_null(emitter, &compound);
   67|  34.6k|        emit_null(emitter, &compound);
   68|  34.6k|        emit_raw(emitter, &compound, arg30);
   69|  34.6k|        emit_end_list(emitter, &compound, small_encoding);
   70|  34.6k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (70:13): [True: 34.6k, False: 0]
  ------------------
   71|  34.6k|    }
   72|  34.6k|    return resize_required(emitter);
   73|  34.6k|}
pn_amqp_encode_attach:
   76|  34.6k|{
   77|  34.6k|    do {
   78|  34.6k|        pni_emitter_t emitter = make_emitter_from_rwbytes(buffer);
   79|  34.6k|        if (pn_amqp_encode_inner_attach(&emitter, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29, arg30)) {
  ------------------
  |  Branch (79:13): [True: 0, False: 34.6k]
  ------------------
   80|      0|            size_buffer_to_emitter(buffer, &emitter);
   81|      0|            continue;
   82|      0|        }
   83|  34.6k|        return make_bytes_from_emitter(emitter);
   84|  34.6k|    } while (true);
  ------------------
  |  Branch (84:14): [True: 0, Folded]
  ------------------
   85|       |    /*Unreachable*/
   86|  34.6k|}
pn_amqp_encode_inner_begin:
  171|  34.6k|{
  172|  34.6k|    pni_compound_context compound = make_compound();
  173|  34.6k|    emit_descriptor(emitter, &compound, arg0);
  174|  34.6k|    for (bool small_encoding = true; ; small_encoding = false) {
  175|  34.6k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  176|  34.6k|        pni_compound_context compound = c;
  177|  34.6k|        if (arg1) {
  ------------------
  |  Branch (177:13): [True: 0, False: 34.6k]
  ------------------
  178|      0|            emit_ushort(emitter, &compound, arg2);
  179|  34.6k|        } else {
  180|  34.6k|            emit_null(emitter, &compound);
  181|  34.6k|        }
  182|  34.6k|        emit_uint(emitter, &compound, arg3);
  183|  34.6k|        emit_uint(emitter, &compound, arg4);
  184|  34.6k|        emit_uint(emitter, &compound, arg5);
  185|  34.6k|        emit_uint(emitter, &compound, arg6);
  186|  34.6k|        emit_end_list(emitter, &compound, small_encoding);
  187|  34.6k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (187:13): [True: 34.6k, False: 0]
  ------------------
  188|  34.6k|    }
  189|  34.6k|    return resize_required(emitter);
  190|  34.6k|}
pn_amqp_encode_begin:
  193|  34.6k|{
  194|  34.6k|    do {
  195|  34.6k|        pni_emitter_t emitter = make_emitter_from_rwbytes(buffer);
  196|  34.6k|        if (pn_amqp_encode_inner_begin(&emitter, arg0, arg1, arg2, arg3, arg4, arg5, arg6)) {
  ------------------
  |  Branch (196:13): [True: 0, False: 34.6k]
  ------------------
  197|      0|            size_buffer_to_emitter(buffer, &emitter);
  198|      0|            continue;
  199|      0|        }
  200|  34.6k|        return make_bytes_from_emitter(emitter);
  201|  34.6k|    } while (true);
  ------------------
  |  Branch (201:14): [True: 0, Folded]
  ------------------
  202|       |    /*Unreachable*/
  203|  34.6k|}
pn_amqp_encode_inner_close:
  213|  24.4k|{
  214|  24.4k|    pni_compound_context compound = make_compound();
  215|  24.4k|    emit_descriptor(emitter, &compound, arg0);
  216|  24.5k|    for (bool small_encoding = true; ; small_encoding = false) {
  217|  24.5k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  218|  24.5k|        pni_compound_context compound = c;
  219|  24.5k|        emit_condition(emitter, &compound, arg1);
  220|  24.5k|        emit_end_list(emitter, &compound, small_encoding);
  221|  24.5k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (221:13): [True: 24.4k, False: 156]
  ------------------
  222|  24.5k|    }
  223|  24.4k|    return resize_required(emitter);
  224|  24.4k|}
pn_amqp_encode_close:
  227|  24.3k|{
  228|  24.4k|    do {
  229|  24.4k|        pni_emitter_t emitter = make_emitter_from_rwbytes(buffer);
  230|  24.4k|        if (pn_amqp_encode_inner_close(&emitter, arg0, arg1)) {
  ------------------
  |  Branch (230:13): [True: 68, False: 24.3k]
  ------------------
  231|     68|            size_buffer_to_emitter(buffer, &emitter);
  232|     68|            continue;
  233|     68|        }
  234|  24.3k|        return make_bytes_from_emitter(emitter);
  235|  24.4k|    } while (true);
  ------------------
  |  Branch (235:14): [True: 68, Folded]
  ------------------
  236|       |    /*Unreachable*/
  237|  24.3k|}
pn_amqp_encode_inner_disposition_batch:
  389|  4.76k|{
  390|  4.76k|    pni_compound_context compound = make_compound();
  391|  4.76k|    emit_descriptor(emitter, &compound, arg0);
  392|  4.76k|    for (bool small_encoding = true; ; small_encoding = false) {
  393|  4.76k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  394|  4.76k|        pni_compound_context compound = c;
  395|  4.76k|        emit_bool(emitter, &compound, arg1);
  396|  4.76k|        emit_uint(emitter, &compound, arg2);
  397|  4.76k|        if (arg3) {
  ------------------
  |  Branch (397:13): [True: 368, False: 4.39k]
  ------------------
  398|    368|            emit_uint(emitter, &compound, arg4);
  399|  4.39k|        } else {
  400|  4.39k|            emit_null(emitter, &compound);
  401|  4.39k|        }
  402|  4.76k|        if (arg5) {
  ------------------
  |  Branch (402:13): [True: 4.76k, False: 0]
  ------------------
  403|  4.76k|            emit_bool(emitter, &compound, arg6);
  404|  4.76k|        } else {
  405|      0|            emit_null(emitter, &compound);
  406|      0|        }
  407|  4.76k|        if (arg7) {
  ------------------
  |  Branch (407:13): [True: 4.76k, False: 0]
  ------------------
  408|  4.76k|            emit_descriptor(emitter, &compound, arg8);
  409|  4.76k|            for (bool small_encoding = true; ; small_encoding = false) {
  410|  4.76k|                pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  411|  4.76k|                pni_compound_context compound = c;
  412|  4.76k|                emit_end_list(emitter, &compound, small_encoding);
  413|  4.76k|                if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (413:21): [True: 4.76k, False: 0]
  ------------------
  414|  4.76k|            }
  415|  4.76k|        } else {
  416|      0|            emit_null(emitter, &compound);
  417|      0|        }
  418|  4.76k|        emit_end_list(emitter, &compound, small_encoding);
  419|  4.76k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (419:13): [True: 4.76k, False: 0]
  ------------------
  420|  4.76k|    }
  421|  4.76k|    return resize_required(emitter);
  422|  4.76k|}
pn_amqp_encode_disposition_batch:
  425|  4.76k|{
  426|  4.76k|    do {
  427|  4.76k|        pni_emitter_t emitter = make_emitter_from_rwbytes(buffer);
  428|  4.76k|        if (pn_amqp_encode_inner_disposition_batch(&emitter, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) {
  ------------------
  |  Branch (428:13): [True: 0, False: 4.76k]
  ------------------
  429|      0|            size_buffer_to_emitter(buffer, &emitter);
  430|      0|            continue;
  431|      0|        }
  432|  4.76k|        return make_bytes_from_emitter(emitter);
  433|  4.76k|    } while (true);
  ------------------
  |  Branch (433:14): [True: 0, Folded]
  ------------------
  434|       |    /*Unreachable*/
  435|  4.76k|}
pn_amqp_encode_inner_flow:
  445|  34.6k|{
  446|  34.6k|    pni_compound_context compound = make_compound();
  447|  34.6k|    emit_descriptor(emitter, &compound, arg0);
  448|  34.6k|    for (bool small_encoding = true; ; small_encoding = false) {
  449|  34.6k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  450|  34.6k|        pni_compound_context compound = c;
  451|  34.6k|        if (arg1) {
  ------------------
  |  Branch (451:13): [True: 0, False: 34.6k]
  ------------------
  452|      0|            emit_uint(emitter, &compound, arg2);
  453|  34.6k|        } else {
  454|  34.6k|            emit_null(emitter, &compound);
  455|  34.6k|        }
  456|  34.6k|        emit_uint(emitter, &compound, arg3);
  457|  34.6k|        emit_uint(emitter, &compound, arg4);
  458|  34.6k|        emit_uint(emitter, &compound, arg5);
  459|  34.6k|        if (arg6) {
  ------------------
  |  Branch (459:13): [True: 34.6k, False: 0]
  ------------------
  460|  34.6k|            emit_uint(emitter, &compound, arg7);
  461|  34.6k|        } else {
  462|      0|            emit_null(emitter, &compound);
  463|      0|        }
  464|  34.6k|        if (arg8) {
  ------------------
  |  Branch (464:13): [True: 34.6k, False: 0]
  ------------------
  465|  34.6k|            emit_uint(emitter, &compound, arg9);
  466|  34.6k|        } else {
  467|      0|            emit_null(emitter, &compound);
  468|      0|        }
  469|  34.6k|        if (arg10) {
  ------------------
  |  Branch (469:13): [True: 34.6k, False: 0]
  ------------------
  470|  34.6k|            emit_uint(emitter, &compound, arg11);
  471|  34.6k|        } else {
  472|      0|            emit_null(emitter, &compound);
  473|      0|        }
  474|  34.6k|        emit_null(emitter, &compound);
  475|  34.6k|        if (arg12) {
  ------------------
  |  Branch (475:13): [True: 34.6k, False: 0]
  ------------------
  476|  34.6k|            emit_bool(emitter, &compound, arg13);
  477|  34.6k|        } else {
  478|      0|            emit_null(emitter, &compound);
  479|      0|        }
  480|  34.6k|        emit_end_list(emitter, &compound, small_encoding);
  481|  34.6k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (481:13): [True: 34.6k, False: 0]
  ------------------
  482|  34.6k|    }
  483|  34.6k|    return resize_required(emitter);
  484|  34.6k|}
pn_amqp_encode_flow:
  487|  34.6k|{
  488|  34.6k|    do {
  489|  34.6k|        pni_emitter_t emitter = make_emitter_from_rwbytes(buffer);
  490|  34.6k|        if (pn_amqp_encode_inner_flow(&emitter, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13)) {
  ------------------
  |  Branch (490:13): [True: 0, False: 34.6k]
  ------------------
  491|      0|            size_buffer_to_emitter(buffer, &emitter);
  492|      0|            continue;
  493|      0|        }
  494|  34.6k|        return make_bytes_from_emitter(emitter);
  495|  34.6k|    } while (true);
  ------------------
  |  Branch (495:14): [True: 0, Folded]
  ------------------
  496|       |    /*Unreachable*/
  497|  34.6k|}
pn_amqp_encode_inner_open:
  633|  34.6k|{
  634|  34.6k|    pni_compound_context compound = make_compound();
  635|  34.6k|    emit_descriptor(emitter, &compound, arg0);
  636|  34.6k|    for (bool small_encoding = true; ; small_encoding = false) {
  637|  34.6k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  638|  34.6k|        pni_compound_context compound = c;
  639|  34.6k|        emit_string(emitter, &compound, arg1);
  640|  34.6k|        emit_string(emitter, &compound, arg2);
  641|  34.6k|        if (arg3) {
  ------------------
  |  Branch (641:13): [True: 34.6k, False: 0]
  ------------------
  642|  34.6k|            emit_uint(emitter, &compound, arg4);
  643|  34.6k|        } else {
  644|      0|            emit_null(emitter, &compound);
  645|      0|        }
  646|  34.6k|        if (arg5) {
  ------------------
  |  Branch (646:13): [True: 34.6k, False: 0]
  ------------------
  647|  34.6k|            emit_ushort(emitter, &compound, arg6);
  648|  34.6k|        } else {
  649|      0|            emit_null(emitter, &compound);
  650|      0|        }
  651|  34.6k|        if (arg7) {
  ------------------
  |  Branch (651:13): [True: 0, False: 34.6k]
  ------------------
  652|      0|            emit_uint(emitter, &compound, arg8);
  653|  34.6k|        } else {
  654|  34.6k|            emit_null(emitter, &compound);
  655|  34.6k|        }
  656|  34.6k|        emit_null(emitter, &compound);
  657|  34.6k|        emit_null(emitter, &compound);
  658|  34.6k|        emit_multiple(emitter, &compound, arg9);
  659|  34.6k|        emit_multiple(emitter, &compound, arg10);
  660|  34.6k|        emit_raw(emitter, &compound, arg11);
  661|  34.6k|        emit_end_list(emitter, &compound, small_encoding);
  662|  34.6k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (662:13): [True: 34.6k, False: 0]
  ------------------
  663|  34.6k|    }
  664|  34.6k|    return resize_required(emitter);
  665|  34.6k|}
pn_amqp_encode_open:
  668|  34.6k|{
  669|  34.6k|    do {
  670|  34.6k|        pni_emitter_t emitter = make_emitter_from_rwbytes(buffer);
  671|  34.6k|        if (pn_amqp_encode_inner_open(&emitter, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)) {
  ------------------
  |  Branch (671:13): [True: 0, False: 34.6k]
  ------------------
  672|      0|            size_buffer_to_emitter(buffer, &emitter);
  673|      0|            continue;
  674|      0|        }
  675|  34.6k|        return make_bytes_from_emitter(emitter);
  676|  34.6k|    } while (true);
  ------------------
  |  Branch (676:14): [True: 0, Folded]
  ------------------
  677|       |    /*Unreachable*/
  678|  34.6k|}

pn_bytes:
  234|   115k|{
  235|   115k|  pn_bytes_t bytes = {size, start};
  236|   115k|  return bytes;
  237|   115k|}
pn_rwbytes:
  257|  49.9k|{
  258|  49.9k|  pn_rwbytes_t bytes = {size, start};
  259|  49.9k|  return bytes;
  260|  49.9k|}

pni_sniff_header:
   81|  34.6k|{
   82|  34.6k|  if (len < 3) return PNI_PROTOCOL_INSUFFICIENT;
  ------------------
  |  Branch (82:7): [True: 68, False: 34.6k]
  ------------------
   83|  34.6k|  bool isSSL3Handshake = buf[0]==22 &&            // handshake
  ------------------
  |  Branch (83:26): [True: 45, False: 34.5k]
  ------------------
   84|     45|                         buf[1]==3  && buf[2]<=3; // SSL 3.0 & TLS 1.0-1.2 (v3.1-3.3)
  ------------------
  |  Branch (84:26): [True: 29, False: 16]
  |  Branch (84:40): [True: 23, False: 6]
  ------------------
   85|  34.6k|  if (isSSL3Handshake) return PNI_PROTOCOL_SSL;
  ------------------
  |  Branch (85:7): [True: 23, False: 34.5k]
  ------------------
   86|       |
   87|  34.6k|  bool isFirst3AMQP = buf[0]=='A' && buf[1]=='M' && buf[2]=='Q';
  ------------------
  |  Branch (87:23): [True: 34.4k, False: 145]
  |  Branch (87:38): [True: 34.4k, False: 33]
  |  Branch (87:53): [True: 34.3k, False: 55]
  ------------------
   88|  34.5k|  bool isFirst3SSL2CLientHello = buf[2]==1;       // Client Hello
   89|  34.5k|  if (!isFirst3AMQP && !isFirst3SSL2CLientHello) return PNI_PROTOCOL_UNKNOWN;
  ------------------
  |  Branch (89:7): [True: 233, False: 34.3k]
  |  Branch (89:24): [True: 119, False: 114]
  ------------------
   90|       |
   91|       |
   92|  34.4k|  if (len < 4) return PNI_PROTOCOL_INSUFFICIENT;
  ------------------
  |  Branch (92:7): [True: 24, False: 34.4k]
  ------------------
   93|  34.4k|  bool isAMQP = isFirst3AMQP && buf[3]=='P';
  ------------------
  |  Branch (93:17): [True: 34.3k, False: 92]
  |  Branch (93:33): [True: 34.3k, False: 15]
  ------------------
   94|  34.4k|  bool isFirst4SSL2ClientHello = isFirst3SSL2CLientHello && (buf[3]==2 || buf[3]==3);
  ------------------
  |  Branch (94:34): [True: 92, False: 34.3k]
  |  Branch (94:62): [True: 17, False: 75]
  |  Branch (94:75): [True: 39, False: 36]
  ------------------
   95|  34.4k|  if (!isAMQP && !isFirst4SSL2ClientHello) return PNI_PROTOCOL_UNKNOWN;
  ------------------
  |  Branch (95:7): [True: 107, False: 34.3k]
  |  Branch (95:18): [True: 51, False: 56]
  ------------------
   96|       |
   97|  34.3k|  if (len < 5) return PNI_PROTOCOL_INSUFFICIENT;
  ------------------
  |  Branch (97:7): [True: 10, False: 34.3k]
  ------------------
   98|  34.3k|  bool isSSL2Handshake = buf[2] == 1 &&   // MSG-CLIENT-HELLO
  ------------------
  |  Branch (98:26): [True: 48, False: 34.3k]
  ------------------
   99|     48|      ((buf[3] == 3 && buf[4] <= 3) ||    // SSL 3.0 & TLS 1.0-1.2 (v3.1-3.3)
  ------------------
  |  Branch (99:9): [True: 35, False: 13]
  |  Branch (99:24): [True: 27, False: 8]
  ------------------
  100|     21|       (buf[3] == 2 && buf[4] == 0));     // SSL 2
  ------------------
  |  Branch (100:9): [True: 13, False: 8]
  |  Branch (100:24): [True: 4, False: 9]
  ------------------
  101|  34.3k|  if (isSSL2Handshake) return PNI_PROTOCOL_SSL;
  ------------------
  |  Branch (101:7): [True: 31, False: 34.3k]
  ------------------
  102|       |
  103|  34.3k|  bool isFirst5OldAMQP = isAMQP && buf[4]==1;
  ------------------
  |  Branch (103:26): [True: 34.3k, False: 17]
  |  Branch (103:36): [True: 6, False: 34.3k]
  ------------------
  104|  34.3k|  bool isFirst5AMQP = isAMQP && (buf[4]==0 || buf[4]==2 || buf[4]==3);
  ------------------
  |  Branch (104:23): [True: 34.3k, False: 17]
  |  Branch (104:34): [True: 34.2k, False: 37]
  |  Branch (104:47): [True: 7, False: 30]
  |  Branch (104:60): [True: 9, False: 21]
  ------------------
  105|  34.3k|  if (!isFirst5AMQP && !isFirst5OldAMQP) return PNI_PROTOCOL_UNKNOWN;
  ------------------
  |  Branch (105:7): [True: 38, False: 34.3k]
  |  Branch (105:24): [True: 32, False: 6]
  ------------------
  106|       |
  107|  34.3k|  if (len < 6) return PNI_PROTOCOL_INSUFFICIENT;
  ------------------
  |  Branch (107:7): [True: 8, False: 34.3k]
  ------------------
  108|       |
  109|       |  // Both old and new versions of AMQP have 1 in byte 5
  110|  34.3k|  if (buf[5]!=1) return PNI_PROTOCOL_UNKNOWN;
  ------------------
  |  Branch (110:7): [True: 12, False: 34.2k]
  ------------------
  111|       |
  112|       |  // From here on it must be some sort of AMQP
  113|  34.2k|  if (len < 8) return PNI_PROTOCOL_INSUFFICIENT;
  ------------------
  |  Branch (113:7): [True: 4, False: 34.2k]
  ------------------
  114|  34.2k|  if (buf[6]==0 && buf[7]==0) {
  ------------------
  |  Branch (114:7): [True: 34.2k, False: 7]
  |  Branch (114:20): [True: 34.2k, False: 6]
  ------------------
  115|       |    // AM<QP 1.0
  116|  34.2k|      if (buf[4]==0) return PNI_PROTOCOL_AMQP1;
  ------------------
  |  Branch (116:11): [True: 34.2k, False: 4]
  ------------------
  117|      4|      if (buf[4]==2) return PNI_PROTOCOL_AMQP_SSL;
  ------------------
  |  Branch (117:11): [True: 2, False: 2]
  ------------------
  118|      2|      if (buf[4]==3) return PNI_PROTOCOL_AMQP_SASL;
  ------------------
  |  Branch (118:11): [True: 1, False: 1]
  ------------------
  119|      2|  }
  120|     14|  return PNI_PROTOCOL_AMQP_OTHER;
  121|  34.2k|}
pni_protocol_name:
  124|    342|{
  125|    342|  static const char * const names[] = {
  126|    342|  "Insufficient data to determine protocol",
  127|    342|  "Unknown protocol",
  128|    342|  "SSL/TLS connection",
  129|    342|  "AMQP TLS layer",
  130|    342|  "AMQP SASL layer",
  131|    342|  "AMQP 1.0 layer",
  132|    342|  "Pre standard AMQP connection"
  133|    342|  };
  134|    342|  return names[p];
  135|    342|}

pn_buffer:
   46|  68.3k|{
   47|  68.3k|  pn_buffer_t *buf = (pn_buffer_t *) pni_mem_allocate(PN_CLASSCLASS(pn_buffer), sizeof(pn_buffer_t));
  ------------------
  |  |  102|  68.3k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   48|  68.3k|  if (buf != NULL) {
  ------------------
  |  Branch (48:7): [True: 68.3k, False: 0]
  ------------------
   49|  68.3k|    buf->capacity = capacity;
   50|  68.3k|    buf->start = 0;
   51|  68.3k|    buf->size = 0;
   52|  68.3k|    if (capacity > 0) {
  ------------------
  |  Branch (52:9): [True: 68.3k, False: 0]
  ------------------
   53|  68.3k|        buf->bytes = (char *) pni_mem_suballocate(PN_CLASSCLASS(pn_buffer), buf, capacity);
  ------------------
  |  |  102|  68.3k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   54|  68.3k|        if (buf->bytes == NULL) {
  ------------------
  |  Branch (54:13): [True: 0, False: 68.3k]
  ------------------
   55|      0|            pni_mem_deallocate(PN_CLASSCLASS(pn_buffer), buf);
  ------------------
  |  |  102|      0|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   56|      0|            buf = NULL;
   57|      0|        }
   58|  68.3k|    }
   59|      0|    else {
   60|       |        buf->bytes = NULL;
   61|      0|    }
   62|  68.3k|  }
   63|  68.3k|  return buf;
   64|  68.3k|}
pn_buffer_free:
   67|   141k|{
   68|   141k|  if (buf) {
  ------------------
  |  Branch (68:7): [True: 68.3k, False: 72.7k]
  ------------------
   69|  68.3k|    pni_mem_subdeallocate(PN_CLASSCLASS(pn_buffer), buf, buf->bytes);
  ------------------
  |  |  102|  68.3k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   70|  68.3k|    pni_mem_deallocate(PN_CLASSCLASS(pn_buffer), buf);
  ------------------
  |  |  102|  68.3k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   71|  68.3k|  }
   72|   141k|}
pn_buffer_size:
   75|   513k|{
   76|   513k|  return buf->size;
   77|   513k|}
pn_buffer_available:
   85|   897k|{
   86|   897k|  return buf->capacity - buf->size;
   87|   897k|}
pn_buffer_ensure:
  117|   668k|{
  118|   668k|  if (pn_buffer_available(buf) >= size) return 0;
  ------------------
  |  Branch (118:7): [True: 666k, False: 2.71k]
  ------------------
  119|       |
  120|       |  // Reject the request before adding it to the size, so the sum can't wrap
  121|  2.71k|  if (size > 0x80000000ULL) {
  ------------------
  |  Branch (121:7): [True: 0, False: 2.71k]
  ------------------
  122|      0|    return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      0|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  123|      0|  }
  124|  2.71k|  uint64_t needed = (uint64_t) buf->size + size;
  125|  2.71k|  if (needed < 32) needed = 32;
  ------------------
  |  Branch (125:7): [True: 0, False: 2.71k]
  ------------------
  126|  2.71k|  if (needed > 0x80000000ULL) {
  ------------------
  |  Branch (126:7): [True: 0, False: 2.71k]
  ------------------
  127|      0|    return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      0|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  128|      0|  }
  129|  2.71k|  uint32_t new_capacity = pni_round_up_pow2((uint32_t) needed);
  130|  2.71k|  char* new_bytes = (char *) pni_mem_subreallocate(PN_CLASSCLASS(pn_buffer), buf, buf->bytes, new_capacity);
  ------------------
  |  |  102|  2.71k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  131|  2.71k|  if (!new_bytes) {
  ------------------
  |  Branch (131:7): [True: 0, False: 2.71k]
  ------------------
  132|      0|    return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      0|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  133|      0|  }
  134|       |
  135|  2.71k|  size_t old_capacity = buf->capacity;
  136|  2.71k|  size_t old_head = pni_buffer_head(buf);
  137|  2.71k|  bool wrapped = pni_buffer_wrapped(buf);
  138|       |
  139|  2.71k|  buf->bytes = new_bytes;
  140|  2.71k|  buf->capacity = new_capacity;
  141|       |
  142|  2.71k|  if (wrapped) {
  ------------------
  |  Branch (142:7): [True: 458, False: 2.25k]
  ------------------
  143|    458|    size_t n = old_capacity - old_head;
  144|    458|    memmove(buf->bytes + buf->capacity - n, buf->bytes + old_head, n);
  145|    458|    buf->start = buf->capacity - n;
  146|    458|  }
  147|       |
  148|  2.71k|  return 0;
  149|  2.71k|}
pn_buffer_append:
  152|   850k|{
  153|   850k|  if (!size) return 0;
  ------------------
  |  Branch (153:7): [True: 349k, False: 501k]
  ------------------
  154|   501k|  int err = pn_buffer_ensure(buf, size);
  155|   501k|  if (err) return err;
  ------------------
  |  Branch (155:7): [True: 0, False: 501k]
  ------------------
  156|       |
  157|   501k|  size_t tail = pni_buffer_tail(buf);
  158|   501k|  size_t tail_space = pni_buffer_tail_space(buf);
  159|   501k|  size_t n = pn_min(tail_space, size);
  ------------------
  |  |  272|   501k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (272:22): [True: 498k, False: 2.84k]
  |  |  ------------------
  ------------------
  160|       |
  161|       |  // Heuristic check for a strange usage in messenger
  162|   501k|  if (bytes!=buf->bytes+tail) {
  ------------------
  |  Branch (162:7): [True: 501k, False: 0]
  ------------------
  163|   501k|    memcpy(buf->bytes + tail, bytes, n);
  164|   501k|    memcpy(buf->bytes, bytes + n, size - n);
  165|   501k|  }
  166|   501k|  buf->size += size;
  167|       |
  168|   501k|  return 0;
  169|   501k|}
pn_buffer_get:
  179|   384k|{
  180|   384k|  size = pn_min(size, buf->size);
  ------------------
  |  |  272|   384k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (272:22): [True: 384k, False: 0]
  |  |  ------------------
  ------------------
  181|   384k|  size_t start = pni_buffer_index(buf, offset);
  182|   384k|  size_t stop = pni_buffer_index(buf, offset + size);
  183|       |
  184|   384k|  if (size == 0) return 0;
  ------------------
  |  Branch (184:7): [True: 247k, False: 136k]
  ------------------
  185|       |
  186|   136k|  size_t sz1;
  187|   136k|  size_t sz2;
  188|       |
  189|   136k|  if (start >= stop) {
  ------------------
  |  Branch (189:7): [True: 2.02k, False: 134k]
  ------------------
  190|  2.02k|    sz1 = buf->capacity - start;
  191|  2.02k|    sz2 = stop;
  192|   134k|  } else {
  193|   134k|    sz1 = stop - start;
  194|   134k|    sz2 = 0;
  195|   134k|  }
  196|       |
  197|   136k|  memcpy(dst, buf->bytes + start, sz1);
  198|   136k|  memcpy(dst + sz1, buf->bytes, sz2);
  199|       |
  200|   136k|  return sz1 + sz2;
  201|   384k|}
pn_buffer_trim:
  204|   384k|{
  205|   384k|  if (left + right > buf->size) return PN_ARG_ERR;
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (205:7): [True: 0, False: 384k]
  ------------------
  206|       |
  207|       |  // In special case where we trim everything just clear buffer
  208|   384k|  if (left + right == buf->size) {
  ------------------
  |  Branch (208:7): [True: 384k, False: 0]
  ------------------
  209|   384k|    pn_buffer_clear(buf);
  210|   384k|    return 0;
  211|   384k|  }
  212|      0|  buf->start += left;
  213|      0|  if (buf->start >= buf->capacity)
  ------------------
  |  Branch (213:7): [True: 0, False: 0]
  ------------------
  214|      0|    buf->start -= buf->capacity;
  215|       |
  216|      0|  buf->size -= left + right;
  217|       |
  218|      0|  return 0;
  219|   384k|}
pn_buffer_clear:
  222|   655k|{
  223|   655k|  buf->start = 0;
  224|   655k|  buf->size = 0;
  225|   655k|}
pn_buffer_memory:
  263|   549k|{
  264|   549k|  if (!buf) {
  ------------------
  |  Branch (264:7): [True: 0, False: 549k]
  ------------------
  265|      0|    return (pn_rwbytes_t){0, NULL};
  266|      0|  }
  267|   549k|  pn_buffer_defrag(buf);
  268|   549k|  return (pn_rwbytes_t){.size=buf->size, .start=buf->bytes};
  269|   549k|}
buffer.c:pni_buffer_head:
   90|   351k|{
   91|   351k|  return buf->start;
   92|   351k|}
buffer.c:pni_buffer_wrapped:
  103|   504k|{
  104|   504k|  return buf->size && pni_buffer_head(buf) >= pni_buffer_tail(buf);
  ------------------
  |  Branch (104:10): [True: 349k, False: 154k]
  |  Branch (104:23): [True: 61.8k, False: 287k]
  ------------------
  105|   504k|}
buffer.c:pni_buffer_tail:
   95|  1.29M|{
   96|  1.29M|  size_t tail = buf->start + buf->size;
   97|  1.29M|  if (tail >= buf->capacity)
  ------------------
  |  Branch (97:7): [True: 123k, False: 1.16M]
  ------------------
   98|   123k|    tail -= buf->capacity;
   99|  1.29M|  return tail;
  100|  1.29M|}
buffer.c:pni_buffer_tail_space:
  108|   501k|{
  109|   501k|  if (pni_buffer_wrapped(buf)) {
  ------------------
  |  Branch (109:7): [True: 61.4k, False: 439k]
  ------------------
  110|  61.4k|    return pn_buffer_available(buf);
  111|   439k|  } else {
  112|   439k|    return buf->capacity - pni_buffer_tail(buf);
  113|   439k|  }
  114|   501k|}
buffer.c:pni_buffer_index:
  172|   768k|{
  173|   768k|  size_t result = buf->start + index;
  174|   768k|  if (result >= buf->capacity) result -= buf->capacity;
  ------------------
  |  Branch (174:7): [True: 2.02k, False: 766k]
  ------------------
  175|   768k|  return result;
  176|   768k|}
buffer.c:pn_buffer_defrag:
  247|   549k|{
  248|   549k|  pn_buffer_rotate(buf, buf->start);
  249|   549k|  buf->start = 0;
  250|   549k|  return 0;
  251|   549k|}
buffer.c:pn_buffer_rotate:
  227|   549k|static void pn_buffer_rotate (pn_buffer_t *buf, size_t sz) {
  228|   549k|  if (sz == 0) return;
  ------------------
  |  Branch (228:7): [True: 549k, False: 131]
  ------------------
  229|       |
  230|    131|  unsigned c = 0, v = 0;
  231|  9.61k|  for (; c < buf->capacity; v++) {
  ------------------
  |  Branch (231:10): [True: 9.48k, False: 131]
  ------------------
  232|  9.48k|    unsigned t = v, tp = v + sz;
  233|  9.48k|    char tmp = buf->bytes[v];
  234|  9.48k|    c++;
  235|  36.3k|    while (tp != v) {
  ------------------
  |  Branch (235:12): [True: 26.8k, False: 9.48k]
  ------------------
  236|  26.8k|      buf->bytes[t] = buf->bytes[tp];
  237|  26.8k|      t = tp;
  238|  26.8k|      tp += sz;
  239|  26.8k|      if (tp >= buf->capacity) tp -= buf->capacity;
  ------------------
  |  Branch (239:11): [True: 22.3k, False: 4.50k]
  ------------------
  240|  26.8k|      c++;
  241|  26.8k|    }
  242|  9.48k|    buf->bytes[t] = tmp;
  243|  9.48k|  }
  244|    131|}

pn_type_name:
   51|  4.38k|{
   52|  4.38k|  switch ((uint8_t)type)
   53|  4.38k|  {
   54|    392|  case PN_NULL: return "PN_NULL";
  ------------------
  |  Branch (54:3): [True: 392, False: 3.99k]
  ------------------
   55|    665|  case PN_BOOL: return "PN_BOOL";
  ------------------
  |  Branch (55:3): [True: 665, False: 3.72k]
  ------------------
   56|     59|  case PN_UBYTE: return "PN_UBYTE";
  ------------------
  |  Branch (56:3): [True: 59, False: 4.32k]
  ------------------
   57|     27|  case PN_BYTE: return "PN_BYTE";
  ------------------
  |  Branch (57:3): [True: 27, False: 4.35k]
  ------------------
   58|     58|  case PN_USHORT: return "PN_USHORT";
  ------------------
  |  Branch (58:3): [True: 58, False: 4.32k]
  ------------------
   59|     93|  case PN_SHORT: return "PN_SHORT";
  ------------------
  |  Branch (59:3): [True: 93, False: 4.29k]
  ------------------
   60|    559|  case PN_UINT: return "PN_UINT";
  ------------------
  |  Branch (60:3): [True: 559, False: 3.82k]
  ------------------
   61|    166|  case PN_INT: return "PN_INT";
  ------------------
  |  Branch (61:3): [True: 166, False: 4.22k]
  ------------------
   62|     46|  case PN_CHAR: return "PN_CHAR";
  ------------------
  |  Branch (62:3): [True: 46, False: 4.34k]
  ------------------
   63|    418|  case PN_ULONG: return "PN_ULONG";
  ------------------
  |  Branch (63:3): [True: 418, False: 3.96k]
  ------------------
   64|    152|  case PN_LONG: return "PN_LONG";
  ------------------
  |  Branch (64:3): [True: 152, False: 4.23k]
  ------------------
   65|     48|  case PN_TIMESTAMP: return "PN_TIMESTAMP";
  ------------------
  |  Branch (65:3): [True: 48, False: 4.33k]
  ------------------
   66|     83|  case PN_FLOAT: return "PN_FLOAT";
  ------------------
  |  Branch (66:3): [True: 83, False: 4.30k]
  ------------------
   67|     40|  case PN_DOUBLE: return "PN_DOUBLE";
  ------------------
  |  Branch (67:3): [True: 40, False: 4.34k]
  ------------------
   68|     91|  case PN_DECIMAL32: return "PN_DECIMAL32";
  ------------------
  |  Branch (68:3): [True: 91, False: 4.29k]
  ------------------
   69|     84|  case PN_DECIMAL64: return "PN_DECIMAL64";
  ------------------
  |  Branch (69:3): [True: 84, False: 4.30k]
  ------------------
   70|     87|  case PN_DECIMAL128: return "PN_DECIMAL128";
  ------------------
  |  Branch (70:3): [True: 87, False: 4.29k]
  ------------------
   71|     61|  case PN_UUID: return "PN_UUID";
  ------------------
  |  Branch (71:3): [True: 61, False: 4.32k]
  ------------------
   72|    193|  case PN_BINARY: return "PN_BINARY";
  ------------------
  |  Branch (72:3): [True: 193, False: 4.19k]
  ------------------
   73|    111|  case PN_STRING: return "PN_STRING";
  ------------------
  |  Branch (73:3): [True: 111, False: 4.27k]
  ------------------
   74|    174|  case PN_SYMBOL: return "PN_SYMBOL";
  ------------------
  |  Branch (74:3): [True: 174, False: 4.21k]
  ------------------
   75|      0|  case PN_DESCRIBED: return "PN_DESCRIBED";
  ------------------
  |  Branch (75:3): [True: 0, False: 4.38k]
  ------------------
   76|    334|  case PN_ARRAY: return "PN_ARRAY";
  ------------------
  |  Branch (76:3): [True: 334, False: 4.05k]
  ------------------
   77|      0|  case PN_ARRAY_DESCRIBED: return "PN_ARRAY_DESCRIBED";
  ------------------
  |  |   34|      0|#define PN_ARRAY_DESCRIBED 26  // Internal type: described array
  ------------------
  |  Branch (77:3): [True: 0, False: 4.38k]
  ------------------
   78|    356|  case PN_LIST: return "PN_LIST";
  ------------------
  |  Branch (78:3): [True: 356, False: 4.03k]
  ------------------
   79|     67|  case PN_MAP: return "PN_MAP";
  ------------------
  |  Branch (79:3): [True: 67, False: 4.31k]
  ------------------
   80|     22|  default: break;
  ------------------
  |  Branch (80:3): [True: 22, False: 4.36k]
  ------------------
   81|  4.38k|  }
   82|       |
   83|     22|  return "<UNKNOWN>";
   84|  4.38k|}
pni_inspect_atom:
  116|  5.77M|{
  117|  5.77M|  switch (atom->type) {
  118|   987k|  case PN_NULL:
  ------------------
  |  Branch (118:3): [True: 987k, False: 4.78M]
  ------------------
  119|   987k|    pn_fixed_string_addf(str, "null");
  120|   987k|    return;
  121|  3.40M|  case PN_BOOL:
  ------------------
  |  Branch (121:3): [True: 3.40M, False: 2.37M]
  ------------------
  122|  3.40M|    pn_fixed_string_addf(str, atom->u.as_bool ? "true" : "false");
  ------------------
  |  Branch (122:31): [True: 1.32M, False: 2.07M]
  ------------------
  123|  3.40M|    return;
  124|    949|  case PN_UBYTE:
  ------------------
  |  Branch (124:3): [True: 949, False: 5.77M]
  ------------------
  125|    949|    pn_fixed_string_addf(str, "%" PRIu8, atom->u.as_ubyte);
  126|    949|    return;
  127|    428|  case PN_BYTE:
  ------------------
  |  Branch (127:3): [True: 428, False: 5.77M]
  ------------------
  128|    428|    pn_fixed_string_addf(str, "%" PRIi8, atom->u.as_byte);
  129|    428|    return;
  130|    553|  case PN_USHORT:
  ------------------
  |  Branch (130:3): [True: 553, False: 5.77M]
  ------------------
  131|    553|    pn_fixed_string_addf(str, "%" PRIu16, atom->u.as_ushort);
  132|    553|    return;
  133|    532|  case PN_SHORT:
  ------------------
  |  Branch (133:3): [True: 532, False: 5.77M]
  ------------------
  134|    532|    pn_fixed_string_addf(str, "%" PRIi16, atom->u.as_short);
  135|    532|    return;
  136|  1.09M|  case PN_UINT:
  ------------------
  |  Branch (136:3): [True: 1.09M, False: 4.68M]
  ------------------
  137|  1.09M|    pn_fixed_string_addf(str, "%" PRIu32, atom->u.as_uint);
  138|  1.09M|    return;
  139|    984|  case PN_INT:
  ------------------
  |  Branch (139:3): [True: 984, False: 5.77M]
  ------------------
  140|    984|    pn_fixed_string_addf(str, "%" PRIi32, atom->u.as_int);
  141|    984|    return;
  142|    356|  case PN_CHAR:
  ------------------
  |  Branch (142:3): [True: 356, False: 5.77M]
  ------------------
  143|    356|    pn_fixed_string_addf(str, "%c",  atom->u.as_char);
  144|    356|    return;
  145|   272k|  case PN_ULONG:
  ------------------
  |  Branch (145:3): [True: 272k, False: 5.50M]
  ------------------
  146|   272k|    pn_fixed_string_addf(str, "%" PRIu64, atom->u.as_ulong);
  147|   272k|    return;
  148|    798|  case PN_LONG:
  ------------------
  |  Branch (148:3): [True: 798, False: 5.77M]
  ------------------
  149|    798|    pn_fixed_string_addf(str, "%" PRIi64, atom->u.as_long);
  150|    798|    return;
  151|    272|  case PN_TIMESTAMP:
  ------------------
  |  Branch (151:3): [True: 272, False: 5.77M]
  ------------------
  152|    272|    pn_fixed_string_addf(str, "%" PRIi64, atom->u.as_timestamp);
  153|    272|    return;
  154|  1.14k|  case PN_FLOAT:
  ------------------
  |  Branch (154:3): [True: 1.14k, False: 5.77M]
  ------------------
  155|  1.14k|    pn_fixed_string_addf(str, "%g", atom->u.as_float);
  156|  1.14k|    return;
  157|    123|  case PN_DOUBLE:
  ------------------
  |  Branch (157:3): [True: 123, False: 5.77M]
  ------------------
  158|    123|    pn_fixed_string_addf(str, "%g", atom->u.as_double);
  159|    123|    return;
  160|    302|  case PN_DECIMAL32:
  ------------------
  |  Branch (160:3): [True: 302, False: 5.77M]
  ------------------
  161|    302|    pn_fixed_string_addf(str, "D32(%" PRIu32 ")", atom->u.as_decimal32);
  162|    302|    return;
  163|    144|  case PN_DECIMAL64:
  ------------------
  |  Branch (163:3): [True: 144, False: 5.77M]
  ------------------
  164|    144|    pn_fixed_string_addf(str, "D64(%" PRIu64 ")", atom->u.as_decimal64);
  165|    144|    return;
  166|    202|  case PN_DECIMAL128:
  ------------------
  |  Branch (166:3): [True: 202, False: 5.77M]
  ------------------
  167|    202|    pn_fixed_string_addf(str, "D128(%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
  168|    202|                          "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
  169|    202|                          "%02hhx%02hhx)",
  170|    202|                          atom->u.as_decimal128.bytes[0],
  171|    202|                          atom->u.as_decimal128.bytes[1],
  172|    202|                          atom->u.as_decimal128.bytes[2],
  173|    202|                          atom->u.as_decimal128.bytes[3],
  174|    202|                          atom->u.as_decimal128.bytes[4],
  175|    202|                          atom->u.as_decimal128.bytes[5],
  176|    202|                          atom->u.as_decimal128.bytes[6],
  177|    202|                          atom->u.as_decimal128.bytes[7],
  178|    202|                          atom->u.as_decimal128.bytes[8],
  179|    202|                          atom->u.as_decimal128.bytes[9],
  180|    202|                          atom->u.as_decimal128.bytes[10],
  181|    202|                          atom->u.as_decimal128.bytes[11],
  182|    202|                          atom->u.as_decimal128.bytes[12],
  183|    202|                          atom->u.as_decimal128.bytes[13],
  184|    202|                          atom->u.as_decimal128.bytes[14],
  185|    202|                          atom->u.as_decimal128.bytes[15]);
  186|    202|    return;
  187|    194|  case PN_UUID:
  ------------------
  |  Branch (187:3): [True: 194, False: 5.77M]
  ------------------
  188|    194|    pn_fixed_string_addf(str, "UUID(%02hhx%02hhx%02hhx%02hhx-"
  189|    194|                          "%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-"
  190|    194|                          "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx)",
  191|    194|                          atom->u.as_uuid.bytes[0],
  192|    194|                          atom->u.as_uuid.bytes[1],
  193|    194|                          atom->u.as_uuid.bytes[2],
  194|    194|                          atom->u.as_uuid.bytes[3],
  195|    194|                          atom->u.as_uuid.bytes[4],
  196|    194|                          atom->u.as_uuid.bytes[5],
  197|    194|                          atom->u.as_uuid.bytes[6],
  198|    194|                          atom->u.as_uuid.bytes[7],
  199|    194|                          atom->u.as_uuid.bytes[8],
  200|    194|                          atom->u.as_uuid.bytes[9],
  201|    194|                          atom->u.as_uuid.bytes[10],
  202|    194|                          atom->u.as_uuid.bytes[11],
  203|    194|                          atom->u.as_uuid.bytes[12],
  204|    194|                          atom->u.as_uuid.bytes[13],
  205|    194|                          atom->u.as_uuid.bytes[14],
  206|    194|                          atom->u.as_uuid.bytes[15]);
  207|    194|    return;
  208|  7.76k|  case PN_BINARY:
  ------------------
  |  Branch (208:3): [True: 7.76k, False: 5.76M]
  ------------------
  209|  9.59k|  case PN_STRING:
  ------------------
  |  Branch (209:3): [True: 1.82k, False: 5.77M]
  ------------------
  210|  13.8k|  case PN_SYMBOL:
  ------------------
  |  Branch (210:3): [True: 4.24k, False: 5.77M]
  ------------------
  211|  13.8k|    {
  212|  13.8k|      const char *pfx;
  213|  13.8k|      pn_bytes_t bin = atom->u.as_bytes;
  214|  13.8k|      bool quote;
  215|  13.8k|      switch (atom->type) {
  216|  7.76k|      case PN_BINARY:
  ------------------
  |  Branch (216:7): [True: 7.76k, False: 6.07k]
  ------------------
  217|  7.76k|        pfx = "b";
  218|  7.76k|        quote = true;
  219|  7.76k|        break;
  220|  1.82k|      case PN_STRING:
  ------------------
  |  Branch (220:7): [True: 1.82k, False: 12.0k]
  ------------------
  221|  1.82k|        pfx = "";
  222|  1.82k|        quote = true;
  223|  1.82k|        break;
  224|  4.24k|      case PN_SYMBOL:
  ------------------
  |  Branch (224:7): [True: 4.24k, False: 9.59k]
  ------------------
  225|  4.24k|        pfx = ":";
  226|  4.24k|        quote = false;
  227|  4.79k|        for (unsigned i = 0; i < bin.size; i++) {
  ------------------
  |  Branch (227:30): [True: 1.57k, False: 3.21k]
  ------------------
  228|  1.57k|          if (!isalpha(bin.start[i])) {
  ------------------
  |  Branch (228:15): [True: 1.03k, False: 546]
  ------------------
  229|  1.03k|            quote = true;
  230|  1.03k|            break;
  231|  1.03k|          }
  232|  1.57k|        }
  233|  4.24k|        break;
  234|      0|      default:
  ------------------
  |  Branch (234:7): [True: 0, False: 13.8k]
  ------------------
  235|      0|        assert(false);
  236|      0|        return;
  237|  13.8k|      }
  238|       |
  239|  13.8k|      pn_fixed_string_addf(str, "%s", pfx);
  240|  13.8k|      if (quote) pn_fixed_string_addf(str, "\"");
  ------------------
  |  Branch (240:11): [True: 10.6k, False: 3.21k]
  ------------------
  241|  13.8k|      pn_fixed_string_quote(str, bin.start, bin.size);
  242|  13.8k|      if (quote) pn_fixed_string_addf(str, "\"");
  ------------------
  |  Branch (242:11): [True: 10.6k, False: 3.21k]
  ------------------
  243|  13.8k|      return;
  244|  13.8k|    }
  245|      0|  case PN_LIST:
  ------------------
  |  Branch (245:3): [True: 0, False: 5.77M]
  ------------------
  246|      0|    pn_fixed_string_addf(str, "<list>");
  247|      0|    return;
  248|      0|  case PN_MAP:
  ------------------
  |  Branch (248:3): [True: 0, False: 5.77M]
  ------------------
  249|      0|    pn_fixed_string_addf(str, "<map>");
  250|      0|    return;
  251|      0|  case PN_ARRAY:
  ------------------
  |  Branch (251:3): [True: 0, False: 5.77M]
  ------------------
  252|      0|    pn_fixed_string_addf(str, "<array>");
  253|      0|    return;
  254|      0|  case PN_DESCRIBED:
  ------------------
  |  Branch (254:3): [True: 0, False: 5.77M]
  ------------------
  255|      0|    pn_fixed_string_addf(str, "<described>");
  256|      0|    return;
  257|    410|  default:
  ------------------
  |  Branch (257:3): [True: 410, False: 5.77M]
  ------------------
  258|    410|    pn_fixed_string_addf(str, "<undefined: %i>", atom->type);
  259|    410|    return;
  260|  5.77M|  }
  261|  5.77M|}
pni_inspect_enter:
  275|  6.21M|{
  276|  6.21M|  pn_fixed_string_t *str = (pn_fixed_string_t *) ctx;
  277|       |
  278|  6.21M|  pni_node_t *parent = pn_data_node(data, node->parent);
  279|  6.21M|  const pn_fields_t *fields = pni_node_fields(data, parent);
  280|  6.21M|  pni_node_t *grandparent = parent ? pn_data_node(data, parent->parent) : NULL;
  ------------------
  |  Branch (280:29): [True: 6.20M, False: 2.99k]
  ------------------
  281|  6.21M|  const pn_fields_t *grandfields = pni_node_fields(data, grandparent);
  282|       |
  283|  6.21M|  if (grandfields) {
  ------------------
  |  Branch (283:7): [True: 71.6k, False: 6.14M]
  ------------------
  284|  71.6k|    if (node->type == PN_NULL) {
  ------------------
  |  Branch (284:9): [True: 1.65k, False: 69.9k]
  ------------------
  285|  1.65k|      return 0;
  286|  1.65k|    }
  287|  69.9k|    pni_nid_t lindex = pni_node_lindex(data, node);
  288|  69.9k|    const char *name = (lindex < grandfields->field_count)
  ------------------
  |  Branch (288:24): [True: 1.06k, False: 68.9k]
  ------------------
  289|  69.9k|        ? (const char*)FIELD_STRINGPOOL.STRING0+FIELD_FIELDS[grandfields->first_field_index+lindex]
  290|  69.9k|        : NULL;
  291|  69.9k|    if (name) {
  ------------------
  |  Branch (291:9): [True: 1.06k, False: 68.9k]
  ------------------
  292|  1.06k|      pn_fixed_string_addf(str, "%s=", name);
  293|  1.06k|    }
  294|  69.9k|  }
  295|       |
  296|  6.21M|  switch (node->type) {
  297|  3.97k|  case PN_DESCRIBED:
  ------------------
  |  Branch (297:3): [True: 3.97k, False: 6.20M]
  ------------------
  298|  3.97k|    pn_fixed_string_addf(str, "@");
  299|  3.97k|    return 0;
  300|  4.31k|  case PN_ARRAY:
  ------------------
  |  Branch (300:3): [True: 4.31k, False: 6.20M]
  ------------------
  301|       |    // XXX: need to fix for described arrays
  302|  4.31k|    pn_fixed_string_addf(str, "@%s[", pn_type_name(node->array_type));
  303|  4.31k|    return 0;
  304|   424k|  case PN_LIST:
  ------------------
  |  Branch (304:3): [True: 424k, False: 5.78M]
  ------------------
  305|   424k|    pn_fixed_string_addf(str, "[");
  306|   424k|    return 0;
  307|    908|  case PN_MAP:
  ------------------
  |  Branch (307:3): [True: 908, False: 6.21M]
  ------------------
  308|    908|    pn_fixed_string_addf(str, "{");
  309|    908|    return 0;
  310|  5.77M|  default: {
  ------------------
  |  Branch (310:3): [True: 5.77M, False: 433k]
  ------------------
  311|  5.77M|    pn_rwbytes_t buf = (data->buf) ? pn_buffer_memory(data->buf) : (pn_rwbytes_t){0};
  ------------------
  |  Branch (311:24): [True: 549k, False: 5.22M]
  ------------------
  312|  5.77M|    pn_atom_t tmp = {node->type};
  313|  5.77M|    switch (node->type) {
  314|  13.8k|    case PN_BINARY: case PN_STRING: case PN_SYMBOL:
  ------------------
  |  Branch (314:5): [True: 7.76k, False: 5.76M]
  |  Branch (314:21): [True: 1.82k, False: 5.77M]
  |  Branch (314:37): [True: 4.24k, False: 5.77M]
  ------------------
  315|  13.8k|      tmp.u.as_bytes = (pn_bytes_t){ node->u.as_bytes.size, buf.start + node->u.as_bytes.offset };
  316|  13.8k|      break;
  317|    202|    case PN_DECIMAL128:
  ------------------
  |  Branch (317:5): [True: 202, False: 5.77M]
  ------------------
  318|    202|      memcpy(tmp.u.as_decimal128.bytes, buf.start + node->u.as_bytes.offset, 16);
  319|    202|      break;
  320|    194|    case PN_UUID:
  ------------------
  |  Branch (320:5): [True: 194, False: 5.77M]
  ------------------
  321|    194|      memcpy(tmp.u.as_uuid.bytes, buf.start + node->u.as_bytes.offset, 16);
  322|    194|      break;
  323|  5.76M|    default:
  ------------------
  |  Branch (323:5): [True: 5.76M, False: 14.2k]
  ------------------
  324|  5.76M|      memcpy(&tmp.u, &node->u, sizeof(node->u));
  325|  5.76M|      break;
  326|  5.77M|    }
  327|  5.77M|    if (fields && node->prev == 0) {
  ------------------
  |  Branch (327:9): [True: 1.79k, False: 5.77M]
  |  Branch (327:19): [True: 1.37k, False: 419]
  ------------------
  328|  1.37k|      pn_fixed_string_addf(str, "%s", (const char *)FIELD_STRINGPOOL.STRING0+FIELD_NAME[fields->name_index]);
  329|  1.37k|      pn_fixed_string_addf(str, "(");
  330|  1.37k|      pni_inspect_atom(&tmp, str);
  331|  1.37k|      pn_fixed_string_addf(str, ")");
  332|  1.37k|      return 0;
  333|  5.77M|    } else {
  334|  5.77M|      pni_inspect_atom(&tmp, str);
  335|  5.77M|      return 0;
  336|  5.77M|    }
  337|  5.77M|  }
  338|  6.21M|  }
  339|  6.21M|}
pni_next_nonnull:
  342|  69.1k|{
  343|  70.7k|  while (node) {
  ------------------
  |  Branch (343:10): [True: 70.6k, False: 82]
  ------------------
  344|  70.6k|    node = pn_data_node(data, node->next);
  345|  70.6k|    if (node && node->type != PN_NULL) {
  ------------------
  |  Branch (345:9): [True: 70.5k, False: 82]
  |  Branch (345:17): [True: 69.1k, False: 1.48k]
  ------------------
  346|  69.1k|      return node;
  347|  69.1k|    }
  348|  70.6k|  }
  349|       |
  350|     82|  return NULL;
  351|  69.1k|}
pni_inspect_exit:
  354|  6.21M|{
  355|  6.21M|  pn_fixed_string_t *str = (pn_fixed_string_t *) ctx;
  356|       |
  357|  6.21M|  switch (node->type) {
  358|  4.31k|  case PN_ARRAY:
  ------------------
  |  Branch (358:3): [True: 4.31k, False: 6.20M]
  ------------------
  359|   428k|  case PN_LIST:
  ------------------
  |  Branch (359:3): [True: 424k, False: 5.78M]
  ------------------
  360|   428k|    pn_fixed_string_addf(str, "]");
  361|   428k|    break;
  362|    908|  case PN_MAP:
  ------------------
  |  Branch (362:3): [True: 908, False: 6.21M]
  ------------------
  363|    908|    pn_fixed_string_addf(str, "}");
  364|    908|    break;
  365|  5.78M|  default:
  ------------------
  |  Branch (365:3): [True: 5.78M, False: 429k]
  ------------------
  366|  5.78M|    break;
  367|  6.21M|  }
  368|       |
  369|  6.21M|  pni_node_t *parent = pn_data_node(data, node->parent);
  370|  6.21M|  pni_node_t *grandparent = parent ? pn_data_node(data, parent->parent) : NULL;
  ------------------
  |  Branch (370:29): [True: 6.20M, False: 2.99k]
  ------------------
  371|  6.21M|  const pn_fields_t *grandfields = pni_node_fields(data, grandparent);
  372|  6.21M|  if (!grandfields || node->type != PN_NULL) {
  ------------------
  |  Branch (372:7): [True: 6.14M, False: 71.6k]
  |  Branch (372:23): [True: 69.9k, False: 1.65k]
  ------------------
  373|  6.21M|    if (node->next) {
  ------------------
  |  Branch (373:9): [True: 6.19M, False: 12.6k]
  ------------------
  374|  6.19M|      if (parent && parent->type == PN_MAP && (pni_node_lindex(data, node) % 2) == 0) {
  ------------------
  |  Branch (374:11): [True: 6.19M, False: 0]
  |  Branch (374:21): [True: 5.61k, False: 6.19M]
  |  Branch (374:47): [True: 2.91k, False: 2.69k]
  ------------------
  375|  2.91k|        pn_fixed_string_addf(str, "=");
  376|  6.19M|      } else if (parent && parent->type == PN_DESCRIBED && node->prev == 0) {
  ------------------
  |  Branch (376:18): [True: 6.19M, False: 0]
  |  Branch (376:28): [True: 3.18k, False: 6.19M]
  |  Branch (376:60): [True: 3.18k, False: 0]
  ------------------
  377|  3.18k|        pn_fixed_string_addf(str, " ");
  378|  6.19M|      } else {
  379|  6.19M|        if (!grandfields || pni_next_nonnull(data, node)) {
  ------------------
  |  Branch (379:13): [True: 6.12M, False: 69.1k]
  |  Branch (379:29): [True: 69.1k, False: 82]
  ------------------
  380|  6.19M|          pn_fixed_string_addf(str, ", ");
  381|  6.19M|        }
  382|  6.19M|      }
  383|  6.19M|    }
  384|  6.21M|  }
  385|       |
  386|  6.21M|  return 0;
  387|  6.21M|}
pn_data:
  409|  73.1k|{
  410|  73.1k|  static const pn_class_t clazz = PN_CLASS(pn_data);
  ------------------
  |  |   67|  73.1k|#define PN_CLASS(PREFIX) {                      \
  |  |   68|  73.1k|    #PREFIX,                                    \
  |  |   69|  73.1k|    CID_ ## PREFIX,                             \
  |  |   70|  73.1k|    NULL,                                       \
  |  |   71|  73.1k|    PREFIX ## _initialize,                      \
  |  |  ------------------
  |  |  |  |  396|  73.1k|#define pn_data_initialize NULL
  |  |  ------------------
  |  |   72|  73.1k|    NULL,                                       \
  |  |   73|  73.1k|    NULL,                                       \
  |  |   74|  73.1k|    NULL,                                       \
  |  |   75|  73.1k|    PREFIX ## _finalize,                        \
  |  |   76|  73.1k|    NULL,                                       \
  |  |   77|  73.1k|    PREFIX ## _hashcode,                        \
  |  |  ------------------
  |  |  |  |  397|  73.1k|#define pn_data_hashcode NULL
  |  |  ------------------
  |  |   78|  73.1k|    PREFIX ## _compare,                         \
  |  |  ------------------
  |  |  |  |  398|  73.1k|#define pn_data_compare NULL
  |  |  ------------------
  |  |   79|  73.1k|    PREFIX ## _inspect                          \
  |  |   80|  73.1k|}
  ------------------
  411|  73.1k|  pn_data_t *data = (pn_data_t *) pn_class_new(&clazz, sizeof(pn_data_t));
  412|  73.1k|  data->capacity = capacity;
  413|  73.1k|  data->size = 0;
  414|  73.1k|  data->nodes = capacity ? (pni_node_t *) pni_mem_suballocate(&clazz, data, capacity * sizeof(pni_node_t)) : NULL;
  ------------------
  |  Branch (414:17): [True: 0, False: 73.1k]
  ------------------
  415|  73.1k|  data->buf = NULL;
  416|  73.1k|  data->parent = 0;
  417|  73.1k|  data->current = 0;
  418|  73.1k|  data->base_parent = 0;
  419|  73.1k|  data->base_current = 0;
  420|  73.1k|  data->error = NULL;
  421|       |  /* No limits by default: pn_data_t is a trusted local object.
  422|       |   * Decode-time limits are applied by pni_switch_to_data() at each
  423|       |   * specific call site according to what kind of peer data is being
  424|       |   * decoded. */
  425|  73.1k|  data->max_nid = 0;
  426|  73.1k|  data->max_buf_size = 0;
  427|  73.1k|  return data;
  428|  73.1k|}
pn_data_set_decode_limits:
  431|  3.07k|{
  432|  3.07k|  if (!data) return;
  ------------------
  |  Branch (432:7): [True: 0, False: 3.07k]
  ------------------
  433|       |  /* Clamp the caller's size_t down to pni_nid_t range on entry. */
  434|  3.07k|  data->max_nid = (pni_nid_t) pn_min(max_nodes, PNI_NID_MAX);
  ------------------
  |  |  272|  3.07k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (272:22): [True: 0, False: 3.07k]
  |  |  ------------------
  ------------------
  435|  3.07k|  data->max_buf_size = max_buf;
  436|       |
  437|       |  /* Shrink the backing array to max(live nodes, max_nid) if it is now
  438|       |   * oversized.  A failed realloc-to-smaller is harmless: the limit is still
  439|       |   * enforced by the size >= max_nid check in pni_data_new(). */
  440|  3.07k|  if (data->max_nid > 0 && data->nodes) {
  ------------------
  |  Branch (440:7): [True: 0, False: 3.07k]
  |  Branch (440:28): [True: 0, False: 0]
  ------------------
  441|      0|    pni_nid_t new_cap = pn_max(data->size, data->max_nid);
  ------------------
  |  |  273|      0|#define pn_max(X,Y) ((X) < (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (273:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  442|      0|    if (new_cap < data->capacity) {
  ------------------
  |  Branch (442:9): [True: 0, False: 0]
  ------------------
  443|      0|      pni_node_t *trimmed = (pni_node_t *) pni_mem_subreallocate(
  444|      0|          pn_class(data), data, data->nodes, new_cap * sizeof(pni_node_t));
  445|      0|      if (trimmed) {
  ------------------
  |  Branch (445:11): [True: 0, False: 0]
  ------------------
  446|      0|        data->nodes    = trimmed;
  447|      0|        data->capacity = new_cap;
  448|      0|      }
  449|       |      /* If realloc failed: keep the existing buffer; limit still enforced. */
  450|      0|    }
  451|      0|  }
  452|  3.07k|}
pn_data_free:
  455|  6.02M|{
  456|  6.02M|  pn_free(data);
  457|  6.02M|}
pn_data_error:
  465|  2.70k|{
  466|  2.70k|  return pni_data_error(data);
  467|  2.70k|}
pn_data_clear:
  475|   246k|{
  476|   246k|  if (data) {
  ------------------
  |  Branch (476:7): [True: 3.07k, False: 243k]
  ------------------
  477|  3.07k|    data->size = 0;
  478|  3.07k|    data->parent = 0;
  479|  3.07k|    data->current = 0;
  480|  3.07k|    data->base_parent = 0;
  481|  3.07k|    data->base_current = 0;
  482|  3.07k|    pn_error_clear(data->error);
  483|  3.07k|    if (data->buf) pn_buffer_clear(data->buf);
  ------------------
  |  Branch (483:9): [True: 0, False: 3.07k]
  ------------------
  484|  3.07k|  }
  485|   246k|}
pn_data_rewind:
 1316|  3.07k|{
 1317|  3.07k|  data->parent = data->base_parent;
 1318|  3.07k|  data->current = data->base_current;
 1319|  3.07k|}
pni_data_traverse:
 1418|  73.1k|{
 1419|  73.1k|  pni_node_t *node = data->size ? pn_data_node(data, 1) : NULL;
  ------------------
  |  Branch (1419:22): [True: 2.99k, False: 70.1k]
  ------------------
 1420|  6.28M|  while (node) {
  ------------------
  |  Branch (1420:10): [True: 6.21M, False: 73.1k]
  ------------------
 1421|  6.21M|    pni_node_t *parent = pn_data_node(data, node->parent);
 1422|       |
 1423|  6.21M|    int err = enter(ctx, data, node);
 1424|  6.21M|    if (err) return err;
  ------------------
  |  Branch (1424:9): [True: 0, False: 6.21M]
  ------------------
 1425|       |
 1426|  6.21M|    size_t next = 0;
 1427|  6.21M|    if (pni_node_get_down(node)) {
  ------------------
  |  Branch (1427:9): [True: 9.74k, False: 6.20M]
  ------------------
 1428|  9.74k|      next = pni_node_get_down(node);
 1429|  6.20M|    } else if (node->next) {
  ------------------
  |  Branch (1429:16): [True: 6.19M, False: 6.90k]
  ------------------
 1430|  6.19M|      err = exit(ctx, data, node);
 1431|  6.19M|      if (err) return err;
  ------------------
  |  Branch (1431:11): [True: 0, False: 6.19M]
  ------------------
 1432|  6.19M|      next = node->next;
 1433|  6.19M|    } else {
 1434|  6.90k|      err = exit(ctx, data, node);
 1435|  6.90k|      if (err) return err;
  ------------------
  |  Branch (1435:11): [True: 0, False: 6.90k]
  ------------------
 1436|  12.7k|      while (parent) {
  ------------------
  |  Branch (1436:14): [True: 9.74k, False: 2.99k]
  ------------------
 1437|  9.74k|        err = exit(ctx, data, parent);
 1438|  9.74k|        if (err) return err;
  ------------------
  |  Branch (1438:13): [True: 0, False: 9.74k]
  ------------------
 1439|  9.74k|        if (parent->next) {
  ------------------
  |  Branch (1439:13): [True: 3.90k, False: 5.84k]
  ------------------
 1440|  3.90k|          next = parent->next;
 1441|  3.90k|          break;
 1442|  5.84k|        } else {
 1443|  5.84k|          parent = pn_data_node(data, parent->parent);
 1444|  5.84k|        }
 1445|  9.74k|      }
 1446|  6.90k|    }
 1447|       |
 1448|  6.21M|    node = pn_data_node(data, next);
 1449|  6.21M|  }
 1450|       |
 1451|  73.1k|  return 0;
 1452|  73.1k|}
pn_data_enter:
 1475|  12.2k|{
 1476|  12.2k|  if (data->current) {
  ------------------
  |  Branch (1476:7): [True: 12.2k, False: 0]
  ------------------
 1477|  12.2k|    data->parent = data->current;
 1478|  12.2k|    data->current = 0;
 1479|  12.2k|    return true;
 1480|  12.2k|  } else {
 1481|       |    return false;
 1482|      0|  }
 1483|  12.2k|}
pn_data_exit:
 1486|  6.38k|{
 1487|  6.38k|  if (data->parent) {
  ------------------
  |  Branch (1487:7): [True: 6.38k, False: 0]
  ------------------
 1488|  6.38k|    pni_node_t *parent = pn_data_node(data, data->parent);
 1489|  6.38k|    data->current = data->parent;
 1490|  6.38k|    data->parent = parent->parent;
 1491|  6.38k|    return true;
 1492|  6.38k|  } else {
 1493|       |    return false;
 1494|      0|  }
 1495|  6.38k|}
pn_data_decode:
 1623|  3.07k|{
 1624|  3.07k|  pn_decoder_t decoder;
 1625|  3.07k|  pn_decoder_initialize(&decoder);
 1626|  3.07k|  ssize_t r = pn_decoder_decode(&decoder, bytes, size, data);
 1627|  3.07k|  pn_decoder_finalize(&decoder);
 1628|  3.07k|  return r;
 1629|  3.07k|}
pn_data_put_list:
 1641|   424k|{
 1642|   424k|  pni_node_t *node = pni_data_add(data);
 1643|   424k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      3|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1643:7): [True: 3, False: 424k]
  ------------------
 1644|   424k|  node->type = PN_LIST;
 1645|   424k|  node->u.as_compound.down = 0;
 1646|   424k|  node->u.as_compound.children_count = 0;
 1647|   424k|  return 0;
 1648|   424k|}
pn_data_put_map:
 1651|    909|{
 1652|    909|  pni_node_t *node = pni_data_add(data);
 1653|    909|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1653:7): [True: 1, False: 908]
  ------------------
 1654|    908|  node->type = PN_MAP;
 1655|    908|  node->u.as_compound.down = 0;
 1656|    908|  node->u.as_compound.children_count = 0;
 1657|    908|  return 0;
 1658|    909|}
pn_data_put_array:
 1661|  4.72k|{
 1662|  4.72k|  pni_node_t *node = pni_data_add(data);
 1663|  4.72k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1663:7): [True: 1, False: 4.72k]
  ------------------
 1664|  4.72k|  node->type = described ? PN_ARRAY_DESCRIBED : PN_ARRAY;
  ------------------
  |  |   34|    410|#define PN_ARRAY_DESCRIBED 26  // Internal type: described array
  ------------------
  |  Branch (1664:16): [True: 410, False: 4.31k]
  ------------------
 1665|  4.72k|  node->array_type = (uint8_t)type;
 1666|  4.72k|  node->u.as_compound.down = 0;
 1667|  4.72k|  node->u.as_compound.children_count = 0;
 1668|  4.72k|  return 0;
 1669|  4.72k|}
pni_data_set_parent_array_type:
 1672|  4.64k|{
 1673|  4.64k|  pni_node_t *array = pn_data_node(data, data->parent);
 1674|  4.64k|  if (array) {
  ------------------
  |  Branch (1674:7): [True: 4.64k, False: 0]
  ------------------
 1675|  4.64k|    array->array_type = (uint8_t)type;
 1676|  4.64k|  }
 1677|  4.64k|}
pn_data_put_described:
 1680|  3.98k|{
 1681|  3.98k|  pni_node_t *node = pni_data_add(data);
 1682|  3.98k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|     14|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1682:7): [True: 14, False: 3.97k]
  ------------------
 1683|  3.97k|  node->type = PN_DESCRIBED;
 1684|  3.97k|  node->u.as_compound.down = 0;
 1685|  3.97k|  node->u.as_compound.children_count = 0;
 1686|  3.97k|  return 0;
 1687|  3.98k|}
pn_data_put_null:
 1690|   989k|{
 1691|   989k|  pni_node_t *node = pni_data_add(data);
 1692|   989k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      8|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1692:7): [True: 8, False: 989k]
  ------------------
 1693|   989k|  node->type = PN_NULL;
 1694|   989k|  return 0;
 1695|   989k|}
pn_data_put_bool:
 1698|  3.40M|{
 1699|  3.40M|  pni_node_t *node = pni_data_add(data);
 1700|  3.40M|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      4|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1700:7): [True: 4, False: 3.40M]
  ------------------
 1701|  3.40M|  node->type = PN_BOOL;
 1702|  3.40M|  node->u.as_bool = b;
 1703|  3.40M|  return 0;
 1704|  3.40M|}
pn_data_put_ubyte:
 1707|    950|{
 1708|    950|  pni_node_t *node = pni_data_add(data);
 1709|    950|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1709:7): [True: 1, False: 949]
  ------------------
 1710|    949|  node->type = PN_UBYTE;
 1711|    949|  node->u.as_ubyte = ub;
 1712|    949|  return 0;
 1713|    950|}
pn_data_put_byte:
 1716|    431|{
 1717|    431|  pni_node_t *node = pni_data_add(data);
 1718|    431|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      3|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1718:7): [True: 3, False: 428]
  ------------------
 1719|    428|  node->type = PN_BYTE;
 1720|    428|  node->u.as_byte = b;
 1721|    428|  return 0;
 1722|    431|}
pn_data_put_ushort:
 1725|    556|{
 1726|    556|  pni_node_t *node = pni_data_add(data);
 1727|    556|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      3|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1727:7): [True: 3, False: 553]
  ------------------
 1728|    553|  node->type = PN_USHORT;
 1729|    553|  node->u.as_ushort = us;
 1730|    553|  return 0;
 1731|    556|}
pn_data_put_short:
 1734|    533|{
 1735|    533|  pni_node_t *node = pni_data_add(data);
 1736|    533|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1736:7): [True: 1, False: 532]
  ------------------
 1737|    532|  node->type = PN_SHORT;
 1738|    532|  node->u.as_short = s;
 1739|    532|  return 0;
 1740|    533|}
pn_data_put_uint:
 1743|  1.09M|{
 1744|  1.09M|  pni_node_t *node = pni_data_add(data);
 1745|  1.09M|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      3|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1745:7): [True: 3, False: 1.09M]
  ------------------
 1746|  1.09M|  node->type = PN_UINT;
 1747|  1.09M|  node->u.as_uint = ui;
 1748|  1.09M|  return 0;
 1749|  1.09M|}
pn_data_put_int:
 1752|    988|{
 1753|    988|  pni_node_t *node = pni_data_add(data);
 1754|    988|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      4|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1754:7): [True: 4, False: 984]
  ------------------
 1755|    984|  node->type = PN_INT;
 1756|    984|  node->u.as_int = i;
 1757|    984|  return 0;
 1758|    988|}
pn_data_put_char:
 1761|    359|{
 1762|    359|  pni_node_t *node = pni_data_add(data);
 1763|    359|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      3|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1763:7): [True: 3, False: 356]
  ------------------
 1764|    356|  node->type = PN_CHAR;
 1765|    356|  node->u.as_char = c;
 1766|    356|  return 0;
 1767|    359|}
pn_data_put_ulong:
 1770|   272k|{
 1771|   272k|  pni_node_t *node = pni_data_add(data);
 1772|   272k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      4|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1772:7): [True: 4, False: 272k]
  ------------------
 1773|   272k|  node->type = PN_ULONG;
 1774|   272k|  node->u.as_ulong = ul;
 1775|   272k|  return 0;
 1776|   272k|}
pn_data_put_long:
 1779|    799|{
 1780|    799|  pni_node_t *node = pni_data_add(data);
 1781|    799|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1781:7): [True: 1, False: 798]
  ------------------
 1782|    798|  node->type = PN_LONG;
 1783|    798|  node->u.as_long = l;
 1784|    798|  return 0;
 1785|    799|}
pn_data_put_timestamp:
 1788|    273|{
 1789|    273|  pni_node_t *node = pni_data_add(data);
 1790|    273|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1790:7): [True: 1, False: 272]
  ------------------
 1791|    272|  node->type = PN_TIMESTAMP;
 1792|    272|  node->u.as_timestamp = t;
 1793|    272|  return 0;
 1794|    273|}
pn_data_put_float:
 1797|  1.15k|{
 1798|  1.15k|  pni_node_t *node = pni_data_add(data);
 1799|  1.15k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1799:7): [True: 1, False: 1.14k]
  ------------------
 1800|  1.14k|  node->type = PN_FLOAT;
 1801|  1.14k|  node->u.as_float = f;
 1802|  1.14k|  return 0;
 1803|  1.15k|}
pn_data_put_double:
 1806|    124|{
 1807|    124|  pni_node_t *node = pni_data_add(data);
 1808|    124|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1808:7): [True: 1, False: 123]
  ------------------
 1809|    123|  node->type = PN_DOUBLE;
 1810|    123|  node->u.as_double = d;
 1811|    123|  return 0;
 1812|    124|}
pn_data_put_decimal32:
 1815|    303|{
 1816|    303|  pni_node_t *node = pni_data_add(data);
 1817|    303|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1817:7): [True: 1, False: 302]
  ------------------
 1818|    302|  node->type = PN_DECIMAL32;
 1819|    302|  node->u.as_decimal32 = d;
 1820|    302|  return 0;
 1821|    303|}
pn_data_put_decimal64:
 1824|    145|{
 1825|    145|  pni_node_t *node = pni_data_add(data);
 1826|    145|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1826:7): [True: 1, False: 144]
  ------------------
 1827|    144|  node->type = PN_DECIMAL64;
 1828|    144|  node->u.as_decimal64 = d;
 1829|    144|  return 0;
 1830|    145|}
pn_data_put_decimal128:
 1833|    203|{
 1834|    203|  pni_node_t *node = pni_data_add(data);
 1835|    203|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1835:7): [True: 1, False: 202]
  ------------------
 1836|    202|  node->type = PN_DECIMAL128;
 1837|    202|  return pni_data_intern_node(data, node, (pn_bytes_t){16, (const char*)d.bytes});
 1838|    203|}
pn_data_put_uuid:
 1841|    195|{
 1842|    195|  pni_node_t *node = pni_data_add(data);
 1843|    195|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1843:7): [True: 1, False: 194]
  ------------------
 1844|    194|  node->type = PN_UUID;
 1845|    194|  return pni_data_intern_node(data, node, (pn_bytes_t){16, (const char*)u.bytes});
 1846|    195|}
pn_data_put_binary:
 1849|  7.77k|{
 1850|  7.77k|  pni_node_t *node = pni_data_add(data);
 1851|  7.77k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      2|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1851:7): [True: 2, False: 7.76k]
  ------------------
 1852|  7.76k|  node->type = PN_BINARY;
 1853|  7.76k|  return pni_data_intern_node(data, node, bytes);
 1854|  7.77k|}
pn_data_put_string:
 1857|  1.82k|{
 1858|  1.82k|  pni_node_t *node = pni_data_add(data);
 1859|  1.82k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1859:7): [True: 1, False: 1.82k]
  ------------------
 1860|  1.82k|  node->type = PN_STRING;
 1861|  1.82k|  return pni_data_intern_node(data, node, string);
 1862|  1.82k|}
pn_data_put_symbol:
 1865|  4.24k|{
 1866|  4.24k|  pni_node_t *node = pni_data_add(data);
 1867|  4.24k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      1|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1867:7): [True: 1, False: 4.24k]
  ------------------
 1868|  4.24k|  node->type = PN_SYMBOL;
 1869|  4.24k|  return pni_data_intern_node(data, node, symbol);
 1870|  4.24k|}
codec.c:pni_node_fields:
   97|  18.6M|{
   98|  18.6M|  if (!node) return NULL;
  ------------------
  |  Branch (98:7): [True: 182k, False: 18.4M]
  ------------------
   99|  18.4M|  if (node->type != PN_DESCRIBED) return NULL;
  ------------------
  |  Branch (99:7): [True: 18.2M, False: 170k]
  ------------------
  100|       |
  101|   170k|  pni_node_t *descriptor = pn_data_node(data, node->u.as_compound.down);
  102|       |
  103|   170k|  if (!descriptor || descriptor->type != PN_ULONG) {
  ------------------
  |  Branch (103:7): [True: 0, False: 170k]
  |  Branch (103:22): [True: 8.05k, False: 162k]
  ------------------
  104|  8.05k|    return NULL;
  105|  8.05k|  }
  106|       |
  107|   162k|  if (descriptor->u.as_ulong >= FIELD_MIN && descriptor->u.as_ulong <= FIELD_MAX) {
  ------------------
  |  Branch (107:7): [True: 157k, False: 4.97k]
  |  Branch (107:46): [True: 150k, False: 6.85k]
  ------------------
  108|   150k|    const pn_fields_t *f = &FIELDS[descriptor->u.as_ulong-FIELD_MIN];
  109|   150k|    return (f->name_index!=0) ? f : NULL;
  ------------------
  |  Branch (109:12): [True: 145k, False: 5.32k]
  ------------------
  110|   150k|  } else {
  111|       |    return NULL;
  112|  11.8k|  }
  113|   162k|}
codec.c:pni_node_lindex:
  265|  75.6k|{
  266|  75.6k|  int count = 0;
  267|  2.14G|  while (node) {
  ------------------
  |  Branch (267:10): [True: 2.14G, False: 75.6k]
  ------------------
  268|  2.14G|    node = pn_data_node(data, node->prev);
  269|  2.14G|    count++;
  270|  2.14G|  }
  271|  75.6k|  return count - 1;
  272|  75.6k|}
codec.c:pn_data_finalize:
   89|  73.1k|{
   90|  73.1k|  pn_data_t *data = (pn_data_t *) object;
   91|  73.1k|  pni_mem_subdeallocate(pn_class(data), data, data->nodes);
   92|  73.1k|  pn_buffer_free(data->buf);
   93|  73.1k|  pn_error_free(data->error);
   94|  73.1k|}
codec.c:pn_data_inspect:
  390|  73.1k|{
  391|  73.1k|  pn_data_t *data = (pn_data_t *) obj;
  392|       |
  393|  73.1k|  pni_data_traverse(data, pni_inspect_enter, pni_inspect_exit, dst);
  394|  73.1k|}
codec.c:pni_data_error:
  401|  2.77k|{
  402|  2.77k|  if (data->error == NULL) {
  ------------------
  |  Branch (402:7): [True: 2.77k, False: 0]
  ------------------
  403|  2.77k|    data->error = pn_error();
  404|  2.77k|  }
  405|  2.77k|  return data->error;
  406|  2.77k|}
codec.c:pni_data_current:
 1322|  12.4M|{
 1323|  12.4M|  return pn_data_node(data, data->current);
 1324|  12.4M|}
codec.c:pni_data_id:
 1293|  12.4M|{
 1294|  12.4M|  return node - data->nodes + 1;
 1295|  12.4M|}
codec.c:pni_data_add:
 1550|  6.21M|{
 1551|  6.21M|  pni_node_t *current = pni_data_current(data);
 1552|  6.21M|  pni_node_t *parent = pn_data_node(data, data->parent);
 1553|  6.21M|  pni_node_t *node;
 1554|       |
 1555|  6.21M|  if (current) {
  ------------------
  |  Branch (1555:7): [True: 6.20M, False: 12.7k]
  ------------------
 1556|  6.20M|    if (current->next) {
  ------------------
  |  Branch (1556:9): [True: 0, False: 6.20M]
  ------------------
 1557|      0|      node = pn_data_node(data, current->next);
 1558|  6.20M|    } else {
 1559|  6.20M|      node = pni_data_new(data);
 1560|  6.20M|      if (!node) return NULL;
  ------------------
  |  Branch (1560:11): [True: 50, False: 6.19M]
  ------------------
 1561|       |
 1562|       |      // refresh the pointers in case we grew
 1563|  6.19M|      current = pni_data_current(data);
 1564|  6.19M|      parent = pn_data_node(data, data->parent);
 1565|  6.19M|      node->prev = data->current;
 1566|  6.19M|      current->next = pni_data_id(data, node);
 1567|  6.19M|      node->parent = data->parent;
 1568|  6.19M|      if (parent) {
  ------------------
  |  Branch (1568:11): [True: 6.19M, False: 0]
  ------------------
 1569|  6.19M|        if (!pni_node_get_down(parent)) {
  ------------------
  |  Branch (1569:13): [True: 0, False: 6.19M]
  ------------------
 1570|      0|          pni_node_set_down(parent, pni_data_id(data, node));
 1571|      0|        }
 1572|  6.19M|        pni_node_inc_children(parent);
 1573|  6.19M|      }
 1574|  6.19M|    }
 1575|  6.20M|  } else if (parent) {
  ------------------
  |  Branch (1575:14): [True: 9.76k, False: 2.99k]
  ------------------
 1576|  9.76k|    if (pni_node_get_down(parent)) {
  ------------------
  |  Branch (1576:9): [True: 0, False: 9.76k]
  ------------------
 1577|      0|      node = pn_data_node(data, pni_node_get_down(parent));
 1578|  9.76k|    } else {
 1579|  9.76k|      node = pni_data_new(data);
 1580|  9.76k|      if (!node) return NULL;
  ------------------
  |  Branch (1580:11): [True: 15, False: 9.74k]
  ------------------
 1581|       |
 1582|       |      // refresh the pointers in case we grew
 1583|  9.74k|      parent = pn_data_node(data, data->parent);
 1584|  9.74k|      node->prev = 0;
 1585|  9.74k|      node->parent = data->parent;
 1586|  9.74k|      pni_node_set_down(parent, pni_data_id(data, node));
 1587|  9.74k|      pni_node_inc_children(parent);
 1588|  9.74k|    }
 1589|  9.76k|  } else if (data->size) {
  ------------------
  |  Branch (1589:14): [True: 0, False: 2.99k]
  ------------------
 1590|      0|    node = pn_data_node(data, 1);
 1591|  2.99k|  } else {
 1592|  2.99k|    node = pni_data_new(data);
 1593|  2.99k|    if (!node) return NULL;
  ------------------
  |  Branch (1593:9): [True: 0, False: 2.99k]
  ------------------
 1594|       |
 1595|  2.99k|    node->prev = 0;
 1596|  2.99k|    node->parent = 0;
 1597|  2.99k|  }
 1598|       |
 1599|  6.21M|  memset(&node->u, 0, sizeof(node->u));
 1600|  6.21M|  data->current = pni_data_id(data, node);
 1601|  6.21M|  return node;
 1602|  6.21M|}
codec.c:pni_data_new:
 1298|  6.21M|{
 1299|       |  /* Enforce the node limit on logical node count, regardless of pre-allocated capacity. */
 1300|  6.21M|  if (data->size >= pni_data_max_nid(data)) {
  ------------------
  |  Branch (1300:7): [True: 65, False: 6.21M]
  ------------------
 1301|     65|    pn_error_set(pni_data_error(data), PN_OUT_OF_MEMORY, "pn_data node limit exceeded");
  ------------------
  |  |   57|     65|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
 1302|     65|    return NULL;
 1303|     65|  }
 1304|  6.21M|  if ((data->capacity <= data->size) && (pni_data_grow(data) != 0)) {
  ------------------
  |  Branch (1304:7): [True: 9.57k, False: 6.20M]
  |  Branch (1304:41): [True: 0, False: 9.57k]
  ------------------
 1305|      0|    pn_error_set(pni_data_error(data), PN_OUT_OF_MEMORY, "pn_data node limit exceeded");
  ------------------
  |  |   57|      0|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
 1306|      0|    return NULL;
 1307|      0|  }
 1308|  6.21M|  pni_node_t *node = pn_data_node(data, ++(data->size));
 1309|  6.21M|  node->type = PN_NULL;
 1310|  6.21M|  node->next = 0;
 1311|  6.21M|  node->array_type = 0;
 1312|  6.21M|  return node;
 1313|  6.21M|}
codec.c:pni_data_grow:
  488|  9.57k|{
  489|  9.57k|  pni_nid_t effective_max = pni_data_max_nid(data);
  490|       |
  491|       |  /* The limit is on logical nodes in use (size), not pre-allocated capacity.
  492|       |   * pni_data_new() is the only caller and it only calls us when size >= capacity,
  493|       |   * so data->size is the count of nodes that will exist after the next add. */
  494|  9.57k|  if (data->size >= effective_max) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      0|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (494:7): [True: 0, False: 9.57k]
  ------------------
  495|       |
  496|       |  /* Double current capacity, starting from 2 if still at 0, capped at effective_max. */
  497|  9.57k|  pni_nid_t capacity = pn_min(data->capacity ? data->capacity * 2 : 2, effective_max);
  ------------------
  |  |  272|  19.1k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (272:22): [True: 92, False: 9.48k]
  |  |  |  Branch (272:23): [True: 6.58k, False: 2.99k]
  |  |  |  Branch (272:41): [True: 6.49k, False: 2.99k]
  |  |  ------------------
  ------------------
  498|       |
  499|  9.57k|  pni_node_t *new_nodes = (pni_node_t *) pni_mem_subreallocate(pn_class(data), data, data->nodes, capacity * sizeof(pni_node_t));
  500|  9.57k|  if (new_nodes == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      0|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (500:7): [True: 0, False: 9.57k]
  ------------------
  501|  9.57k|  data->capacity = capacity;
  502|  9.57k|  data->nodes = new_nodes;
  503|  9.57k|  return 0;
  504|  9.57k|}
codec.c:pni_data_intern_node:
  518|  14.2k|{
  519|  14.2k|  if (data->buf == NULL) {
  ------------------
  |  Branch (519:7): [True: 452, False: 13.7k]
  ------------------
  520|    452|    size_t size = pn_max(bytes.size+1, PNI_INTERN_MINSIZE);
  ------------------
  |  |  273|    452|#define pn_max(X,Y) ((X) < (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (273:22): [True: 405, False: 47]
  |  |  ------------------
  ------------------
  521|    452|    data->buf = pn_buffer(size);
  522|    452|  }
  523|  14.2k|  ssize_t offset = pni_data_intern(data, bytes.start, bytes.size);
  524|  14.2k|  if (offset < 0) {
  ------------------
  |  Branch (524:7): [True: 6, False: 14.2k]
  ------------------
  525|      6|    pn_error_set(pni_data_error(data), PN_OUT_OF_MEMORY, "pn_data string buffer limit exceeded");
  ------------------
  |  |   57|      6|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  526|      6|    return offset;
  527|      6|  }
  528|  14.2k|  node->u.as_bytes.offset = (uint32_t) offset;
  529|  14.2k|  node->u.as_bytes.size   = (uint32_t) bytes.size;
  530|  14.2k|  return 0;
  531|  14.2k|}
codec.c:pni_data_intern:
  507|  14.2k|{
  508|  14.2k|  size_t offset = pn_buffer_size(data->buf);
  509|  14.2k|  if (data->max_buf_size > 0 && offset + size > data->max_buf_size) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      6|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (509:7): [True: 14.2k, False: 0]
  |  Branch (509:33): [True: 6, False: 14.2k]
  ------------------
  510|  14.2k|  int err = pn_buffer_append(data->buf, start, size);
  511|  14.2k|  if (err) return err;
  ------------------
  |  Branch (511:7): [True: 0, False: 14.2k]
  ------------------
  512|  14.2k|  err = pn_buffer_append(data->buf, "\0", 1);
  513|  14.2k|  if (err) return err;
  ------------------
  |  Branch (513:7): [True: 0, False: 14.2k]
  ------------------
  514|  14.2k|  return offset;
  515|  14.2k|}

pn_connection_driver_init:
   51|  34.6k|int pn_connection_driver_init(pn_connection_driver_t* d, pn_connection_t *c, pn_transport_t *t) {
   52|  34.6k|  memset(d, 0, sizeof(*d));
   53|  34.6k|  d->connection = c ? c : pn_connection();
  ------------------
  |  Branch (53:19): [True: 0, False: 34.6k]
  ------------------
   54|  34.6k|  d->transport = t ? t : pn_transport();
  ------------------
  |  Branch (54:18): [True: 0, False: 34.6k]
  ------------------
   55|  34.6k|  d->collector = pn_collector();
   56|  34.6k|  if (!d->connection || !d->transport || !d->collector) {
  ------------------
  |  Branch (56:7): [True: 0, False: 34.6k]
  |  Branch (56:25): [True: 0, False: 34.6k]
  |  Branch (56:42): [True: 0, False: 34.6k]
  ------------------
   57|      0|    pn_connection_driver_destroy(d);
   58|      0|    return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      0|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
   59|      0|  }
   60|  34.6k|  pn_connection_collect(d->connection, d->collector);
   61|  34.6k|  return 0;
   62|  34.6k|}
pn_connection_driver_release_connection:
   68|  34.6k|pn_connection_t *pn_connection_driver_release_connection(pn_connection_driver_t *d) {
   69|  34.6k|  if (d->transport) {           /* Make sure transport is closed and unbound */
  ------------------
  |  Branch (69:7): [True: 34.6k, False: 0]
  ------------------
   70|  34.6k|    pn_connection_driver_close(d);
   71|  34.6k|    pn_transport_unbind(d->transport);
   72|  34.6k|  }
   73|  34.6k|  pn_connection_t *c = d->connection;
   74|  34.6k|  if (c) {
  ------------------
  |  Branch (74:7): [True: 34.6k, False: 0]
  ------------------
   75|  34.6k|    d->connection = NULL;
   76|  34.6k|    pn_connection_reset(c);
   77|       |    pn_connection_collect(c, NULL); /* Disconnect from the collector */
   78|  34.6k|  }
   79|  34.6k|  return c;
   80|  34.6k|}
pn_connection_driver_destroy:
   82|  34.6k|void pn_connection_driver_destroy(pn_connection_driver_t *d) {
   83|  34.6k|  pn_connection_t *c = pn_connection_driver_release_connection(d);
   84|  34.6k|  if (c) pn_connection_free(c);
  ------------------
  |  Branch (84:7): [True: 34.6k, False: 0]
  ------------------
   85|  34.6k|  if (d->transport) pn_transport_free(d->transport);
  ------------------
  |  Branch (85:7): [True: 34.6k, False: 0]
  ------------------
   86|  34.6k|  if (d->collector) pn_collector_free(d->collector);
  ------------------
  |  Branch (86:7): [True: 34.6k, False: 0]
  ------------------
   87|  34.6k|  memset(d, 0, sizeof(*d));
   88|  34.6k|}
pn_connection_driver_read_buffer:
   95|  49.9k|pn_rwbytes_t pn_connection_driver_read_buffer(pn_connection_driver_t *d) {
   96|  49.9k|  ssize_t cap = pn_transport_capacity(d->transport);
   97|  49.9k|  return (cap > 0) ?  pn_rwbytes(cap, pn_transport_tail(d->transport)) : pn_rwbytes(0, 0);
  ------------------
  |  Branch (97:10): [True: 49.7k, False: 273]
  ------------------
   98|  49.9k|}
pn_connection_driver_read_done:
  100|  49.7k|void pn_connection_driver_read_done(pn_connection_driver_t *d, size_t n) {
  101|  49.7k|  if (n > 0) pn_transport_process(d->transport, n);
  ------------------
  |  Branch (101:7): [True: 49.7k, False: 0]
  ------------------
  102|  49.7k|}
pn_connection_driver_read_closed:
  104|  69.2k|bool pn_connection_driver_read_closed(pn_connection_driver_t *d) {
  105|  69.2k|  return pn_transport_tail_closed(d->transport);
  106|  69.2k|}
pn_connection_driver_read_close:
  108|  69.2k|void pn_connection_driver_read_close(pn_connection_driver_t *d) {
  109|  69.2k|  if (!pn_connection_driver_read_closed(d)) {
  ------------------
  |  Branch (109:7): [True: 23.6k, False: 45.5k]
  ------------------
  110|  23.6k|    pn_transport_close_tail(d->transport);
  111|  23.6k|  }
  112|  69.2k|}
pn_connection_driver_write_buffer:
  114|   119k|pn_bytes_t pn_connection_driver_write_buffer(pn_connection_driver_t *d) {
  115|   119k|  ssize_t pending = pn_transport_pending(d->transport);
  116|   119k|  return (pending > 0) ?
  ------------------
  |  Branch (116:10): [True: 73.2k, False: 45.9k]
  ------------------
  117|  73.2k|    pn_bytes(pending, pn_transport_head(d->transport)) : pn_bytes_null;
  118|   119k|}
pn_connection_driver_write_done:
  120|   119k|pn_bytes_t pn_connection_driver_write_done(pn_connection_driver_t *d, size_t n) {
  121|   119k|  pn_transport_pop(d->transport, n);
  122|   119k|  ssize_t pending = d->transport->output_pending;
  123|   119k|  return (pending > 0) ?
  ------------------
  |  Branch (123:10): [True: 0, False: 119k]
  ------------------
  124|   119k|    pn_bytes(pending, pn_transport_head(d->transport)) : pn_bytes_null;
  125|   119k|}
pn_connection_driver_write_closed:
  127|  69.2k|bool pn_connection_driver_write_closed(pn_connection_driver_t *d) {
  128|  69.2k|  return pn_transport_head_closed(d->transport);
  129|  69.2k|}
pn_connection_driver_write_close:
  131|  69.2k|void pn_connection_driver_write_close(pn_connection_driver_t *d) {
  132|  69.2k|  if (!pn_connection_driver_write_closed(d)) {
  ------------------
  |  Branch (132:7): [True: 34.2k, False: 34.9k]
  ------------------
  133|  34.2k|    pn_transport_close_head(d->transport);
  134|  34.2k|  }
  135|  69.2k|}
pn_connection_driver_close:
  137|  69.2k|void pn_connection_driver_close(pn_connection_driver_t *d) {
  138|  69.2k|  pn_connection_driver_read_close(d);
  139|  69.2k|  pn_connection_driver_write_close(d);
  140|  69.2k|}
pn_connection_driver_next_event:
  142|  6.06M|pn_event_t* pn_connection_driver_next_event(pn_connection_driver_t *d) {
  143|  6.06M|  return batch_next(d);
  144|  6.06M|}
connection_driver.c:batch_next:
   28|  6.06M|static pn_event_t *batch_next(pn_connection_driver_t *d) {
   29|  6.06M|  if (!d->collector) return NULL;
  ------------------
  |  Branch (29:7): [True: 0, False: 6.06M]
  ------------------
   30|  6.06M|  pn_event_t *handled = pn_collector_prev(d->collector);
   31|  6.06M|  if (handled) {
  ------------------
  |  Branch (31:7): [True: 5.97M, False: 84.6k]
  ------------------
   32|  5.97M|    switch (pn_event_type(handled)) {
   33|  34.6k|     case PN_CONNECTION_INIT:   /* Auto-bind after the INIT event is handled */
  ------------------
  |  Branch (33:6): [True: 34.6k, False: 5.94M]
  ------------------
   34|  34.6k|      pn_transport_bind(d->transport, d->connection);
   35|  34.6k|      break;
   36|    312|     case PN_TRANSPORT_CLOSED:  /* No more events after TRANSPORT_CLOSED  */
  ------------------
  |  Branch (36:6): [True: 312, False: 5.97M]
  ------------------
   37|    312|      pn_collector_release(d->collector);
   38|    312|      break;
   39|  5.94M|     default:
  ------------------
  |  Branch (39:6): [True: 5.94M, False: 34.9k]
  ------------------
   40|  5.94M|      break;
   41|  5.97M|    }
   42|  5.97M|  }
   43|       |  /* Log the next event that will be processed */
   44|  6.06M|  pn_event_t *next = pn_collector_next(d->collector);
   45|  6.06M|  if (next && PN_SHOULD_LOG(&d->transport->logger, PN_SUBSYSTEM_EVENT, PN_LEVEL_DEBUG)) {
  ------------------
  |  |   54|  5.97M|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  ------------------
  |  |  |  Branch (54:6): [Folded, False: 5.97M]
  |  |  |  Branch (54:38): [True: 5.97M, False: 0]
  |  |  |  Branch (54:73): [True: 0, False: 5.97M]
  |  |  ------------------
  ------------------
  |  Branch (45:7): [True: 5.97M, False: 84.6k]
  ------------------
   46|      0|    pni_logger_log_msg_inspect(&d->transport->logger, PN_SUBSYSTEM_EVENT, PN_LEVEL_DEBUG, next, "%s", "");
   47|      0|  }
   48|  6.06M|  return next;
   49|  6.06M|}

frame_consumers.c:make_consumer_from_bytes:
   42|  7.98M|static inline pni_consumer_t make_consumer_from_bytes(pn_bytes_t output_bytes) {
   43|  7.98M|  return (pni_consumer_t){
   44|  7.98M|    .output_start = (const uint8_t*) output_bytes.start,
   45|  7.98M|    .size = output_bytes.size,
   46|  7.98M|    .position = 0
   47|  7.98M|  };
   48|  7.98M|}
frame_consumers.c:consume_described:
  572|  13.3M|static inline bool consume_described(pni_consumer_t* consumer, pni_consumer_t *subconsumer) {
  573|  13.3M|  *subconsumer = (pni_consumer_t){.output_start=NULL, .position=0, .size=0};
  574|  13.3M|  uint8_t type;
  575|  13.3M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (575:7): [True: 1.92M, False: 11.3M]
  ------------------
  576|  11.3M|  switch (type) {
  577|  9.67M|    case PNE_DESCRIPTOR: {
  ------------------
  |  |    5|  9.67M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (577:5): [True: 9.67M, False: 1.70M]
  ------------------
  578|  9.67M|      uint8_t dummy;
  579|  9.67M|      bool dq = consume_single_value_not_described(consumer, &dummy);
  580|  9.67M|      size_t sposition = consumer->position;
  581|  9.67M|      bool vq = consume_single_value(consumer, &dummy);
  582|  9.67M|      if (dq && vq) {
  ------------------
  |  Branch (582:11): [True: 9.43M, False: 246k]
  |  Branch (582:17): [True: 9.34M, False: 84.5k]
  ------------------
  583|  9.34M|        size_t scsize = consumer->position > sposition ? consumer->position-sposition : 0;
  ------------------
  |  Branch (583:25): [True: 9.34M, False: 0]
  ------------------
  584|  9.34M|        *subconsumer = (pni_consumer_t){.output_start=consumer->output_start+sposition, .position=0, .size=scsize};
  585|  9.34M|        return true;
  586|  9.34M|      }
  587|   331k|      return false;
  588|  9.67M|    }
  589|  1.70M|    default:
  ------------------
  |  Branch (589:5): [True: 1.70M, False: 9.67M]
  ------------------
  590|  1.70M|      pni_consumer_skip_value_not_described(consumer, type);
  591|       |      return false;
  592|  11.3M|  }
  593|  11.3M|}
frame_consumers.c:pni_consumer_readf8:
   51|   190M|{
   52|   190M|  if (consumer->position+1 > consumer->size) {
  ------------------
  |  Branch (52:7): [True: 67.9M, False: 122M]
  ------------------
   53|  67.9M|    consumer->position = consumer->size;
   54|  67.9M|    return false;
   55|  67.9M|  }
   56|   122M|  uint8_t r = consumer->output_start[consumer->position+0];
   57|   122M|  consumer->position++;
   58|   122M|  *result = r;
   59|       |  return true;
   60|   190M|}
frame_consumers.c:consume_single_value_not_described:
  241|  20.0M|static inline bool consume_single_value_not_described(pni_consumer_t* consumer, uint8_t* type) {
  242|  20.0M|  uint8_t t;
  243|  20.0M|  if (!pni_consumer_readf8(consumer, &t)) return false;
  ------------------
  |  Branch (243:7): [True: 1.72M, False: 18.3M]
  ------------------
  244|  18.3M|  if (!pni_consumer_skip_value_not_described(consumer, t)) return false;
  ------------------
  |  Branch (244:7): [True: 1.77M, False: 16.5M]
  ------------------
  245|  16.5M|  if (t==0) return false;
  ------------------
  |  Branch (245:7): [True: 0, False: 16.5M]
  ------------------
  246|  16.5M|  *type = t;
  247|       |  return true;
  248|  16.5M|}
frame_consumers.c:consume_single_value:
  250|  72.7M|static inline bool consume_single_value(pni_consumer_t* consumer, uint8_t* type) {
  251|  72.7M|  uint8_t t;
  252|  72.7M|  if (!pni_consumer_readf8(consumer, &t)) return false;
  ------------------
  |  Branch (252:7): [True: 36.0M, False: 36.6M]
  ------------------
  253|  36.6M|  *type = t;
  254|  36.6M|  if (t==PNE_DESCRIPTOR) {
  ------------------
  |  |    5|  36.6M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (254:7): [True: 5.19M, False: 31.4M]
  ------------------
  255|  5.19M|    uint8_t dummy;
  256|       |    // Descriptor
  257|  5.19M|    bool dq = consume_single_value_not_described(consumer, &dummy);
  258|       |    // Value
  259|  5.19M|    bool vq = consume_single_value_not_described(consumer, &dummy);
  260|  5.19M|    return dq && vq;
  ------------------
  |  Branch (260:12): [True: 3.95M, False: 1.23M]
  |  Branch (260:18): [True: 3.17M, False: 783k]
  ------------------
  261|  31.4M|  } else {
  262|  31.4M|    return pni_consumer_skip_value_not_described(consumer, t);
  263|  31.4M|  }
  264|  36.6M|}
frame_consumers.c:pni_consumer_skip_value_not_described:
  209|  63.8M|static inline bool pni_consumer_skip_value_not_described(pni_consumer_t* consumer, uint8_t type) {
  210|  63.8M|  pn_bytes_t value;
  211|  63.8M|  return pni_consumer_read_value_not_described(consumer, type, &value);
  212|  63.8M|}
frame_consumers.c:pni_consumer_read_value_not_described:
  141|  63.8M|static inline bool pni_consumer_read_value_not_described(pni_consumer_t* consumer, uint8_t type, pn_bytes_t *value) {
  142|  63.8M|  uint8_t subcategory = type >> 4;
  143|  63.8M|  switch (subcategory) {
  144|       |    // Fixed width types:
  145|       |    // No data
  146|  24.9M|    case 0x4:
  ------------------
  |  Branch (146:5): [True: 24.9M, False: 38.8M]
  ------------------
  147|  24.9M|      *value = (pn_bytes_t){.size=0,.start=NULL};
  148|  24.9M|      return true;
  149|       |      // 1 Octet
  150|  15.6M|    case 0x5:
  ------------------
  |  Branch (150:5): [True: 15.6M, False: 48.1M]
  ------------------
  151|  15.6M|      if (consumer->position+1 > consumer->size) break;
  ------------------
  |  Branch (151:11): [True: 315k, False: 15.3M]
  ------------------
  152|  15.3M|      *value = (pn_bytes_t){.size=1,.start=(const char *)consumer->output_start+consumer->position};
  153|  15.3M|      consumer->position += 1;
  154|  15.3M|      return true;
  155|       |      // 2 Octets
  156|  2.94M|    case 0x6:
  ------------------
  |  Branch (156:5): [True: 2.94M, False: 60.8M]
  ------------------
  157|  2.94M|      if (consumer->position+2 > consumer->size) break;
  ------------------
  |  Branch (157:11): [True: 165k, False: 2.77M]
  ------------------
  158|  2.77M|      *value = (pn_bytes_t){.size=2,.start=(const char *)consumer->output_start+consumer->position};
  159|  2.77M|      consumer->position += 2;
  160|  2.77M|      return true;
  161|       |      // 4 Octets
  162|  1.37M|    case 0x7:
  ------------------
  |  Branch (162:5): [True: 1.37M, False: 62.4M]
  ------------------
  163|  1.37M|      if (consumer->position+4 > consumer->size) break;
  ------------------
  |  Branch (163:11): [True: 157k, False: 1.22M]
  ------------------
  164|  1.22M|      *value = (pn_bytes_t){.size=4,.start=(const char *)consumer->output_start+consumer->position};
  165|  1.22M|      consumer->position += 4;
  166|  1.22M|      return true;
  167|       |      // 8 Octets
  168|   801k|    case 0x8:
  ------------------
  |  Branch (168:5): [True: 801k, False: 63.0M]
  ------------------
  169|   801k|      if (consumer->position+8 > consumer->size) break;
  ------------------
  |  Branch (169:11): [True: 215k, False: 585k]
  ------------------
  170|   585k|      *value = (pn_bytes_t){.size=8,.start=(const char *)consumer->output_start+consumer->position};
  171|   585k|      consumer->position += 8;
  172|   585k|      return true;
  173|       |      // 16 Octets
  174|   419k|    case 0x9:
  ------------------
  |  Branch (174:5): [True: 419k, False: 63.3M]
  ------------------
  175|   419k|      if (consumer->position+16 > consumer->size) break;
  ------------------
  |  Branch (175:11): [True: 159k, False: 260k]
  ------------------
  176|   260k|      *value = (pn_bytes_t){.size=16,.start=(const char *)consumer->output_start+consumer->position};
  177|   260k|      consumer->position += 16;
  178|   260k|      return true;
  179|       |      // Variable width types:
  180|       |      // One Octet of size
  181|  2.58M|    case 0xA:
  ------------------
  |  Branch (181:5): [True: 2.58M, False: 61.2M]
  ------------------
  182|  12.4M|    case 0xC:
  ------------------
  |  Branch (182:5): [True: 9.84M, False: 53.9M]
  ------------------
  183|  14.1M|    case 0xE: {
  ------------------
  |  Branch (183:5): [True: 1.68M, False: 62.1M]
  ------------------
  184|  14.1M|      uint8_t size;
  185|  14.1M|      if (!pni_consumer_readf8(consumer, &size)) return false;
  ------------------
  |  Branch (185:11): [True: 136k, False: 13.9M]
  ------------------
  186|  13.9M|      if (consumer->position+size > consumer->size) break;
  ------------------
  |  Branch (186:11): [True: 464k, False: 13.5M]
  ------------------
  187|  13.5M|      *value = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  188|  13.5M|      consumer->position += size;
  189|  13.5M|      return true;
  190|  13.9M|    }
  191|       |    // 4 Octets of size
  192|   671k|    case 0xB:
  ------------------
  |  Branch (192:5): [True: 671k, False: 63.1M]
  ------------------
  193|  1.27M|    case 0xD:
  ------------------
  |  Branch (193:5): [True: 607k, False: 63.2M]
  ------------------
  194|  1.99M|    case 0xF: {
  ------------------
  |  Branch (194:5): [True: 715k, False: 63.0M]
  ------------------
  195|  1.99M|      uint32_t size;
  196|  1.99M|      if (!pni_consumer_readf32(consumer, &size)) return false;
  ------------------
  |  Branch (196:11): [True: 419k, False: 1.57M]
  ------------------
  197|  1.57M|      if (consumer->position+size > consumer->size) break;
  ------------------
  |  Branch (197:11): [True: 639k, False: 935k]
  ------------------
  198|   935k|      *value = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  199|   935k|      consumer->position += size;
  200|   935k|      return true;
  201|  1.57M|    }
  202|  1.57M|    default:
  ------------------
  |  Branch (202:5): [True: 1.57M, False: 62.2M]
  ------------------
  203|  1.57M|      break;
  204|  63.8M|  }
  205|  3.69M|  consumer->position = consumer->size;
  206|       |  return false;
  207|  63.8M|}
frame_consumers.c:pni_consumer_readf32:
   78|  2.04M|{
   79|  2.04M|  if (consumer->position+4 > consumer->size) {
  ------------------
  |  Branch (79:7): [True: 424k, False: 1.62M]
  ------------------
   80|   424k|    consumer->position = consumer->size;
   81|   424k|    return false;
   82|   424k|  }
   83|  1.62M|  uint32_t a = consumer->output_start[consumer->position+0];
   84|  1.62M|  uint32_t b = consumer->output_start[consumer->position+1];
   85|  1.62M|  uint32_t c = consumer->output_start[consumer->position+2];
   86|  1.62M|  uint32_t d = consumer->output_start[consumer->position+3];
   87|  1.62M|  uint32_t r = a << 24
   88|  1.62M|  | b << 16
   89|  1.62M|  | c <<  8
   90|  1.62M|  | d;
   91|  1.62M|  consumer->position += 4;
   92|  1.62M|  *result = r;
   93|       |  return true;
   94|  2.04M|}
frame_consumers.c:consume_list:
  595|  13.3M|static inline bool consume_list(pni_consumer_t* consumer, pni_consumer_t *subconsumer, uint32_t *count) {
  596|  13.3M|  *subconsumer = (pni_consumer_t){.output_start=NULL, .position=0, .size=0};
  597|  13.3M|  *count = 0;
  598|  13.3M|  uint8_t type;
  599|  13.3M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (599:7): [True: 3.96M, False: 9.36M]
  ------------------
  600|  9.36M|  switch (type) {
  601|  6.41k|    case PNE_LIST32: {
  ------------------
  |  |   40|  6.41k|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (601:5): [True: 6.41k, False: 9.35M]
  ------------------
  602|  6.41k|      uint32_t s;
  603|  6.41k|      if (!pni_consumer_readf32(consumer, &s)) return false;
  ------------------
  |  Branch (603:11): [True: 0, False: 6.41k]
  ------------------
  604|  6.41k|      size_t scsize = s < consumer->size-consumer->position ? s : consumer->size-consumer->position;
  ------------------
  |  Branch (604:23): [True: 0, False: 6.41k]
  ------------------
  605|  6.41k|      *subconsumer = (pni_consumer_t){.output_start=consumer->output_start+consumer->position, .position=0, .size=scsize};
  606|  6.41k|      consumer->position += scsize;
  607|  6.41k|      return pni_consumer_readf32(subconsumer, count);
  608|  6.41k|    }
  609|  7.64M|    case PNE_LIST8: {
  ------------------
  |  |   39|  7.64M|#define PNE_LIST8           (0xc0)
  ------------------
  |  Branch (609:5): [True: 7.64M, False: 1.71M]
  ------------------
  610|  7.64M|      uint8_t s;
  611|  7.64M|      if (!pni_consumer_readf8(consumer, &s)) return false;
  ------------------
  |  Branch (611:11): [True: 0, False: 7.64M]
  ------------------
  612|  7.64M|      size_t scsize = s < consumer->size-consumer->position ? s : consumer->size-consumer->position;
  ------------------
  |  Branch (612:23): [True: 0, False: 7.64M]
  ------------------
  613|  7.64M|      *subconsumer = (pni_consumer_t){.output_start=consumer->output_start+consumer->position, .position=0, .size=scsize};
  614|  7.64M|      consumer->position += scsize;
  615|  7.64M|      uint8_t c;
  616|  7.64M|      if (!pni_consumer_readf8(subconsumer, &c)) return false;
  ------------------
  |  Branch (616:11): [True: 31.6k, False: 7.61M]
  ------------------
  617|  7.61M|      *count = c;
  618|  7.61M|      return true;
  619|  7.64M|    }
  620|  1.29M|    case PNE_LIST0:
  ------------------
  |  |   38|  1.29M|#define PNE_LIST0           (0x45)
  ------------------
  |  Branch (620:5): [True: 1.29M, False: 8.06M]
  ------------------
  621|  1.29M|      return true;
  622|   414k|    default:
  ------------------
  |  Branch (622:5): [True: 414k, False: 8.95M]
  ------------------
  623|   414k|      pni_consumer_skip_value(consumer, type);
  624|       |      return false;
  625|  9.36M|  }
  626|  9.36M|}
frame_consumers.c:pni_consumer_skip_value:
  214|  10.8M|static inline bool pni_consumer_skip_value(pni_consumer_t* consumer, uint8_t type) {
  215|       |  // Check for described type
  216|  10.8M|  if (type==PNE_DESCRIPTOR) {
  ------------------
  |  |    5|  10.8M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (216:7): [True: 1.69M, False: 9.11M]
  ------------------
  217|       |    // Skip descriptor
  218|  1.69M|    if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (218:9): [True: 140k, False: 1.55M]
  ------------------
  219|  1.55M|    if (!pni_consumer_skip_value_not_described(consumer, type)) return false;
  ------------------
  |  Branch (219:9): [True: 264k, False: 1.29M]
  ------------------
  220|  1.29M|    if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (220:9): [True: 16.4k, False: 1.27M]
  ------------------
  221|  1.27M|    return pni_consumer_skip_value_not_described(consumer, type);
  222|  1.29M|  }
  223|  9.11M|  return pni_consumer_skip_value_not_described(consumer, type);
  224|  10.8M|}
frame_consumers.c:consume_string:
  701|  4.97M|static inline bool consume_string(pni_consumer_t *consumer, pn_bytes_t *string) {
  702|  4.97M|  uint8_t type;
  703|  4.97M|  *string = (pn_bytes_t){.size=0, .start=0};
  704|  4.97M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (704:7): [True: 2.38M, False: 2.58M]
  ------------------
  705|  2.58M|  switch (type) {
  706|  2.13k|    case PNE_STR32_UTF8: {
  ------------------
  |  |   35|  2.13k|#define PNE_STR32_UTF8      (0xb1)
  ------------------
  |  Branch (706:5): [True: 2.13k, False: 2.58M]
  ------------------
  707|  2.13k|      return pni_consumer_readv32(consumer, string);
  708|      0|    }
  709|   328k|    case PNE_STR8_UTF8: {
  ------------------
  |  |   34|   328k|#define PNE_STR8_UTF8       (0xa1)
  ------------------
  |  Branch (709:5): [True: 328k, False: 2.25M]
  ------------------
  710|   328k|      return pni_consumer_readv8(consumer, string);
  711|      0|    }
  712|  2.25M|    default:
  ------------------
  |  Branch (712:5): [True: 2.25M, False: 331k]
  ------------------
  713|  2.25M|      pni_consumer_skip_value(consumer, type);
  714|       |      return false;
  715|  2.58M|  }
  716|  2.58M|}
frame_consumers.c:pni_consumer_readv32:
  129|  12.0k|static inline bool pni_consumer_readv32(pni_consumer_t *consumer, pn_bytes_t* bytes){
  130|  12.0k|  uint32_t size;
  131|  12.0k|  if (!pni_consumer_readf32(consumer, &size)) return false;
  ------------------
  |  Branch (131:7): [True: 1.24k, False: 10.7k]
  ------------------
  132|  10.7k|  if (consumer->position+size > consumer->size) {
  ------------------
  |  Branch (132:7): [True: 2.31k, False: 8.44k]
  ------------------
  133|  2.31k|    consumer->position = consumer->size;
  134|  2.31k|    return false;
  135|  2.31k|  }
  136|  8.44k|  *bytes = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  137|  8.44k|  consumer->position += size;
  138|       |  return true;
  139|  10.7k|}
frame_consumers.c:pni_consumer_readv8:
  117|   488k|static inline bool pni_consumer_readv8(pni_consumer_t *consumer, pn_bytes_t* bytes){
  118|   488k|  uint8_t size;
  119|   488k|  if (!pni_consumer_readf8(consumer, &size)) return false;
  ------------------
  |  Branch (119:7): [True: 383, False: 487k]
  ------------------
  120|   487k|  if (consumer->position+size > consumer->size) {
  ------------------
  |  Branch (120:7): [True: 5.78k, False: 481k]
  ------------------
  121|  5.78k|    consumer->position = consumer->size;
  122|  5.78k|    return false;
  123|  5.78k|  }
  124|   481k|  *bytes = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  125|   481k|  consumer->position += size;
  126|       |  return true;
  127|   487k|}
frame_consumers.c:consume_uint:
  310|  14.8M|static inline bool consume_uint(pni_consumer_t* consumer, uint32_t *uint) {
  311|  14.8M|  *uint = 0;
  312|  14.8M|  uint8_t type;
  313|  14.8M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (313:7): [True: 11.0M, False: 3.78M]
  ------------------
  314|  3.78M|  switch (type) {
  315|  76.2k|    case PNE_SMALLUINT: {
  ------------------
  |  |   13|  76.2k|#define PNE_SMALLUINT       (0x52)
  ------------------
  |  Branch (315:5): [True: 76.2k, False: 3.70M]
  ------------------
  316|  76.2k|      uint8_t ui;
  317|  76.2k|      if (!pni_consumer_readf8(consumer, &ui)) return false;
  ------------------
  |  Branch (317:11): [True: 67, False: 76.2k]
  ------------------
  318|  76.2k|      *uint = ui;
  319|  76.2k|      return true;
  320|  76.2k|    }
  321|  24.6k|    case PNE_UINT: {
  ------------------
  |  |   12|  24.6k|#define PNE_UINT            (0x70)
  ------------------
  |  Branch (321:5): [True: 24.6k, False: 3.75M]
  ------------------
  322|  24.6k|      uint32_t ui;
  323|  24.6k|      if (!pni_consumer_readf32(consumer, &ui)) return false;
  ------------------
  |  Branch (323:11): [True: 2.50k, False: 22.1k]
  ------------------
  324|  22.1k|      *uint = ui;
  325|  22.1k|      return true;
  326|  24.6k|    }
  327|   564k|    case PNE_UINT0: {
  ------------------
  |  |   14|   564k|#define PNE_UINT0           (0x43)
  ------------------
  |  Branch (327:5): [True: 564k, False: 3.21M]
  ------------------
  328|   564k|      *uint = 0;
  329|   564k|      return true;
  330|  24.6k|    }
  331|  3.11M|    default:
  ------------------
  |  Branch (331:5): [True: 3.11M, False: 664k]
  ------------------
  332|  3.11M|      pni_consumer_skip_value(consumer, type);
  333|       |      return false;
  334|  3.78M|  }
  335|  3.78M|}
frame_consumers.c:consume_bool:
  371|  5.17M|static inline bool consume_bool(pni_consumer_t* consumer, bool *b) {
  372|  5.17M|  *b = false;
  373|  5.17M|  uint8_t type;
  374|  5.17M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (374:7): [True: 3.05M, False: 2.11M]
  ------------------
  375|  2.11M|  switch (type) {
  376|  6.42k|    case PNE_BOOLEAN: {
  ------------------
  |  |    7|  6.42k|#define PNE_BOOLEAN         (0x56)
  ------------------
  |  Branch (376:5): [True: 6.42k, False: 2.11M]
  ------------------
  377|  6.42k|      uint8_t ub;
  378|  6.42k|      if (!pni_consumer_readf8(consumer, &ub)) return false;
  ------------------
  |  Branch (378:11): [True: 412, False: 6.01k]
  ------------------
  379|  6.01k|      *b = ub;
  380|  6.01k|      return true;
  381|  6.42k|    }
  382|   116k|    case PNE_FALSE:
  ------------------
  |  |    9|   116k|#define PNE_FALSE           (0x42)
  ------------------
  |  Branch (382:5): [True: 116k, False: 2.00M]
  ------------------
  383|   116k|      *b = false;
  384|   116k|      return true;
  385|   512k|    case PNE_TRUE:
  ------------------
  |  |    8|   512k|#define PNE_TRUE            (0x41)
  ------------------
  |  Branch (385:5): [True: 512k, False: 1.60M]
  ------------------
  386|   512k|      *b = true;
  387|   512k|      return true;
  388|  1.48M|    default:
  ------------------
  |  Branch (388:5): [True: 1.48M, False: 635k]
  ------------------
  389|  1.48M|      pni_consumer_skip_value(consumer, type);
  390|       |      return false;
  391|  2.11M|  }
  392|  2.11M|}
frame_consumers.c:consume_ubyte:
  354|  2.76M|static inline bool consume_ubyte(pni_consumer_t* consumer, uint8_t *ubyte) {
  355|  2.76M|  *ubyte = 0;
  356|  2.76M|  uint8_t type;
  357|  2.76M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (357:7): [True: 660k, False: 2.10M]
  ------------------
  358|  2.10M|  switch (type) {
  359|  37.7k|    case PNE_UBYTE: {
  ------------------
  |  |   10|  37.7k|#define PNE_UBYTE           (0x50)
  ------------------
  |  Branch (359:5): [True: 37.7k, False: 2.06M]
  ------------------
  360|  37.7k|      uint8_t ub;
  361|  37.7k|      if (!pni_consumer_readf8(consumer, &ub)) return false;
  ------------------
  |  Branch (361:11): [True: 2.81k, False: 34.9k]
  ------------------
  362|  34.9k|      *ubyte = ub;
  363|  34.9k|      return true;
  364|  37.7k|    }
  365|  2.06M|    default:
  ------------------
  |  Branch (365:5): [True: 2.06M, False: 37.7k]
  ------------------
  366|  2.06M|      pni_consumer_skip_value(consumer, type);
  367|       |      return false;
  368|  2.10M|  }
  369|  2.10M|}
frame_consumers.c:consume_symbol:
  718|  4.40M|static inline bool consume_symbol(pni_consumer_t *consumer, pn_bytes_t *symbol) {
  719|  4.40M|  uint8_t type;
  720|  4.40M|  *symbol = (pn_bytes_t){.size=0, .start=0};
  721|  4.40M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (721:7): [True: 3.67M, False: 731k]
  ------------------
  722|   731k|  switch (type) {
  723|  8.14k|    case PNE_SYM32:{
  ------------------
  |  |   37|  8.14k|#define PNE_SYM32           (0xb3)
  ------------------
  |  Branch (723:5): [True: 8.14k, False: 722k]
  ------------------
  724|  8.14k|      return pni_consumer_readv32(consumer, symbol);
  725|      0|    }
  726|  8.73k|    case PNE_SYM8:{
  ------------------
  |  |   36|  8.73k|#define PNE_SYM8            (0xa3)
  ------------------
  |  Branch (726:5): [True: 8.73k, False: 722k]
  ------------------
  727|  8.73k|      return pni_consumer_readv8(consumer, symbol);
  728|      0|    }
  729|   714k|    default:
  ------------------
  |  Branch (729:5): [True: 714k, False: 16.8k]
  ------------------
  730|   714k|      pni_consumer_skip_value(consumer, type);
  731|       |      return false;
  732|   731k|  }
  733|   731k|}
frame_consumers.c:consume_anything:
  278|  48.6M|static inline bool consume_anything(pni_consumer_t* consumer) {
  279|  48.6M|  uint8_t dummy;
  280|  48.6M|  return consume_single_value(consumer, &dummy);
  281|  48.6M|}
frame_consumers.c:consume_end_list:
  629|  13.3M|static inline bool consume_end_list(pni_consumer_t *consumer) {
  630|       |  return true;
  631|  13.3M|}
frame_consumers.c:consume_ulong:
  283|  2.12M|static inline bool consume_ulong(pni_consumer_t* consumer, uint64_t *ulong) {
  284|  2.12M|  *ulong = 0;
  285|  2.12M|  uint8_t type;
  286|  2.12M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (286:7): [True: 1.31M, False: 810k]
  ------------------
  287|   810k|  switch (type) {
  288|   411k|    case PNE_SMALLULONG: {
  ------------------
  |  |   16|   411k|#define PNE_SMALLULONG      (0x53)
  ------------------
  |  Branch (288:5): [True: 411k, False: 399k]
  ------------------
  289|   411k|      uint8_t ul;
  290|   411k|      if (!pni_consumer_readf8(consumer, &ul)) return false;
  ------------------
  |  Branch (290:11): [True: 826, False: 410k]
  ------------------
  291|   410k|      *ulong = ul;
  292|   410k|      return true;
  293|   411k|    }
  294|  1.24k|    case PNE_ULONG: {
  ------------------
  |  |   15|  1.24k|#define PNE_ULONG           (0x80)
  ------------------
  |  Branch (294:5): [True: 1.24k, False: 808k]
  ------------------
  295|  1.24k|      uint64_t ul;
  296|  1.24k|      if (!pni_consumer_readf64(consumer, &ul)) return false;
  ------------------
  |  Branch (296:11): [True: 350, False: 897]
  ------------------
  297|    897|      *ulong = ul;
  298|    897|      return true;
  299|  1.24k|    }
  300|  16.2k|    case PNE_ULONG0: {
  ------------------
  |  |   17|  16.2k|#define PNE_ULONG0          (0x44)
  ------------------
  |  Branch (300:5): [True: 16.2k, False: 793k]
  ------------------
  301|  16.2k|      *ulong = 0;
  302|  16.2k|      return true;
  303|  1.24k|    }
  304|   381k|    default:
  ------------------
  |  Branch (304:5): [True: 381k, False: 428k]
  ------------------
  305|   381k|      pni_consumer_skip_value(consumer, type);
  306|       |      return false;
  307|   810k|  }
  308|   810k|}
frame_consumers.c:pni_consumer_readf64:
   97|  1.77k|{
   98|  1.77k|  uint32_t a;
   99|  1.77k|  if (!pni_consumer_readf32(consumer, &a)) return false;
  ------------------
  |  Branch (99:7): [True: 405, False: 1.36k]
  ------------------
  100|  1.36k|  uint32_t b;
  101|  1.36k|  if (!pni_consumer_readf32(consumer, &b)) return false;
  ------------------
  |  Branch (101:7): [True: 294, False: 1.07k]
  ------------------
  102|  1.07k|  *result = (uint64_t)a << 32 | (uint64_t)b;
  103|       |  return true;
  104|  1.36k|}
frame_consumers.c:consume_raw:
  266|  10.8M|static inline bool consume_raw(pni_consumer_t* consumer, pn_bytes_t* raw) {
  267|  10.8M|  size_t start = consumer->position;
  268|  10.8M|  uint8_t type;
  269|  10.8M|  bool succeed = consume_single_value(consumer, &type);
  270|  10.8M|  if (succeed && type!=PNE_NULL) {
  ------------------
  |  |    6|   803k|#define PNE_NULL            (0x40)
  ------------------
  |  Branch (270:7): [True: 803k, False: 10.0M]
  |  Branch (270:18): [True: 738k, False: 65.2k]
  ------------------
  271|   738k|    *raw = (pn_bytes_t){.size=consumer->position-start, .start=(const char*)consumer->output_start+start};
  272|  10.1M|  } else {
  273|       |    *raw = (pn_bytes_t) {0, NULL};
  274|  10.1M|  }
  275|  10.8M|  return succeed;
  276|  10.8M|}
frame_consumers.c:consume_described_anything:
  666|  2.75M|static inline bool consume_described_anything(pni_consumer_t* consumer) {
  667|  2.75M|  uint8_t type;
  668|  2.75M|  bool tq = consume_single_value(consumer, &type);
  669|  2.75M|  return tq && type==PNE_DESCRIPTOR;
  ------------------
  |  |    5|  4.62M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (669:10): [True: 1.87M, False: 885k]
  |  Branch (669:16): [True: 873k, False: 997k]
  ------------------
  670|  2.75M|}
frame_consumers.c:consume_described_type_anything:
  672|  1.37M|static inline bool consume_described_type_anything(pni_consumer_t* consumer, uint64_t *type) {
  673|  1.37M|  pni_consumer_t subconsumer;
  674|  1.37M|  return consume_described_ulong_descriptor(consumer, &subconsumer, type);
  675|  1.37M|}
frame_consumers.c:consume_described_ulong_descriptor:
  548|  1.71M|static inline bool consume_described_ulong_descriptor(pni_consumer_t* consumer, pni_consumer_t *subconsumer, uint64_t *descriptor) {
  549|  1.71M|  *descriptor = 0;
  550|  1.71M|  *subconsumer = (pni_consumer_t){.output_start=NULL, .position=0, .size=0};
  551|  1.71M|  uint8_t type;
  552|  1.71M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (552:7): [True: 626k, False: 1.08M]
  ------------------
  553|  1.08M|  switch (type) {
  554|   741k|    case PNE_DESCRIPTOR: {
  ------------------
  |  |    5|   741k|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (554:5): [True: 741k, False: 343k]
  ------------------
  555|   741k|      bool dq = consume_ulong(consumer, descriptor);
  556|   741k|      size_t sposition = consumer->position;
  557|   741k|      uint8_t dummy;
  558|   741k|      bool vq = consume_single_value(consumer, &dummy);
  559|   741k|      if (dq && vq) {
  ------------------
  |  Branch (559:11): [True: 404k, False: 337k]
  |  Branch (559:17): [True: 336k, False: 68.1k]
  ------------------
  560|   336k|        size_t scsize = consumer->position > sposition ? consumer->position-sposition : 0;
  ------------------
  |  Branch (560:25): [True: 336k, False: 0]
  ------------------
  561|   336k|        *subconsumer = (pni_consumer_t){.output_start=consumer->output_start+sposition, .position=0, .size=scsize};
  562|   336k|        return true;
  563|   336k|      }
  564|   405k|      return false;
  565|   741k|    }
  566|   343k|    default:
  ------------------
  |  Branch (566:5): [True: 343k, False: 741k]
  ------------------
  567|   343k|      pni_consumer_skip_value_not_described(consumer, type);
  568|       |      return false;
  569|  1.08M|  }
  570|  1.08M|}
frame_consumers.c:consume_ushort:
  337|  1.55M|static inline bool consume_ushort(pni_consumer_t* consumer, uint16_t *ushort) {
  338|  1.55M|  *ushort = 0;
  339|  1.55M|  uint8_t type;
  340|  1.55M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (340:7): [True: 1.16M, False: 388k]
  ------------------
  341|   388k|  switch (type) {
  342|  19.1k|    case PNE_USHORT: {
  ------------------
  |  |   11|  19.1k|#define PNE_USHORT          (0x60)
  ------------------
  |  Branch (342:5): [True: 19.1k, False: 369k]
  ------------------
  343|  19.1k|      uint16_t us;
  344|  19.1k|      if (!pni_consumer_readf16(consumer, &us)) return false;
  ------------------
  |  Branch (344:11): [True: 106, False: 19.0k]
  ------------------
  345|  19.0k|      *ushort = us;
  346|  19.0k|      return true;
  347|  19.1k|    }
  348|   369k|    default:
  ------------------
  |  Branch (348:5): [True: 369k, False: 19.1k]
  ------------------
  349|   369k|      pni_consumer_skip_value(consumer, type);
  350|       |      return false;
  351|   388k|  }
  352|   388k|}
frame_consumers.c:pni_consumer_readf16:
   63|  19.3k|{
   64|  19.3k|  if (consumer->position+2 > consumer->size) {
  ------------------
  |  Branch (64:7): [True: 202, False: 19.1k]
  ------------------
   65|    202|    consumer->position = consumer->size;
   66|    202|    return false;
   67|    202|  }
   68|  19.1k|  uint16_t a = consumer->output_start[consumer->position+0];
   69|  19.1k|  uint16_t b = consumer->output_start[consumer->position+1];
   70|  19.1k|  uint16_t r = a << 8
   71|  19.1k|  | b;
   72|  19.1k|  consumer->position += 2;
   73|  19.1k|  *result = r;
   74|       |  return true;
   75|  19.3k|}
frame_consumers.c:consume_described_raw:
  696|  5.59k|static inline bool consume_described_raw(pni_consumer_t *consumer, pn_bytes_t *raw) {
  697|  5.59k|  pni_consumer_t subconsumer;
  698|  5.59k|  return consume_described(consumer, &subconsumer) && consume_raw(&subconsumer, raw);
  ------------------
  |  Branch (698:10): [True: 5.59k, False: 0]
  |  Branch (698:55): [True: 5.59k, False: 0]
  ------------------
  699|  5.59k|}
frame_consumers.c:consume_described_maybe_type_anything:
  677|   148k|static inline bool consume_described_maybe_type_anything(pni_consumer_t* consumer, bool *qtype, uint64_t *type) {
  678|   148k|  pni_consumer_t subconsumer;
  679|   148k|  *qtype = consume_described_ulong_descriptor(consumer, &subconsumer, type);
  680|   148k|  return *qtype;
  681|   148k|}
frame_consumers.c:consume_described_maybe_type_raw:
  683|   187k|static inline bool consume_described_maybe_type_raw(pni_consumer_t *consumer, bool *qtype, uint64_t *type, pn_bytes_t *raw) {
  684|   187k|  pni_consumer_t subconsumer;
  685|   187k|  *qtype = consume_described_ulong_descriptor(consumer, &subconsumer, type);
  686|   187k|  return *qtype && consume_raw(&subconsumer, raw);
  ------------------
  |  Branch (686:10): [True: 15.3k, False: 172k]
  |  Branch (686:20): [True: 15.3k, False: 0]
  ------------------
  687|   187k|}
frame_consumers.c:consume_binaryornull:
  735|  12.0k|static inline bool consume_binaryornull(pni_consumer_t *consumer, pn_bytes_t *binary) {
  736|  12.0k|  uint8_t type;
  737|  12.0k|  *binary  = (pn_bytes_t){.size=0, .start=0};
  738|  12.0k|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (738:7): [True: 3.37k, False: 8.65k]
  ------------------
  739|  8.65k|  switch (type) {
  740|    339|    case PNE_NULL:{
  ------------------
  |  |    6|    339|#define PNE_NULL            (0x40)
  ------------------
  |  Branch (740:5): [True: 339, False: 8.31k]
  ------------------
  741|    339|      return true;
  742|      0|    }
  743|    199|    case PNE_VBIN32:{
  ------------------
  |  |   33|    199|#define PNE_VBIN32          (0xb0)
  ------------------
  |  Branch (743:5): [True: 199, False: 8.45k]
  ------------------
  744|    199|      return pni_consumer_readv32(consumer, binary);
  745|      0|    }
  746|  1.07k|    case PNE_VBIN8:{
  ------------------
  |  |   32|  1.07k|#define PNE_VBIN8           (0xa0)
  ------------------
  |  Branch (746:5): [True: 1.07k, False: 7.58k]
  ------------------
  747|  1.07k|      return pni_consumer_readv8(consumer, binary);
  748|      0|    }
  749|  7.04k|    default:
  ------------------
  |  Branch (749:5): [True: 7.04k, False: 1.60k]
  ------------------
  750|  7.04k|      pni_consumer_skip_value(consumer, type);
  751|       |      return false;
  752|  8.65k|  }
  753|  8.65k|}
frame_consumers.c:consume_atom:
  407|  15.2k|static inline bool consume_atom(pni_consumer_t* consumer, pn_atom_t *atom) {
  408|  15.2k|  uint8_t type;
  409|  15.2k|  if (pni_consumer_readf8(consumer, &type)) {
  ------------------
  |  Branch (409:7): [True: 9.86k, False: 5.37k]
  ------------------
  410|  9.86k|    switch (type) {
  411|    180|    case PNE_SMALLULONG: {
  ------------------
  |  |   16|    180|#define PNE_SMALLULONG      (0x53)
  ------------------
  |  Branch (411:5): [True: 180, False: 9.68k]
  ------------------
  412|    180|      uint8_t ul;
  413|    180|      if (!pni_consumer_readf8(consumer, &ul)) break;
  ------------------
  |  Branch (413:11): [True: 38, False: 142]
  ------------------
  414|    142|      atom->type = PN_ULONG;
  415|    142|      atom->u.as_ulong = ul;
  416|    142|      return true;
  417|    180|    }
  418|    195|    case PNE_ULONG: {
  ------------------
  |  |   15|    195|#define PNE_ULONG           (0x80)
  ------------------
  |  Branch (418:5): [True: 195, False: 9.66k]
  ------------------
  419|    195|      uint64_t ul;
  420|    195|      if (!pni_consumer_readf64(consumer, &ul)) break;
  ------------------
  |  Branch (420:11): [True: 128, False: 67]
  ------------------
  421|     67|      atom->type = PN_ULONG;
  422|     67|      atom->u.as_ulong = ul;
  423|     67|      return true;
  424|    195|    }
  425|    157|    case PNE_ULONG0: {
  ------------------
  |  |   17|    157|#define PNE_ULONG0          (0x44)
  ------------------
  |  Branch (425:5): [True: 157, False: 9.70k]
  ------------------
  426|    157|      atom->type = PN_ULONG;
  427|    157|      atom->u.as_ulong = 0;
  428|    157|      return true;
  429|    195|    }
  430|    163|    case PNE_SMALLUINT: {
  ------------------
  |  |   13|    163|#define PNE_SMALLUINT       (0x52)
  ------------------
  |  Branch (430:5): [True: 163, False: 9.70k]
  ------------------
  431|    163|      uint8_t ui;
  432|    163|      if (!pni_consumer_readf8(consumer, &ui)) break;
  ------------------
  |  Branch (432:11): [True: 38, False: 125]
  ------------------
  433|    125|      atom->type = PN_UINT;
  434|    125|      atom->u.as_uint = ui;
  435|    125|      return true;
  436|    163|    }
  437|    125|    case PNE_UINT: {
  ------------------
  |  |   12|    125|#define PNE_UINT            (0x70)
  ------------------
  |  Branch (437:5): [True: 125, False: 9.73k]
  ------------------
  438|    125|      uint32_t ui;
  439|    125|      if (!pni_consumer_readf32(consumer, &ui)) break;
  ------------------
  |  Branch (439:11): [True: 57, False: 68]
  ------------------
  440|     68|      atom->type = PN_UINT;
  441|     68|      atom->u.as_uint = ui;
  442|     68|      return true;
  443|    125|    }
  444|  3.43k|    case PNE_UINT0: {
  ------------------
  |  |   14|  3.43k|#define PNE_UINT0           (0x43)
  ------------------
  |  Branch (444:5): [True: 3.43k, False: 6.42k]
  ------------------
  445|  3.43k|      atom->type = PN_UINT;
  446|  3.43k|      atom->u.as_uint = 0;
  447|  3.43k|      return true;
  448|    125|    }
  449|    178|    case PNE_USHORT: {
  ------------------
  |  |   11|    178|#define PNE_USHORT          (0x60)
  ------------------
  |  Branch (449:5): [True: 178, False: 9.68k]
  ------------------
  450|    178|      uint16_t us;
  451|    178|      if (!pni_consumer_readf16(consumer, &us)) break;
  ------------------
  |  Branch (451:11): [True: 96, False: 82]
  ------------------
  452|     82|      atom->type = PN_USHORT;
  453|     82|      atom->u.as_ushort = us;
  454|     82|      return true;
  455|    178|    }
  456|    150|    case PNE_UBYTE: {
  ------------------
  |  |   10|    150|#define PNE_UBYTE           (0x50)
  ------------------
  |  Branch (456:5): [True: 150, False: 9.71k]
  ------------------
  457|    150|      uint8_t ub;
  458|    150|      if (!pni_consumer_readf8(consumer, &ub)) break;
  ------------------
  |  Branch (458:11): [True: 44, False: 106]
  ------------------
  459|    106|      atom->type = PN_UBYTE;
  460|    106|      atom->u.as_ubyte = ub;
  461|    106|      return true;
  462|    150|    }
  463|    543|    case PNE_BOOLEAN: {
  ------------------
  |  |    7|    543|#define PNE_BOOLEAN         (0x56)
  ------------------
  |  Branch (463:5): [True: 543, False: 9.32k]
  ------------------
  464|    543|      uint8_t ub;
  465|    543|      if (!pni_consumer_readf8(consumer, &ub)) break;
  ------------------
  |  Branch (465:11): [True: 115, False: 428]
  ------------------
  466|    428|      atom->type = PN_BOOL;
  467|    428|      atom->u.as_bool = ub;
  468|    428|      return true;
  469|    543|    }
  470|    190|    case PNE_FALSE:
  ------------------
  |  |    9|    190|#define PNE_FALSE           (0x42)
  ------------------
  |  Branch (470:5): [True: 190, False: 9.67k]
  ------------------
  471|    190|      atom->type = PN_BOOL;
  472|    190|      atom->u.as_bool = false;
  473|    190|      return true;
  474|    241|    case PNE_TRUE:
  ------------------
  |  |    8|    241|#define PNE_TRUE            (0x41)
  ------------------
  |  Branch (474:5): [True: 241, False: 9.62k]
  ------------------
  475|    241|      atom->type = PN_BOOL;
  476|    241|      atom->u.as_bool = true;
  477|    241|      return true;
  478|    151|    case PNE_MS64: {
  ------------------
  |  |   30|    151|#define PNE_MS64            (0x83)
  ------------------
  |  Branch (478:5): [True: 151, False: 9.71k]
  ------------------
  479|    151|      uint64_t timestamp;
  480|    151|      if (!pni_consumer_readf64(consumer, &timestamp)) break;
  ------------------
  |  Branch (480:11): [True: 115, False: 36]
  ------------------
  481|     36|      atom->type = PN_TIMESTAMP;
  482|     36|      atom->u.as_timestamp = timestamp;
  483|     36|      return true;
  484|    151|    }
  485|  1.06k|    case PNE_VBIN32:{
  ------------------
  |  |   33|  1.06k|#define PNE_VBIN32          (0xb0)
  ------------------
  |  Branch (485:5): [True: 1.06k, False: 8.80k]
  ------------------
  486|  1.06k|      pn_bytes_t binary;
  487|  1.06k|      if (!pni_consumer_readv32(consumer, &binary)) break;
  ------------------
  |  Branch (487:11): [True: 1.03k, False: 30]
  ------------------
  488|     30|      atom->type = PN_BINARY;
  489|     30|      atom->u.as_bytes = binary;
  490|     30|      return true;
  491|  1.06k|    }
  492|    535|    case PNE_VBIN8:{
  ------------------
  |  |   32|    535|#define PNE_VBIN8           (0xa0)
  ------------------
  |  Branch (492:5): [True: 535, False: 9.32k]
  ------------------
  493|    535|      pn_bytes_t binary;
  494|    535|      if (!pni_consumer_readv8(consumer, &binary)) break;
  ------------------
  |  Branch (494:11): [True: 127, False: 408]
  ------------------
  495|    408|      atom->type = PN_BINARY;
  496|    408|      atom->u.as_bytes = binary;
  497|    408|      return true;
  498|    535|    }
  499|    228|    case PNE_STR32_UTF8: {
  ------------------
  |  |   35|    228|#define PNE_STR32_UTF8      (0xb1)
  ------------------
  |  Branch (499:5): [True: 228, False: 9.63k]
  ------------------
  500|    228|      pn_bytes_t string;
  501|    228|      if (!pni_consumer_readv32(consumer, &string)) break;
  ------------------
  |  Branch (501:11): [True: 156, False: 72]
  ------------------
  502|     72|      atom->type = PN_STRING;
  503|     72|      atom->u.as_bytes = string;
  504|     72|      return true;
  505|    228|    }
  506|    276|    case PNE_STR8_UTF8: {
  ------------------
  |  |   34|    276|#define PNE_STR8_UTF8       (0xa1)
  ------------------
  |  Branch (506:5): [True: 276, False: 9.58k]
  ------------------
  507|    276|      pn_bytes_t string;
  508|    276|      if (!pni_consumer_readv8(consumer, &string)) break;
  ------------------
  |  Branch (508:11): [True: 166, False: 110]
  ------------------
  509|    110|      atom->type = PN_STRING;
  510|    110|      atom->u.as_bytes = string;
  511|    110|      return true;
  512|    276|    }
  513|    175|    case PNE_SYM32:{
  ------------------
  |  |   37|    175|#define PNE_SYM32           (0xb3)
  ------------------
  |  Branch (513:5): [True: 175, False: 9.68k]
  ------------------
  514|    175|      pn_bytes_t symbol;
  515|    175|      if (!pni_consumer_readv32(consumer, &symbol)) break;
  ------------------
  |  Branch (515:11): [True: 147, False: 28]
  ------------------
  516|     28|      atom->type = PN_SYMBOL;
  517|     28|      atom->u.as_bytes = symbol;
  518|     28|      return true;
  519|    175|    }
  520|    267|    case PNE_SYM8:{
  ------------------
  |  |   36|    267|#define PNE_SYM8            (0xa3)
  ------------------
  |  Branch (520:5): [True: 267, False: 9.59k]
  ------------------
  521|    267|      pn_bytes_t symbol;
  522|    267|      if (!pni_consumer_readv8(consumer, &symbol)) break;
  ------------------
  |  Branch (522:11): [True: 127, False: 140]
  ------------------
  523|    140|      atom->type = PN_SYMBOL;
  524|    140|      atom->u.as_bytes = symbol;
  525|    140|      return true;
  526|    267|    }
  527|    218|    case PNE_UUID: {
  ------------------
  |  |   31|    218|#define PNE_UUID            (0x98)
  ------------------
  |  Branch (527:5): [True: 218, False: 9.64k]
  ------------------
  528|    218|      pn_uuid_t uuid;
  529|    218|      if (!pni_consumer_readf128(consumer, &uuid)) break;
  ------------------
  |  Branch (529:11): [True: 48, False: 170]
  ------------------
  530|    170|      atom->type = PN_UUID;
  531|    170|      atom->u.as_uuid = uuid;
  532|    170|      return true;
  533|    218|    }
  534|    306|    case PNE_NULL:
  ------------------
  |  |    6|    306|#define PNE_NULL            (0x40)
  ------------------
  |  Branch (534:5): [True: 306, False: 9.55k]
  ------------------
  535|    306|      atom->type = PN_NULL;
  536|    306|      return true;
  537|  1.08k|    default:
  ------------------
  |  Branch (537:5): [True: 1.08k, False: 8.77k]
  ------------------
  538|  1.08k|      pni_consumer_skip_value(consumer, type);
  539|  1.08k|      break;
  540|  9.86k|    }
  541|  9.86k|  }
  542|  8.89k|  atom->type = PN_NULL;
  543|       |  return false;
  544|  15.2k|}
frame_consumers.c:pni_consumer_readf128:
  107|    218|{
  108|    218|  if (consumer->position+16 > consumer->size) {
  ------------------
  |  Branch (108:7): [True: 48, False: 170]
  ------------------
  109|     48|    consumer->position = consumer->size;
  110|     48|    return false;
  111|     48|  }
  112|    170|  memcpy(dst, &consumer->output_start[consumer->position], 16);
  113|    170|  consumer->position += 16;
  114|       |  return true;
  115|    218|}
frame_consumers.c:consume_timestamp:
  394|  15.2k|static inline bool consume_timestamp(pni_consumer_t* consumer, pn_timestamp_t *timestamp) {
  395|  15.2k|  *timestamp = 0;
  396|  15.2k|  uint8_t type;
  397|  15.2k|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (397:7): [True: 13.1k, False: 2.07k]
  ------------------
  398|  2.07k|  switch (type) {
  399|    181|    case PNE_MS64: {
  ------------------
  |  |   30|    181|#define PNE_MS64            (0x83)
  ------------------
  |  Branch (399:5): [True: 181, False: 1.89k]
  ------------------
  400|    181|      return pni_consumer_readf64(consumer, (uint64_t*)timestamp);
  401|      0|    }
  402|  1.89k|    default:
  ------------------
  |  Branch (402:5): [True: 1.89k, False: 181]
  ------------------
  403|       |      return false;
  404|  2.07k|  }
  405|  2.07k|}
frame_consumers.c:consume_binarynonull:
  755|   153k|static inline bool consume_binarynonull(pni_consumer_t *consumer, pn_bytes_t *binary) {
  756|   153k|  uint8_t type;
  757|   153k|  *binary  = (pn_bytes_t){.size=0, .start=0};
  758|   153k|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (758:7): [True: 139, False: 152k]
  ------------------
  759|   152k|  switch (type) {
  760|     60|    case PNE_VBIN32:{
  ------------------
  |  |   33|     60|#define PNE_VBIN32          (0xb0)
  ------------------
  |  Branch (760:5): [True: 60, False: 152k]
  ------------------
  761|     60|      return pni_consumer_readv32(consumer, binary);
  762|      0|    }
  763|   148k|    case PNE_VBIN8:{
  ------------------
  |  |   32|   148k|#define PNE_VBIN8           (0xa0)
  ------------------
  |  Branch (763:5): [True: 148k, False: 4.62k]
  ------------------
  764|   148k|      return pni_consumer_readv8(consumer, binary);
  765|      0|    }
  766|  4.56k|    default:
  ------------------
  |  Branch (766:5): [True: 4.56k, False: 148k]
  ------------------
  767|  4.56k|      pni_consumer_skip_value(consumer, type);
  768|       |      return false;
  769|   152k|  }
  770|   152k|}
dispatcher.c:make_consumer_from_bytes:
   42|  3.39M|static inline pni_consumer_t make_consumer_from_bytes(pn_bytes_t output_bytes) {
   43|  3.39M|  return (pni_consumer_t){
   44|  3.39M|    .output_start = (const uint8_t*) output_bytes.start,
   45|  3.39M|    .size = output_bytes.size,
   46|  3.39M|    .position = 0
   47|  3.39M|  };
   48|  3.39M|}
dispatcher.c:consume_described_ulong_descriptor:
  548|  3.39M|static inline bool consume_described_ulong_descriptor(pni_consumer_t* consumer, pni_consumer_t *subconsumer, uint64_t *descriptor) {
  549|  3.39M|  *descriptor = 0;
  550|  3.39M|  *subconsumer = (pni_consumer_t){.output_start=NULL, .position=0, .size=0};
  551|  3.39M|  uint8_t type;
  552|  3.39M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (552:7): [True: 0, False: 3.39M]
  ------------------
  553|  3.39M|  switch (type) {
  554|  3.38M|    case PNE_DESCRIPTOR: {
  ------------------
  |  |    5|  3.38M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (554:5): [True: 3.38M, False: 481]
  ------------------
  555|  3.38M|      bool dq = consume_ulong(consumer, descriptor);
  556|  3.38M|      size_t sposition = consumer->position;
  557|  3.38M|      uint8_t dummy;
  558|  3.38M|      bool vq = consume_single_value(consumer, &dummy);
  559|  3.38M|      if (dq && vq) {
  ------------------
  |  Branch (559:11): [True: 3.38M, False: 593]
  |  Branch (559:17): [True: 3.38M, False: 336]
  ------------------
  560|  3.38M|        size_t scsize = consumer->position > sposition ? consumer->position-sposition : 0;
  ------------------
  |  Branch (560:25): [True: 3.38M, False: 0]
  ------------------
  561|  3.38M|        *subconsumer = (pni_consumer_t){.output_start=consumer->output_start+sposition, .position=0, .size=scsize};
  562|  3.38M|        return true;
  563|  3.38M|      }
  564|    929|      return false;
  565|  3.38M|    }
  566|    481|    default:
  ------------------
  |  Branch (566:5): [True: 481, False: 3.38M]
  ------------------
  567|    481|      pni_consumer_skip_value_not_described(consumer, type);
  568|       |      return false;
  569|  3.39M|  }
  570|  3.39M|}
dispatcher.c:pni_consumer_readf8:
   51|  19.1M|{
   52|  19.1M|  if (consumer->position+1 > consumer->size) {
  ------------------
  |  Branch (52:7): [True: 644, False: 19.1M]
  ------------------
   53|    644|    consumer->position = consumer->size;
   54|    644|    return false;
   55|    644|  }
   56|  19.1M|  uint8_t r = consumer->output_start[consumer->position+0];
   57|  19.1M|  consumer->position++;
   58|  19.1M|  *result = r;
   59|       |  return true;
   60|  19.1M|}
dispatcher.c:consume_ulong:
  283|  3.38M|static inline bool consume_ulong(pni_consumer_t* consumer, uint64_t *ulong) {
  284|  3.38M|  *ulong = 0;
  285|  3.38M|  uint8_t type;
  286|  3.38M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (286:7): [True: 2, False: 3.38M]
  ------------------
  287|  3.38M|  switch (type) {
  288|  3.38M|    case PNE_SMALLULONG: {
  ------------------
  |  |   16|  3.38M|#define PNE_SMALLULONG      (0x53)
  ------------------
  |  Branch (288:5): [True: 3.38M, False: 700]
  ------------------
  289|  3.38M|      uint8_t ul;
  290|  3.38M|      if (!pni_consumer_readf8(consumer, &ul)) return false;
  ------------------
  |  Branch (290:11): [True: 1, False: 3.38M]
  ------------------
  291|  3.38M|      *ulong = ul;
  292|  3.38M|      return true;
  293|  3.38M|    }
  294|    109|    case PNE_ULONG: {
  ------------------
  |  |   15|    109|#define PNE_ULONG           (0x80)
  ------------------
  |  Branch (294:5): [True: 109, False: 3.38M]
  ------------------
  295|    109|      uint64_t ul;
  296|    109|      if (!pni_consumer_readf64(consumer, &ul)) return false;
  ------------------
  |  Branch (296:11): [True: 6, False: 103]
  ------------------
  297|    103|      *ulong = ul;
  298|    103|      return true;
  299|    109|    }
  300|      7|    case PNE_ULONG0: {
  ------------------
  |  |   17|      7|#define PNE_ULONG0          (0x44)
  ------------------
  |  Branch (300:5): [True: 7, False: 3.38M]
  ------------------
  301|      7|      *ulong = 0;
  302|      7|      return true;
  303|    109|    }
  304|    584|    default:
  ------------------
  |  Branch (304:5): [True: 584, False: 3.38M]
  ------------------
  305|    584|      pni_consumer_skip_value(consumer, type);
  306|       |      return false;
  307|  3.38M|  }
  308|  3.38M|}
dispatcher.c:pni_consumer_readf64:
   97|    109|{
   98|    109|  uint32_t a;
   99|    109|  if (!pni_consumer_readf32(consumer, &a)) return false;
  ------------------
  |  Branch (99:7): [True: 3, False: 106]
  ------------------
  100|    106|  uint32_t b;
  101|    106|  if (!pni_consumer_readf32(consumer, &b)) return false;
  ------------------
  |  Branch (101:7): [True: 3, False: 103]
  ------------------
  102|    103|  *result = (uint64_t)a << 32 | (uint64_t)b;
  103|       |  return true;
  104|    106|}
dispatcher.c:pni_consumer_readf32:
   78|  2.26k|{
   79|  2.26k|  if (consumer->position+4 > consumer->size) {
  ------------------
  |  Branch (79:7): [True: 79, False: 2.18k]
  ------------------
   80|     79|    consumer->position = consumer->size;
   81|     79|    return false;
   82|     79|  }
   83|  2.18k|  uint32_t a = consumer->output_start[consumer->position+0];
   84|  2.18k|  uint32_t b = consumer->output_start[consumer->position+1];
   85|  2.18k|  uint32_t c = consumer->output_start[consumer->position+2];
   86|  2.18k|  uint32_t d = consumer->output_start[consumer->position+3];
   87|  2.18k|  uint32_t r = a << 24
   88|  2.18k|  | b << 16
   89|  2.18k|  | c <<  8
   90|  2.18k|  | d;
   91|  2.18k|  consumer->position += 4;
   92|  2.18k|  *result = r;
   93|       |  return true;
   94|  2.26k|}
dispatcher.c:pni_consumer_skip_value:
  214|    584|static inline bool pni_consumer_skip_value(pni_consumer_t* consumer, uint8_t type) {
  215|       |  // Check for described type
  216|    584|  if (type==PNE_DESCRIPTOR) {
  ------------------
  |  |    5|    584|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (216:7): [True: 268, False: 316]
  ------------------
  217|       |    // Skip descriptor
  218|    268|    if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (218:9): [True: 2, False: 266]
  ------------------
  219|    266|    if (!pni_consumer_skip_value_not_described(consumer, type)) return false;
  ------------------
  |  Branch (219:9): [True: 151, False: 115]
  ------------------
  220|    115|    if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (220:9): [True: 25, False: 90]
  ------------------
  221|     90|    return pni_consumer_skip_value_not_described(consumer, type);
  222|    115|  }
  223|    316|  return pni_consumer_skip_value_not_described(consumer, type);
  224|    584|}
dispatcher.c:consume_single_value:
  250|  3.38M|static inline bool consume_single_value(pni_consumer_t* consumer, uint8_t* type) {
  251|  3.38M|  uint8_t t;
  252|  3.38M|  if (!pni_consumer_readf8(consumer, &t)) return false;
  ------------------
  |  Branch (252:7): [True: 400, False: 3.38M]
  ------------------
  253|  3.38M|  *type = t;
  254|  3.38M|  if (t==PNE_DESCRIPTOR) {
  ------------------
  |  |    5|  3.38M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (254:7): [True: 193, False: 3.38M]
  ------------------
  255|    193|    uint8_t dummy;
  256|       |    // Descriptor
  257|    193|    bool dq = consume_single_value_not_described(consumer, &dummy);
  258|       |    // Value
  259|    193|    bool vq = consume_single_value_not_described(consumer, &dummy);
  260|    193|    return dq && vq;
  ------------------
  |  Branch (260:12): [True: 70, False: 123]
  |  Branch (260:18): [True: 41, False: 29]
  ------------------
  261|  3.38M|  } else {
  262|  3.38M|    return pni_consumer_skip_value_not_described(consumer, t);
  263|  3.38M|  }
  264|  3.38M|}
dispatcher.c:consume_single_value_not_described:
  241|    386|static inline bool consume_single_value_not_described(pni_consumer_t* consumer, uint8_t* type) {
  242|    386|  uint8_t t;
  243|    386|  if (!pni_consumer_readf8(consumer, &t)) return false;
  ------------------
  |  Branch (243:7): [True: 186, False: 200]
  ------------------
  244|    200|  if (!pni_consumer_skip_value_not_described(consumer, t)) return false;
  ------------------
  |  Branch (244:7): [True: 89, False: 111]
  ------------------
  245|    111|  if (t==0) return false;
  ------------------
  |  Branch (245:7): [True: 0, False: 111]
  ------------------
  246|    111|  *type = t;
  247|       |  return true;
  248|    111|}
dispatcher.c:pni_consumer_skip_value_not_described:
  209|  3.39M|static inline bool pni_consumer_skip_value_not_described(pni_consumer_t* consumer, uint8_t type) {
  210|  3.39M|  pn_bytes_t value;
  211|  3.39M|  return pni_consumer_read_value_not_described(consumer, type, &value);
  212|  3.39M|}
dispatcher.c:pni_consumer_read_value_not_described:
  141|  3.39M|static inline bool pni_consumer_read_value_not_described(pni_consumer_t* consumer, uint8_t type, pn_bytes_t *value) {
  142|  3.39M|  uint8_t subcategory = type >> 4;
  143|  3.39M|  switch (subcategory) {
  144|       |    // Fixed width types:
  145|       |    // No data
  146|  1.18M|    case 0x4:
  ------------------
  |  Branch (146:5): [True: 1.18M, False: 2.20M]
  ------------------
  147|  1.18M|      *value = (pn_bytes_t){.size=0,.start=NULL};
  148|  1.18M|      return true;
  149|       |      // 1 Octet
  150|    221|    case 0x5:
  ------------------
  |  Branch (150:5): [True: 221, False: 3.39M]
  ------------------
  151|    221|      if (consumer->position+1 > consumer->size) break;
  ------------------
  |  Branch (151:11): [True: 15, False: 206]
  ------------------
  152|    206|      *value = (pn_bytes_t){.size=1,.start=(const char *)consumer->output_start+consumer->position};
  153|    206|      consumer->position += 1;
  154|    206|      return true;
  155|       |      // 2 Octets
  156|     64|    case 0x6:
  ------------------
  |  Branch (156:5): [True: 64, False: 3.39M]
  ------------------
  157|     64|      if (consumer->position+2 > consumer->size) break;
  ------------------
  |  Branch (157:11): [True: 11, False: 53]
  ------------------
  158|     53|      *value = (pn_bytes_t){.size=2,.start=(const char *)consumer->output_start+consumer->position};
  159|     53|      consumer->position += 2;
  160|     53|      return true;
  161|       |      // 4 Octets
  162|     82|    case 0x7:
  ------------------
  |  Branch (162:5): [True: 82, False: 3.39M]
  ------------------
  163|     82|      if (consumer->position+4 > consumer->size) break;
  ------------------
  |  Branch (163:11): [True: 35, False: 47]
  ------------------
  164|     47|      *value = (pn_bytes_t){.size=4,.start=(const char *)consumer->output_start+consumer->position};
  165|     47|      consumer->position += 4;
  166|     47|      return true;
  167|       |      // 8 Octets
  168|     45|    case 0x8:
  ------------------
  |  Branch (168:5): [True: 45, False: 3.39M]
  ------------------
  169|     45|      if (consumer->position+8 > consumer->size) break;
  ------------------
  |  Branch (169:11): [True: 19, False: 26]
  ------------------
  170|     26|      *value = (pn_bytes_t){.size=8,.start=(const char *)consumer->output_start+consumer->position};
  171|     26|      consumer->position += 8;
  172|     26|      return true;
  173|       |      // 16 Octets
  174|     35|    case 0x9:
  ------------------
  |  Branch (174:5): [True: 35, False: 3.39M]
  ------------------
  175|     35|      if (consumer->position+16 > consumer->size) break;
  ------------------
  |  Branch (175:11): [True: 19, False: 16]
  ------------------
  176|     16|      *value = (pn_bytes_t){.size=16,.start=(const char *)consumer->output_start+consumer->position};
  177|     16|      consumer->position += 16;
  178|     16|      return true;
  179|       |      // Variable width types:
  180|       |      // One Octet of size
  181|     67|    case 0xA:
  ------------------
  |  Branch (181:5): [True: 67, False: 3.39M]
  ------------------
  182|  2.20M|    case 0xC:
  ------------------
  |  Branch (182:5): [True: 2.20M, False: 1.18M]
  ------------------
  183|  2.20M|    case 0xE: {
  ------------------
  |  Branch (183:5): [True: 42, False: 3.39M]
  ------------------
  184|  2.20M|      uint8_t size;
  185|  2.20M|      if (!pni_consumer_readf8(consumer, &size)) return false;
  ------------------
  |  Branch (185:11): [True: 28, False: 2.20M]
  ------------------
  186|  2.20M|      if (consumer->position+size > consumer->size) break;
  ------------------
  |  Branch (186:11): [True: 126, False: 2.20M]
  ------------------
  187|  2.20M|      *value = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  188|  2.20M|      consumer->position += size;
  189|  2.20M|      return true;
  190|  2.20M|    }
  191|       |    // 4 Octets of size
  192|     55|    case 0xB:
  ------------------
  |  Branch (192:5): [True: 55, False: 3.39M]
  ------------------
  193|  1.89k|    case 0xD:
  ------------------
  |  Branch (193:5): [True: 1.84k, False: 3.38M]
  ------------------
  194|  2.04k|    case 0xF: {
  ------------------
  |  Branch (194:5): [True: 153, False: 3.39M]
  ------------------
  195|  2.04k|      uint32_t size;
  196|  2.04k|      if (!pni_consumer_readf32(consumer, &size)) return false;
  ------------------
  |  Branch (196:11): [True: 73, False: 1.97k]
  ------------------
  197|  1.97k|      if (consumer->position+size > consumer->size) break;
  ------------------
  |  Branch (197:11): [True: 142, False: 1.83k]
  ------------------
  198|  1.83k|      *value = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  199|  1.83k|      consumer->position += size;
  200|  1.83k|      return true;
  201|  1.97k|    }
  202|    493|    default:
  ------------------
  |  Branch (202:5): [True: 493, False: 3.38M]
  ------------------
  203|    493|      break;
  204|  3.39M|  }
  205|    860|  consumer->position = consumer->size;
  206|       |  return false;
  207|  3.39M|}
dispatcher.c:pni_islist:
  226|  3.38M|static inline bool pni_islist(pni_consumer_t* consumer) {
  227|  3.38M|  uint8_t t;
  228|  3.38M|  if (!pni_consumer_readf8(consumer, &t)) return false;
  ------------------
  |  Branch (228:7): [True: 0, False: 3.38M]
  ------------------
  229|  3.38M|  switch (t) {
  230|  1.18M|    case PNE_LIST0:
  ------------------
  |  |   38|  1.18M|#define PNE_LIST0           (0x45)
  ------------------
  |  Branch (230:5): [True: 1.18M, False: 2.20M]
  ------------------
  231|  3.38M|    case PNE_LIST8:
  ------------------
  |  |   39|  3.38M|#define PNE_LIST8           (0xc0)
  ------------------
  |  Branch (231:5): [True: 2.20M, False: 1.18M]
  ------------------
  232|  3.38M|    case PNE_LIST32:
  ------------------
  |  |   40|  3.38M|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (232:5): [True: 1.79k, False: 3.38M]
  ------------------
  233|  3.38M|      return true;
  234|    101|    default:
  ------------------
  |  Branch (234:5): [True: 101, False: 3.38M]
  ------------------
  235|       |      return false;
  236|  3.38M|  }
  237|  3.38M|}

codec.c:pn_data_node:
  166|  2.21G|{
  167|  2.21G|  return nd ? (data->nodes + nd - 1) : NULL;
  ------------------
  |  Branch (167:10): [True: 2.21G, False: 278k]
  ------------------
  168|  2.21G|}
codec.c:pni_node_get_down:
  179|  12.4M|{
  180|  12.4M|  if (!node) return 0;
  ------------------
  |  Branch (180:7): [True: 0, False: 12.4M]
  ------------------
  181|  12.4M|  switch (node->type) {
  182|  4.29M|    case PN_ARRAY:
  ------------------
  |  Branch (182:5): [True: 4.29M, False: 8.13M]
  ------------------
  183|  6.19M|    case PN_ARRAY_DESCRIBED:
  ------------------
  |  |   34|  6.19M|#define PN_ARRAY_DESCRIBED 26  // Internal type: described array
  ------------------
  |  Branch (183:5): [True: 1.89M, False: 10.5M]
  ------------------
  184|  6.63M|    case PN_LIST:
  ------------------
  |  Branch (184:5): [True: 433k, False: 11.9M]
  ------------------
  185|  6.63M|    case PN_MAP:
  ------------------
  |  Branch (185:5): [True: 8.22k, False: 12.4M]
  ------------------
  186|  6.65M|    case PN_DESCRIBED:
  ------------------
  |  Branch (186:5): [True: 14.5k, False: 12.4M]
  ------------------
  187|  6.65M|      return node->u.as_compound.down;
  188|      0|    case PN_DEFER:
  ------------------
  |  |   35|      0|#define PN_DEFER 27            // Internal type: node used only in pn_data_fill/vfill
  ------------------
  |  Branch (188:5): [True: 0, False: 12.4M]
  ------------------
  189|      0|      return node->u.as_deferred.down;
  190|  5.77M|    default:
  ------------------
  |  Branch (190:5): [True: 5.77M, False: 6.65M]
  ------------------
  191|  5.77M|      return 0;  // Scalar types have no children
  192|  12.4M|  }
  193|  12.4M|}
codec.c:pni_data_max_nid:
  161|  6.22M|{
  162|  6.22M|  return data->max_nid ? data->max_nid : PNI_NID_MAX;
  ------------------
  |  |   31|  12.4M|#define PNI_NID_MAX ((pni_nid_t)-1)
  ------------------
  |  Branch (162:10): [True: 0, False: 6.22M]
  ------------------
  163|  6.22M|}
codec.c:pni_node_set_down:
  196|  9.74k|{
  197|  9.74k|  if (!node) return;
  ------------------
  |  Branch (197:7): [True: 0, False: 9.74k]
  ------------------
  198|  9.74k|  switch (node->type) {
  199|  2.78k|    case PN_ARRAY:
  ------------------
  |  Branch (199:5): [True: 2.78k, False: 6.96k]
  ------------------
  200|  3.15k|    case PN_ARRAY_DESCRIBED:
  ------------------
  |  |   34|  3.15k|#define PN_ARRAY_DESCRIBED 26  // Internal type: described array
  ------------------
  |  Branch (200:5): [True: 365, False: 9.38k]
  ------------------
  201|  5.22k|    case PN_LIST:
  ------------------
  |  Branch (201:5): [True: 2.07k, False: 7.67k]
  ------------------
  202|  6.05k|    case PN_MAP:
  ------------------
  |  Branch (202:5): [True: 832, False: 8.91k]
  ------------------
  203|  9.74k|    case PN_DESCRIBED:
  ------------------
  |  Branch (203:5): [True: 3.69k, False: 6.05k]
  ------------------
  204|  9.74k|      node->u.as_compound.down = down;
  205|  9.74k|      break;
  206|      0|    case PN_DEFER:
  ------------------
  |  |   35|      0|#define PN_DEFER 27            // Internal type: node used only in pn_data_fill/vfill
  ------------------
  |  Branch (206:5): [True: 0, False: 9.74k]
  ------------------
  207|      0|      node->u.as_deferred.down = down;
  208|      0|      break;
  209|      0|    default:
  ------------------
  |  Branch (209:5): [True: 0, False: 9.74k]
  ------------------
  210|      0|      break;  // Scalar types - do nothing
  211|  9.74k|  }
  212|  9.74k|}
codec.c:pni_node_inc_children:
  251|  6.20M|{
  252|  6.20M|  if (!node) return;
  ------------------
  |  Branch (252:7): [True: 0, False: 6.20M]
  ------------------
  253|  6.20M|  switch (node->type) {
  254|  4.29M|    case PN_ARRAY:
  ------------------
  |  Branch (254:5): [True: 4.29M, False: 1.91M]
  ------------------
  255|  6.18M|    case PN_ARRAY_DESCRIBED:
  ------------------
  |  |   34|  6.18M|#define PN_ARRAY_DESCRIBED 26  // Internal type: described array
  ------------------
  |  Branch (255:5): [True: 1.89M, False: 4.31M]
  ------------------
  256|  6.19M|    case PN_LIST:
  ------------------
  |  Branch (256:5): [True: 7.47k, False: 6.20M]
  ------------------
  257|  6.20M|    case PN_MAP:
  ------------------
  |  Branch (257:5): [True: 6.48k, False: 6.20M]
  ------------------
  258|  6.20M|    case PN_DESCRIBED:
  ------------------
  |  Branch (258:5): [True: 6.87k, False: 6.20M]
  ------------------
  259|  6.20M|      node->u.as_compound.children_count++;
  260|  6.20M|      break;
  261|      0|    case PN_DEFER:
  ------------------
  |  |   35|      0|#define PN_DEFER 27            // Internal type: node used only in pn_data_fill/vfill
  ------------------
  |  Branch (261:5): [True: 0, False: 6.20M]
  ------------------
  262|      0|      node->u.as_deferred.children_count++;
  263|      0|      break;
  264|      0|    default:
  ------------------
  |  Branch (264:5): [True: 0, False: 6.20M]
  ------------------
  265|      0|      break;
  266|  6.20M|  }
  267|  6.20M|}
decoder.c:pni_data_parent_type:
  173|  6.20M|{
  174|  6.20M|  pni_node_t *node = pn_data_node(data, data->parent);
  175|  6.20M|  return node ? (pn_type_t) node->type : PN_INVALID;
  ------------------
  |  Branch (175:10): [True: 6.20M, False: 0]
  ------------------
  176|  6.20M|}
decoder.c:pn_data_node:
  166|  24.8M|{
  167|  24.8M|  return nd ? (data->nodes + nd - 1) : NULL;
  ------------------
  |  Branch (167:10): [True: 24.8M, False: 0]
  ------------------
  168|  24.8M|}
decoder.c:pni_data_max_nid:
  161|  8.36k|{
  162|  8.36k|  return data->max_nid ? data->max_nid : PNI_NID_MAX;
  ------------------
  |  |   31|  16.7k|#define PNI_NID_MAX ((pni_nid_t)-1)
  ------------------
  |  Branch (162:10): [True: 0, False: 8.36k]
  ------------------
  163|  8.36k|}

pn_decoder_initialize:
   46|  3.07k|{
   47|  3.07k|  decoder->input = NULL;
   48|  3.07k|  decoder->size = 0;
   49|       |  decoder->position = NULL;
   50|  3.07k|}
pn_decoder_finalize:
   53|  3.07k|{
   54|  3.07k|}
pn_decoder_decode:
  611|  3.07k|{
  612|  3.07k|  decoder->input = src;
  613|  3.07k|  decoder->size = size;
  614|  3.07k|  decoder->position = src;
  615|       |
  616|  3.07k|  int err = pni_decoder_decode_value(decoder, dst);
  617|       |
  618|  3.07k|  if (err == PN_UNDERFLOW)
  ------------------
  |  |   51|  3.07k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (618:7): [True: 957, False: 2.12k]
  ------------------
  619|    957|      return pn_error_format(pn_data_error(dst), PN_UNDERFLOW, "not enough data to decode");
  ------------------
  |  |   51|    957|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  620|  2.12k|  if (err) return err;
  ------------------
  |  Branch (620:7): [True: 1.82k, False: 301]
  ------------------
  621|       |
  622|    301|  return decoder->position - decoder->input;
  623|  2.12k|}
decoder.c:pni_decoder_decode_value:
  576|  3.07k|{
  577|  3.07k|  unsigned depth = 0;  // open nodes: how deep into the value we currently are
  578|       |
  579|  3.07k|  while (true)
  ------------------
  |  Branch (579:10): [True: 6.20M, Folded]
  ------------------
  580|  6.20M|  {
  581|  6.20M|    uint8_t code = 0;
  582|  6.20M|    int err;
  583|       |
  584|  6.20M|    if (pni_decoder_in_array(data, depth)) {
  ------------------
  |  Branch (584:9): [True: 6.18M, False: 18.2k]
  ------------------
  585|  6.18M|      code = pni_decoder_state(data)->typecode;  // every element shares it
  586|  6.18M|    } else {
  587|  18.2k|      err = pni_decoder_decode_constructor(decoder, data, &depth, &code);
  588|  18.2k|      if (err) return err;
  ------------------
  |  Branch (588:11): [True: 371, False: 17.8k]
  ------------------
  589|  18.2k|    }
  590|       |
  591|       |    // Whatever we decode next is one of the children the open node is waiting for.
  592|  6.20M|    pni_decoder_dec_remaining_children(data, depth);
  593|       |
  594|  6.20M|    err = pni_decoder_is_container_code(code)
  ------------------
  |  Branch (594:11): [True: 8.56k, False: 6.19M]
  ------------------
  595|  6.20M|      ? pni_decoder_open_container(decoder, data, &depth, code)
  596|  6.20M|      : pni_decoder_decode_scalar(decoder, data, code);
  597|  6.20M|    if (err) return err;
  ------------------
  |  Branch (597:9): [True: 2.40k, False: 6.20M]
  ------------------
  598|       |
  599|       |    // Leave every node that now has all of its children - a container opened
  600|       |    // empty is complete as soon as it is opened. Back at depth 0 the one value
  601|       |    // we were asked for is complete.
  602|  6.21M|    while (depth > 0 && pni_decoder_state(data)->remaining == 0) {
  ------------------
  |  Branch (602:12): [True: 6.21M, False: 301]
  |  Branch (602:25): [True: 6.38k, False: 6.20M]
  ------------------
  603|  6.38k|      pn_data_exit(data);
  604|  6.38k|      depth--;
  605|  6.38k|    }
  606|  6.20M|    if (depth == 0) return 0;
  ------------------
  |  Branch (606:9): [True: 301, False: 6.20M]
  ------------------
  607|  6.20M|  }
  608|  3.07k|}
decoder.c:pni_decoder_in_array:
  230|  6.20M|{
  231|  6.20M|  if (depth == 0) return false;
  ------------------
  |  Branch (231:7): [True: 3.07k, False: 6.20M]
  ------------------
  232|  6.20M|  pn_type_t type = pni_data_parent_type(data);
  233|  6.20M|  return type == PN_ARRAY || type == PN_ARRAY_DESCRIBED;
  ------------------
  |  |   34|  8.11M|#define PN_ARRAY_DESCRIBED 26  // Internal type: described array
  ------------------
  |  Branch (233:10): [True: 4.29M, False: 1.91M]
  |  Branch (233:30): [True: 1.89M, False: 15.1k]
  ------------------
  234|  6.20M|}
decoder.c:pni_decoder_state:
  216|  18.6M|{
  217|  18.6M|  return &pn_data_node(data, data->parent)->u.as_compound.scratch.as_decoder_state;
  218|  18.6M|}
decoder.c:pni_decoder_decode_constructor:
  445|  18.2k|{
  446|  18.2k|  unsigned descriptors = 0;
  447|       |
  448|  21.9k|  while (true) {
  ------------------
  |  Branch (448:10): [True: 21.9k, Folded]
  ------------------
  449|  21.9k|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|     66|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (449:9): [True: 66, False: 21.8k]
  ------------------
  450|       |
  451|  21.8k|    uint8_t next = *decoder->position++;
  452|  21.8k|    if (next != PNE_DESCRIPTOR) {
  ------------------
  |  |    5|  21.8k|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (452:9): [True: 17.8k, False: 3.99k]
  ------------------
  453|  17.8k|      *code = next;
  454|  17.8k|      return 0;
  455|  17.8k|    }
  456|       |
  457|  3.99k|    if (++descriptors > PNI_DECODER_MAX_DESCRIPTORS) {
  ------------------
  |  |  432|  3.99k|#define PNI_DECODER_MAX_DESCRIPTORS 2
  ------------------
  |  Branch (457:9): [True: 11, False: 3.98k]
  ------------------
  458|     11|      return pn_error_format(pn_data_error(data), PN_ARG_ERR, "nested described type depth exceeded");
  ------------------
  |  |   53|     11|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  459|     11|    }
  460|       |
  461|  3.98k|    pni_decoder_dec_remaining_children(data, *depth);
  462|  3.98k|    int err = pn_data_put_described(data);
  463|  3.98k|    if (err) return err;
  ------------------
  |  Branch (463:9): [True: 14, False: 3.97k]
  ------------------
  464|  3.97k|    pn_data_enter(data);
  465|  3.97k|    (*depth)++;
  466|       |
  467|       |    // Of the node's two children the descriptor is decoded right here, leaving
  468|       |    // just the value it describes for the caller.
  469|  3.97k|    pni_decoder_state(data)->remaining = 1;
  470|  3.97k|    err = pni_decoder_decode_descriptor(decoder, data);
  471|  3.97k|    if (err) return err;
  ------------------
  |  Branch (471:9): [True: 280, False: 3.69k]
  ------------------
  472|  3.97k|  }
  473|  18.2k|}
decoder.c:pn_decoder_remaining:
  101|  88.8k|{
  102|  88.8k|  return decoder->input + decoder->size - decoder->position;
  103|  88.8k|}
decoder.c:pni_decoder_decode_descriptor:
  418|  4.38k|{
  419|  4.38k|  if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|     29|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (419:7): [True: 29, False: 4.35k]
  ------------------
  420|       |
  421|  4.35k|  uint8_t code = *decoder->position++;
  422|       |
  423|  4.35k|  if (!pni_decoder_is_scalar_code(code)) {
  ------------------
  |  Branch (423:7): [True: 143, False: 4.21k]
  ------------------
  424|    143|    return pn_error_format(pn_data_error(data), PN_ARG_ERR, "invalid descriptor value typecode: %u", code);
  ------------------
  |  |   53|    143|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  425|    143|  }
  426|       |
  427|  4.21k|  return pni_decoder_decode_scalar(decoder, data, code);
  428|  4.35k|}
decoder.c:pni_decoder_is_scalar_code:
  200|  4.35k|{
  201|  4.35k|  return code != PNE_DESCRIPTOR && !pni_decoder_is_container_code(code);
  ------------------
  |  |    5|  8.70k|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (201:10): [True: 4.28k, False: 73]
  |  Branch (201:36): [True: 4.21k, False: 70]
  ------------------
  202|  4.35k|}
decoder.c:pni_decoder_dec_remaining_children:
  223|  6.21M|{
  224|  6.21M|  if (depth > 0) pni_decoder_state(data)->remaining--;
  ------------------
  |  Branch (224:7): [True: 6.20M, False: 3.07k]
  ------------------
  225|  6.21M|}
decoder.c:pni_decoder_is_container_code:
  183|  6.21M|{
  184|  6.21M|  switch (code)
  185|  6.21M|  {
  186|  4.60k|  case PNE_ARRAY8:
  ------------------
  |  |   43|  4.60k|#define PNE_ARRAY8          (0xe0)
  ------------------
  |  Branch (186:3): [True: 4.60k, False: 6.20M]
  ------------------
  187|  4.85k|  case PNE_ARRAY32:
  ------------------
  |  |   44|  4.85k|#define PNE_ARRAY32         (0xf0)
  ------------------
  |  Branch (187:3): [True: 254, False: 6.21M]
  ------------------
  188|  7.56k|  case PNE_LIST8:
  ------------------
  |  |   39|  7.56k|#define PNE_LIST8           (0xc0)
  ------------------
  |  Branch (188:3): [True: 2.71k, False: 6.20M]
  ------------------
  189|  7.67k|  case PNE_LIST32:
  ------------------
  |  |   40|  7.67k|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (189:3): [True: 101, False: 6.21M]
  ------------------
  190|  8.42k|  case PNE_MAP8:
  ------------------
  |  |   41|  8.42k|#define PNE_MAP8            (0xc1)
  ------------------
  |  Branch (190:3): [True: 752, False: 6.21M]
  ------------------
  191|  8.63k|  case PNE_MAP32:
  ------------------
  |  |   42|  8.63k|#define PNE_MAP32           (0xd1)
  ------------------
  |  Branch (191:3): [True: 213, False: 6.21M]
  ------------------
  192|  8.63k|    return true;
  193|  6.20M|  default:
  ------------------
  |  Branch (193:3): [True: 6.20M, False: 8.63k]
  ------------------
  194|       |    return false;
  195|  6.21M|  }
  196|  6.21M|}
decoder.c:pni_decoder_open_container:
  528|  8.56k|{
  529|  8.56k|  const pn_type_t type = pn_code2type(code);  // PN_LIST, PN_MAP or PN_ARRAY
  530|  8.56k|  size_t width;                               // bytes in each of the size and count fields
  531|       |
  532|  8.56k|  switch (code)
  533|  8.56k|  {
  534|  8.00k|  case PNE_LIST8:  case PNE_MAP8:  case PNE_ARRAY8:  width = 1; break;
  ------------------
  |  |   39|  2.67k|#define PNE_LIST8           (0xc0)
  ------------------
                case PNE_LIST8:  case PNE_MAP8:  case PNE_ARRAY8:  width = 1; break;
  ------------------
  |  |   41|  3.41k|#define PNE_MAP8            (0xc1)
  ------------------
                case PNE_LIST8:  case PNE_MAP8:  case PNE_ARRAY8:  width = 1; break;
  ------------------
  |  |   43|  8.00k|#define PNE_ARRAY8          (0xe0)
  ------------------
  |  Branch (534:3): [True: 2.67k, False: 5.89k]
  |  Branch (534:20): [True: 742, False: 7.82k]
  |  Branch (534:36): [True: 4.59k, False: 3.97k]
  ------------------
  535|    558|  case PNE_LIST32: case PNE_MAP32: case PNE_ARRAY32: width = 4; break;
  ------------------
  |  |   40|     98|#define PNE_LIST32          (0xd0)
  ------------------
                case PNE_LIST32: case PNE_MAP32: case PNE_ARRAY32: width = 4; break;
  ------------------
  |  |   42|    307|#define PNE_MAP32           (0xd1)
  ------------------
                case PNE_LIST32: case PNE_MAP32: case PNE_ARRAY32: width = 4; break;
  ------------------
  |  |   44|    558|#define PNE_ARRAY32         (0xf0)
  ------------------
  |  Branch (535:3): [True: 98, False: 8.46k]
  |  Branch (535:20): [True: 209, False: 8.35k]
  |  Branch (535:36): [True: 251, False: 8.31k]
  ------------------
  536|      0|  default:
  ------------------
  |  Branch (536:3): [True: 0, False: 8.56k]
  ------------------
  537|      0|    return pn_error_format(pn_data_error(data), PN_ARG_ERR, "internal error");
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  538|  8.56k|  }
  539|       |
  540|       |  // What the size field has to cover: the count, and for an array at least one
  541|       |  // byte of the constructor its elements share.
  542|  8.56k|  const size_t min_size = width + (type == PN_ARRAY ? 1 : 0);
  ------------------
  |  Branch (542:36): [True: 4.84k, False: 3.72k]
  ------------------
  543|       |
  544|  8.56k|  if (pn_decoder_remaining(decoder) < width + min_size) return PN_UNDERFLOW;
  ------------------
  |  |   51|     75|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (544:7): [True: 75, False: 8.49k]
  ------------------
  545|  8.49k|  size_t size = (width == 1) ? pn_decoder_readf8(decoder) : pn_decoder_readf32(decoder);
  ------------------
  |  Branch (545:17): [True: 7.95k, False: 540]
  ------------------
  546|  8.49k|  if (size < min_size) {
  ------------------
  |  Branch (546:7): [True: 18, False: 8.47k]
  ------------------
  547|     18|    return pn_error_format(pn_data_error(data), PN_ARG_ERR,
  ------------------
  |  |   53|     18|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  548|     18|                           "%s size %zu too small to hold its own header",
  549|     18|                           pn_type_name(type), size);
  550|     18|  }
  551|  8.47k|  if (pn_decoder_remaining(decoder) < size) return PN_UNDERFLOW;
  ------------------
  |  |   51|    111|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (551:7): [True: 111, False: 8.36k]
  ------------------
  552|  8.36k|  size_t count = (width == 1) ? pn_decoder_readf8(decoder) : pn_decoder_readf32(decoder);
  ------------------
  |  Branch (552:18): [True: 7.85k, False: 502]
  ------------------
  553|       |
  554|       |  // Array elements of a zero width type (null, true, ...) take no input bytes
  555|       |  // at all, so a count is not bounded by the size the way a list's is. Reject
  556|       |  // any count that could never fit in this pn_data_t - whose node budget may be
  557|       |  // well below the hard ceiling - rather than truncating it.
  558|  8.36k|  if (count > pni_data_max_nid(data)) {
  ------------------
  |  Branch (558:7): [True: 52, False: 8.30k]
  ------------------
  559|     52|    return pn_error_format(pn_data_error(data), PN_OUT_OF_MEMORY,
  ------------------
  |  |   57|     52|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  560|     52|                           "%s count %zu exceeds the pn_data node limit",
  561|     52|                           pn_type_name(type), count);
  562|     52|  }
  563|       |
  564|  8.30k|  if (type == PN_ARRAY) return pni_decoder_open_array(decoder, data, depth, (pni_nid_t) count);
  ------------------
  |  Branch (564:7): [True: 4.72k, False: 3.58k]
  ------------------
  565|       |
  566|  3.58k|  int err = (type == PN_LIST) ? pn_data_put_list(data) : pn_data_put_map(data);
  ------------------
  |  Branch (566:13): [True: 2.67k, False: 909]
  ------------------
  567|  3.58k|  if (err) return err;
  ------------------
  |  Branch (567:7): [True: 3, False: 3.57k]
  ------------------
  568|  3.57k|  pn_data_enter(data);
  569|  3.57k|  (*depth)++;
  570|  3.57k|  pni_decoder_state(data)->remaining = (pni_nid_t) count;
  571|  3.57k|  return 0;
  572|  3.58k|}
decoder.c:pn_code2type:
  106|  13.2k|{
  107|  13.2k|  switch (code)
  108|  13.2k|  {
  109|      0|  case PNE_DESCRIPTOR:
  ------------------
  |  |    5|      0|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (109:3): [True: 0, False: 13.2k]
  ------------------
  110|      0|    return (pn_type_t) PN_ARG_ERR;
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  111|    475|  case PNE_NULL:
  ------------------
  |  |    6|    475|#define PNE_NULL            (0x40)
  ------------------
  |  Branch (111:3): [True: 475, False: 12.7k]
  ------------------
  112|    475|    return PN_NULL;
  113|    330|  case PNE_TRUE:
  ------------------
  |  |    8|    330|#define PNE_TRUE            (0x41)
  ------------------
  |  Branch (113:3): [True: 330, False: 12.9k]
  ------------------
  114|    618|  case PNE_FALSE:
  ------------------
  |  |    9|    618|#define PNE_FALSE           (0x42)
  ------------------
  |  Branch (114:3): [True: 288, False: 12.9k]
  ------------------
  115|    706|  case PNE_BOOLEAN:
  ------------------
  |  |    7|    706|#define PNE_BOOLEAN         (0x56)
  ------------------
  |  Branch (115:3): [True: 88, False: 13.1k]
  ------------------
  116|    706|    return PN_BOOL;
  117|     62|  case PNE_UBYTE:
  ------------------
  |  |   10|     62|#define PNE_UBYTE           (0x50)
  ------------------
  |  Branch (117:3): [True: 62, False: 13.1k]
  ------------------
  118|     62|    return PN_UBYTE;
  119|     30|  case PNE_BYTE:
  ------------------
  |  |   18|     30|#define PNE_BYTE            (0x51)
  ------------------
  |  Branch (119:3): [True: 30, False: 13.2k]
  ------------------
  120|     30|    return PN_BYTE;
  121|     59|  case PNE_USHORT:
  ------------------
  |  |   11|     59|#define PNE_USHORT          (0x60)
  ------------------
  |  Branch (121:3): [True: 59, False: 13.1k]
  ------------------
  122|     59|    return PN_USHORT;
  123|    104|  case PNE_SHORT:
  ------------------
  |  |   19|    104|#define PNE_SHORT           (0x61)
  ------------------
  |  Branch (123:3): [True: 104, False: 13.1k]
  ------------------
  124|    104|    return PN_SHORT;
  125|    426|  case PNE_UINT0:
  ------------------
  |  |   14|    426|#define PNE_UINT0           (0x43)
  ------------------
  |  Branch (125:3): [True: 426, False: 12.8k]
  ------------------
  126|    482|  case PNE_SMALLUINT:
  ------------------
  |  |   13|    482|#define PNE_SMALLUINT       (0x52)
  ------------------
  |  Branch (126:3): [True: 56, False: 13.1k]
  ------------------
  127|    567|  case PNE_UINT:
  ------------------
  |  |   12|    567|#define PNE_UINT            (0x70)
  ------------------
  |  Branch (127:3): [True: 85, False: 13.1k]
  ------------------
  128|    567|    return PN_UINT;
  129|     90|  case PNE_SMALLINT:
  ------------------
  |  |   21|     90|#define PNE_SMALLINT        (0x54)
  ------------------
  |  Branch (129:3): [True: 90, False: 13.1k]
  ------------------
  130|    169|  case PNE_INT:
  ------------------
  |  |   20|    169|#define PNE_INT             (0x71)
  ------------------
  |  Branch (130:3): [True: 79, False: 13.1k]
  ------------------
  131|    169|    return PN_INT;
  132|     50|  case PNE_UTF32:
  ------------------
  |  |   29|     50|#define PNE_UTF32           (0x73)
  ------------------
  |  Branch (132:3): [True: 50, False: 13.1k]
  ------------------
  133|     50|    return PN_CHAR;
  134|     85|  case PNE_FLOAT:
  ------------------
  |  |   24|     85|#define PNE_FLOAT           (0x72)
  ------------------
  |  Branch (134:3): [True: 85, False: 13.1k]
  ------------------
  135|     85|    return PN_FLOAT;
  136|     57|  case PNE_LONG:
  ------------------
  |  |   22|     57|#define PNE_LONG            (0x81)
  ------------------
  |  Branch (136:3): [True: 57, False: 13.1k]
  ------------------
  137|    156|  case PNE_SMALLLONG:
  ------------------
  |  |   23|    156|#define PNE_SMALLLONG       (0x55)
  ------------------
  |  Branch (137:3): [True: 99, False: 13.1k]
  ------------------
  138|    156|    return PN_LONG;
  139|     49|  case PNE_MS64:
  ------------------
  |  |   30|     49|#define PNE_MS64            (0x83)
  ------------------
  |  Branch (139:3): [True: 49, False: 13.1k]
  ------------------
  140|     49|    return PN_TIMESTAMP;
  141|     47|  case PNE_DOUBLE:
  ------------------
  |  |   25|     47|#define PNE_DOUBLE          (0x82)
  ------------------
  |  Branch (141:3): [True: 47, False: 13.1k]
  ------------------
  142|     47|    return PN_DOUBLE;
  143|     92|  case PNE_DECIMAL32:
  ------------------
  |  |   26|     92|#define PNE_DECIMAL32       (0x74)
  ------------------
  |  Branch (143:3): [True: 92, False: 13.1k]
  ------------------
  144|     92|    return PN_DECIMAL32;
  145|     87|  case PNE_DECIMAL64:
  ------------------
  |  |   27|     87|#define PNE_DECIMAL64       (0x84)
  ------------------
  |  Branch (145:3): [True: 87, False: 13.1k]
  ------------------
  146|     87|    return PN_DECIMAL64;
  147|     88|  case PNE_DECIMAL128:
  ------------------
  |  |   28|     88|#define PNE_DECIMAL128      (0x94)
  ------------------
  |  Branch (147:3): [True: 88, False: 13.1k]
  ------------------
  148|     88|    return PN_DECIMAL128;
  149|     62|  case PNE_UUID:
  ------------------
  |  |   31|     62|#define PNE_UUID            (0x98)
  ------------------
  |  Branch (149:3): [True: 62, False: 13.1k]
  ------------------
  150|     62|    return PN_UUID;
  151|    332|  case PNE_ULONG0:
  ------------------
  |  |   17|    332|#define PNE_ULONG0          (0x44)
  ------------------
  |  Branch (151:3): [True: 332, False: 12.9k]
  ------------------
  152|    394|  case PNE_SMALLULONG:
  ------------------
  |  |   16|    394|#define PNE_SMALLULONG      (0x53)
  ------------------
  |  Branch (152:3): [True: 62, False: 13.1k]
  ------------------
  153|    436|  case PNE_ULONG:
  ------------------
  |  |   15|    436|#define PNE_ULONG           (0x80)
  ------------------
  |  Branch (153:3): [True: 42, False: 13.1k]
  ------------------
  154|    436|    return PN_ULONG;
  155|    142|  case PNE_VBIN8:
  ------------------
  |  |   32|    142|#define PNE_VBIN8           (0xa0)
  ------------------
  |  Branch (155:3): [True: 142, False: 13.0k]
  ------------------
  156|    205|  case PNE_VBIN32:
  ------------------
  |  |   33|    205|#define PNE_VBIN32          (0xb0)
  ------------------
  |  Branch (156:3): [True: 63, False: 13.1k]
  ------------------
  157|    205|    return PN_BINARY;
  158|     76|  case PNE_STR8_UTF8:
  ------------------
  |  |   34|     76|#define PNE_STR8_UTF8       (0xa1)
  ------------------
  |  Branch (158:3): [True: 76, False: 13.1k]
  ------------------
  159|    113|  case PNE_STR32_UTF8:
  ------------------
  |  |   35|    113|#define PNE_STR32_UTF8      (0xb1)
  ------------------
  |  Branch (159:3): [True: 37, False: 13.1k]
  ------------------
  160|    113|    return PN_STRING;
  161|    118|  case PNE_SYM8:
  ------------------
  |  |   36|    118|#define PNE_SYM8            (0xa3)
  ------------------
  |  Branch (161:3): [True: 118, False: 13.1k]
  ------------------
  162|    178|  case PNE_SYM32:
  ------------------
  |  |   37|    178|#define PNE_SYM32           (0xb3)
  ------------------
  |  Branch (162:3): [True: 60, False: 13.1k]
  ------------------
  163|    178|    return PN_SYMBOL;
  164|    299|  case PNE_LIST0:
  ------------------
  |  |   38|    299|#define PNE_LIST0           (0x45)
  ------------------
  |  Branch (164:3): [True: 299, False: 12.9k]
  ------------------
  165|  3.05k|  case PNE_LIST8:
  ------------------
  |  |   39|  3.05k|#define PNE_LIST8           (0xc0)
  ------------------
  |  Branch (165:3): [True: 2.75k, False: 10.4k]
  ------------------
  166|  3.17k|  case PNE_LIST32:
  ------------------
  |  |   40|  3.17k|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (166:3): [True: 123, False: 13.1k]
  ------------------
  167|  3.17k|    return PN_LIST;
  168|  4.90k|  case PNE_ARRAY8:
  ------------------
  |  |   43|  4.90k|#define PNE_ARRAY8          (0xe0)
  ------------------
  |  Branch (168:3): [True: 4.90k, False: 8.33k]
  ------------------
  169|  5.20k|  case PNE_ARRAY32:
  ------------------
  |  |   44|  5.20k|#define PNE_ARRAY32         (0xf0)
  ------------------
  |  Branch (169:3): [True: 299, False: 12.9k]
  ------------------
  170|  5.20k|    return PN_ARRAY;
  171|    795|  case PNE_MAP8:
  ------------------
  |  |   41|    795|#define PNE_MAP8            (0xc1)
  ------------------
  |  Branch (171:3): [True: 795, False: 12.4k]
  ------------------
  172|  1.01k|  case PNE_MAP32:
  ------------------
  |  |   42|  1.01k|#define PNE_MAP32           (0xd1)
  ------------------
  |  Branch (172:3): [True: 221, False: 13.0k]
  ------------------
  173|  1.01k|    return PN_MAP;
  174|     24|  default:
  ------------------
  |  Branch (174:3): [True: 24, False: 13.2k]
  ------------------
  175|     24|    return (pn_type_t) PN_ARG_ERR;
  ------------------
  |  |   53|     24|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  176|  13.2k|  }
  177|  13.2k|}
decoder.c:pn_decoder_readf8:
   57|  36.2k|{
   58|  36.2k|  uint8_t r = decoder->position[0];
   59|  36.2k|  decoder->position++;
   60|  36.2k|  return r;
   61|  36.2k|}
decoder.c:pn_decoder_readf32:
   74|  6.53k|{
   75|  6.53k|  uint32_t a = (uint8_t) decoder->position[0];
   76|  6.53k|  uint32_t b = (uint8_t) decoder->position[1];
   77|  6.53k|  uint32_t c = (uint8_t) decoder->position[2];
   78|  6.53k|  uint32_t d = (uint8_t) decoder->position[3];
   79|  6.53k|  uint32_t r = a << 24
   80|  6.53k|    | b << 16
   81|  6.53k|    | c <<  8
   82|  6.53k|    | d;
   83|  6.53k|  decoder->position += 4;
   84|  6.53k|  return r;
   85|  6.53k|}
decoder.c:pni_decoder_open_array:
  484|  4.72k|{
  485|       |  // The header check in pni_decoder_open_container leaves at least the one
  486|       |  // constructor byte an array must have, so this peek is in bounds.
  487|  4.72k|  bool described = (*decoder->position == PNE_DESCRIPTOR);
  ------------------
  |  |    5|  4.72k|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  488|       |
  489|  4.72k|  int err = pn_data_put_array(data, described, (pn_type_t) 0);
  490|  4.72k|  if (err) return err;
  ------------------
  |  Branch (490:7): [True: 1, False: 4.72k]
  ------------------
  491|  4.72k|  pn_data_enter(data);
  492|  4.72k|  (*depth)++;
  493|       |
  494|  4.72k|  if (described) {
  ------------------
  |  Branch (494:7): [True: 410, False: 4.31k]
  ------------------
  495|    410|    decoder->position++;
  496|    410|    err = pni_decoder_decode_descriptor(decoder, data);
  497|    410|    if (err) return err;
  ------------------
  |  Branch (497:9): [True: 45, False: 365]
  ------------------
  498|    410|  }
  499|       |
  500|  4.68k|  if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|      3|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (500:7): [True: 3, False: 4.67k]
  ------------------
  501|  4.67k|  uint8_t element_code = *decoder->position++;
  502|       |
  503|  4.67k|  if (element_code == PNE_DESCRIPTOR) {
  ------------------
  |  |    5|  4.67k|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (503:7): [True: 7, False: 4.67k]
  ------------------
  504|      7|    return pn_error_format(pn_data_error(data), PN_ARG_ERR,
  ------------------
  |  |   53|      7|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  505|      7|                           "chained descriptor not supported for a described array");
  506|      7|  }
  507|       |
  508|  4.67k|  pn_type_t element_type = pn_code2type(element_code);
  509|  4.67k|  if ((int) element_type < 0) {
  ------------------
  |  Branch (509:7): [True: 24, False: 4.64k]
  ------------------
  510|     24|    return pn_error_format(pn_data_error(data), (int) element_type,
  511|     24|                           "unrecognized array element typecode: %u", element_code);
  512|     24|  }
  513|       |  // The array node had to be created before its element type could be known.
  514|  4.64k|  pni_data_set_parent_array_type(data, element_type);
  515|       |
  516|  4.64k|  pni_decoder_state_t *state = pni_decoder_state(data);
  517|  4.64k|  state->remaining = count;
  518|  4.64k|  state->typecode = element_code;
  519|  4.64k|  return 0;
  520|  4.67k|}
decoder.c:pni_decoder_decode_scalar:
  247|  6.20M|{
  248|  6.20M|  int err;
  249|  6.20M|  conv_t conv;
  250|  6.20M|  pn_decimal128_t dec128;
  251|  6.20M|  pn_uuid_t uuid;
  252|  6.20M|  size_t size;
  253|       |
  254|  6.20M|  switch (code)
  255|  6.20M|  {
  256|   989k|  case PNE_NULL:
  ------------------
  |  |    6|   989k|#define PNE_NULL            (0x40)
  ------------------
  |  Branch (256:3): [True: 989k, False: 5.21M]
  ------------------
  257|   989k|    err = pn_data_put_null(data);
  258|   989k|    break;
  259|  1.32M|  case PNE_TRUE:
  ------------------
  |  |    8|  1.32M|#define PNE_TRUE            (0x41)
  ------------------
  |  Branch (259:3): [True: 1.32M, False: 4.87M]
  ------------------
  260|  1.32M|    err = pn_data_put_bool(data, true);
  261|  1.32M|    break;
  262|  2.07M|  case PNE_FALSE:
  ------------------
  |  |    9|  2.07M|#define PNE_FALSE           (0x42)
  ------------------
  |  Branch (262:3): [True: 2.07M, False: 4.13M]
  ------------------
  263|  2.07M|    err = pn_data_put_bool(data, false);
  264|  2.07M|    break;
  265|  1.19k|  case PNE_BOOLEAN:
  ------------------
  |  |    7|  1.19k|#define PNE_BOOLEAN         (0x56)
  ------------------
  |  Branch (265:3): [True: 1.19k, False: 6.20M]
  ------------------
  266|  1.19k|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|     52|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (266:9): [True: 52, False: 1.14k]
  ------------------
  267|  1.14k|    err = pn_data_put_bool(data, pn_decoder_readf8(decoder) != 0);
  268|  1.14k|    break;
  269|    968|  case PNE_UBYTE:
  ------------------
  |  |   10|    968|#define PNE_UBYTE           (0x50)
  ------------------
  |  Branch (269:3): [True: 968, False: 6.20M]
  ------------------
  270|    968|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|     18|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (270:9): [True: 18, False: 950]
  ------------------
  271|    950|    err = pn_data_put_ubyte(data, pn_decoder_readf8(decoder));
  272|    950|    break;
  273|    445|  case PNE_BYTE:
  ------------------
  |  |   18|    445|#define PNE_BYTE            (0x51)
  ------------------
  |  Branch (273:3): [True: 445, False: 6.20M]
  ------------------
  274|    445|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|     14|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (274:9): [True: 14, False: 431]
  ------------------
  275|    431|    err = pn_data_put_byte(data, pn_decoder_readf8(decoder));
  276|    431|    break;
  277|    570|  case PNE_USHORT:
  ------------------
  |  |   11|    570|#define PNE_USHORT          (0x60)
  ------------------
  |  Branch (277:3): [True: 570, False: 6.20M]
  ------------------
  278|    570|    if (pn_decoder_remaining(decoder) < 2) return PN_UNDERFLOW;
  ------------------
  |  |   51|     14|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (278:9): [True: 14, False: 556]
  ------------------
  279|    556|    err = pn_data_put_ushort(data, pn_decoder_readf16(decoder));
  280|    556|    break;
  281|    543|  case PNE_SHORT:
  ------------------
  |  |   19|    543|#define PNE_SHORT           (0x61)
  ------------------
  |  Branch (281:3): [True: 543, False: 6.20M]
  ------------------
  282|    543|    if (pn_decoder_remaining(decoder) < 2) return PN_UNDERFLOW;
  ------------------
  |  |   51|     10|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (282:9): [True: 10, False: 533]
  ------------------
  283|    533|    err = pn_data_put_short(data, pn_decoder_readf16(decoder));
  284|    533|    break;
  285|    439|  case PNE_UINT:
  ------------------
  |  |   12|    439|#define PNE_UINT            (0x70)
  ------------------
  |  Branch (285:3): [True: 439, False: 6.20M]
  ------------------
  286|    439|    if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   51|     25|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (286:9): [True: 25, False: 414]
  ------------------
  287|    414|    err = pn_data_put_uint(data, pn_decoder_readf32(decoder));
  288|    414|    break;
  289|  1.09M|  case PNE_UINT0:
  ------------------
  |  |   14|  1.09M|#define PNE_UINT0           (0x43)
  ------------------
  |  Branch (289:3): [True: 1.09M, False: 5.10M]
  ------------------
  290|  1.09M|    err = pn_data_put_uint(data, 0);
  291|  1.09M|    break;
  292|    670|  case PNE_SMALLUINT:
  ------------------
  |  |   13|    670|#define PNE_SMALLUINT       (0x52)
  ------------------
  |  Branch (292:3): [True: 670, False: 6.20M]
  ------------------
  293|    670|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|     15|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (293:9): [True: 15, False: 655]
  ------------------
  294|    655|    err = pn_data_put_uint(data, pn_decoder_readf8(decoder));
  295|    655|    break;
  296|    532|  case PNE_SMALLINT:
  ------------------
  |  |   21|    532|#define PNE_SMALLINT        (0x54)
  ------------------
  |  Branch (296:3): [True: 532, False: 6.20M]
  ------------------
  297|    532|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|     11|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (297:9): [True: 11, False: 521]
  ------------------
  298|    521|    err = pn_data_put_int(data, (int8_t)pn_decoder_readf8(decoder));
  299|    521|    break;
  300|    480|  case PNE_INT:
  ------------------
  |  |   20|    480|#define PNE_INT             (0x71)
  ------------------
  |  Branch (300:3): [True: 480, False: 6.20M]
  ------------------
  301|    480|    if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   51|     13|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (301:9): [True: 13, False: 467]
  ------------------
  302|    467|    err = pn_data_put_int(data, pn_decoder_readf32(decoder));
  303|    467|    break;
  304|    371|  case PNE_UTF32:
  ------------------
  |  |   29|    371|#define PNE_UTF32           (0x73)
  ------------------
  |  Branch (304:3): [True: 371, False: 6.20M]
  ------------------
  305|    371|    if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   51|     12|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (305:9): [True: 12, False: 359]
  ------------------
  306|    359|    err = pn_data_put_char(data, pn_decoder_readf32(decoder));
  307|    359|    break;
  308|  1.17k|  case PNE_FLOAT:
  ------------------
  |  |   24|  1.17k|#define PNE_FLOAT           (0x72)
  ------------------
  |  Branch (308:3): [True: 1.17k, False: 6.20M]
  ------------------
  309|  1.17k|    if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   51|     25|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (309:9): [True: 25, False: 1.15k]
  ------------------
  310|       |    // XXX: this assumes the platform uses IEEE floats
  311|  1.15k|    conv.i = pn_decoder_readf32(decoder);
  312|  1.15k|    err = pn_data_put_float(data, conv.f);
  313|  1.15k|    break;
  314|    314|  case PNE_DECIMAL32:
  ------------------
  |  |   26|    314|#define PNE_DECIMAL32       (0x74)
  ------------------
  |  Branch (314:3): [True: 314, False: 6.20M]
  ------------------
  315|    314|    if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   51|     11|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (315:9): [True: 11, False: 303]
  ------------------
  316|    303|    err = pn_data_put_decimal32(data, pn_decoder_readf32(decoder));
  317|    303|    break;
  318|    391|  case PNE_ULONG:
  ------------------
  |  |   15|    391|#define PNE_ULONG           (0x80)
  ------------------
  |  Branch (318:3): [True: 391, False: 6.20M]
  ------------------
  319|    391|    if (pn_decoder_remaining(decoder) < 8) return PN_UNDERFLOW;
  ------------------
  |  |   51|     27|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (319:9): [True: 27, False: 364]
  ------------------
  320|    364|    err = pn_data_put_ulong(data, pn_decoder_readf64(decoder));
  321|    364|    break;
  322|    181|  case PNE_LONG:
  ------------------
  |  |   22|    181|#define PNE_LONG            (0x81)
  ------------------
  |  Branch (322:3): [True: 181, False: 6.20M]
  ------------------
  323|    181|    if (pn_decoder_remaining(decoder) < 8) return PN_UNDERFLOW;
  ------------------
  |  |   51|     20|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (323:9): [True: 20, False: 161]
  ------------------
  324|    161|    err = pn_data_put_long(data, pn_decoder_readf64(decoder));
  325|    161|    break;
  326|    283|  case PNE_MS64:
  ------------------
  |  |   30|    283|#define PNE_MS64            (0x83)
  ------------------
  |  Branch (326:3): [True: 283, False: 6.20M]
  ------------------
  327|    283|    if (pn_decoder_remaining(decoder) < 8) return PN_UNDERFLOW;
  ------------------
  |  |   51|     10|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (327:9): [True: 10, False: 273]
  ------------------
  328|    273|    err = pn_data_put_timestamp(data, pn_decoder_readf64(decoder));
  329|    273|    break;
  330|    136|  case PNE_DOUBLE:
  ------------------
  |  |   25|    136|#define PNE_DOUBLE          (0x82)
  ------------------
  |  Branch (330:3): [True: 136, False: 6.20M]
  ------------------
  331|       |    // XXX: this assumes the platform uses IEEE floats
  332|    136|    if (pn_decoder_remaining(decoder) < 8) return PN_UNDERFLOW;
  ------------------
  |  |   51|     12|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (332:9): [True: 12, False: 124]
  ------------------
  333|    124|    conv.l = pn_decoder_readf64(decoder);
  334|    124|    err = pn_data_put_double(data, conv.d);
  335|    124|    break;
  336|    165|  case PNE_DECIMAL64:
  ------------------
  |  |   27|    165|#define PNE_DECIMAL64       (0x84)
  ------------------
  |  Branch (336:3): [True: 165, False: 6.20M]
  ------------------
  337|    165|    if (pn_decoder_remaining(decoder) < 8) return PN_UNDERFLOW;
  ------------------
  |  |   51|     20|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (337:9): [True: 20, False: 145]
  ------------------
  338|    145|    err = pn_data_put_decimal64(data, pn_decoder_readf64(decoder));
  339|    145|    break;
  340|   269k|  case PNE_ULONG0:
  ------------------
  |  |   17|   269k|#define PNE_ULONG0          (0x44)
  ------------------
  |  Branch (340:3): [True: 269k, False: 5.93M]
  ------------------
  341|   269k|    err = pn_data_put_ulong(data, 0);
  342|   269k|    break;
  343|  2.75k|  case PNE_SMALLULONG:
  ------------------
  |  |   16|  2.75k|#define PNE_SMALLULONG      (0x53)
  ------------------
  |  Branch (343:3): [True: 2.75k, False: 6.19M]
  ------------------
  344|  2.75k|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|     25|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (344:9): [True: 25, False: 2.73k]
  ------------------
  345|  2.73k|    err = pn_data_put_ulong(data, pn_decoder_readf8(decoder));
  346|  2.73k|    break;
  347|    653|  case PNE_SMALLLONG:
  ------------------
  |  |   23|    653|#define PNE_SMALLLONG       (0x55)
  ------------------
  |  Branch (347:3): [True: 653, False: 6.20M]
  ------------------
  348|    653|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|     15|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (348:9): [True: 15, False: 638]
  ------------------
  349|    638|    err = pn_data_put_long(data, (int8_t)pn_decoder_readf8(decoder));
  350|    638|    break;
  351|    221|  case PNE_DECIMAL128:
  ------------------
  |  |   28|    221|#define PNE_DECIMAL128      (0x94)
  ------------------
  |  Branch (351:3): [True: 221, False: 6.20M]
  ------------------
  352|    221|    if (pn_decoder_remaining(decoder) < 16) return PN_UNDERFLOW;
  ------------------
  |  |   51|     18|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (352:9): [True: 18, False: 203]
  ------------------
  353|    203|    pn_decoder_readf128(decoder, &dec128);
  354|    203|    err = pn_data_put_decimal128(data, dec128);
  355|    203|    break;
  356|    209|  case PNE_UUID:
  ------------------
  |  |   31|    209|#define PNE_UUID            (0x98)
  ------------------
  |  Branch (356:3): [True: 209, False: 6.20M]
  ------------------
  357|    209|    if (pn_decoder_remaining(decoder) < 16) return PN_UNDERFLOW;
  ------------------
  |  |   51|     14|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (357:9): [True: 14, False: 195]
  ------------------
  358|    195|    pn_decoder_readf128(decoder, &uuid);
  359|    195|    err = pn_data_put_uuid(data, uuid);
  360|    195|    break;
  361|  7.65k|  case PNE_VBIN8:
  ------------------
  |  |   32|  7.65k|#define PNE_VBIN8           (0xa0)
  ------------------
  |  Branch (361:3): [True: 7.65k, False: 6.19M]
  ------------------
  362|  9.31k|  case PNE_STR8_UTF8:
  ------------------
  |  |   34|  9.31k|#define PNE_STR8_UTF8       (0xa1)
  ------------------
  |  Branch (362:3): [True: 1.66k, False: 6.20M]
  ------------------
  363|  13.4k|  case PNE_SYM8:
  ------------------
  |  |   36|  13.4k|#define PNE_SYM8            (0xa3)
  ------------------
  |  Branch (363:3): [True: 4.12k, False: 6.19M]
  ------------------
  364|  13.6k|  case PNE_VBIN32:
  ------------------
  |  |   33|  13.6k|#define PNE_VBIN32          (0xb0)
  ------------------
  |  Branch (364:3): [True: 251, False: 6.20M]
  ------------------
  365|  13.9k|  case PNE_STR32_UTF8:
  ------------------
  |  |   35|  13.9k|#define PNE_STR32_UTF8      (0xb1)
  ------------------
  |  Branch (365:3): [True: 228, False: 6.20M]
  ------------------
  366|  14.1k|  case PNE_SYM32:
  ------------------
  |  |   37|  14.1k|#define PNE_SYM32           (0xb3)
  ------------------
  |  Branch (366:3): [True: 218, False: 6.20M]
  ------------------
  367|  14.1k|    switch (code & 0xF0)
  368|  14.1k|    {
  369|  13.4k|    case 0xA0:
  ------------------
  |  Branch (369:5): [True: 13.4k, False: 697]
  ------------------
  370|  13.4k|      if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   51|     78|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (370:11): [True: 78, False: 13.3k]
  ------------------
  371|  13.3k|      size = pn_decoder_readf8(decoder);
  372|  13.3k|      break;
  373|    697|    case 0xB0:
  ------------------
  |  Branch (373:5): [True: 697, False: 13.4k]
  ------------------
  374|    697|      if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   51|     28|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (374:11): [True: 28, False: 669]
  ------------------
  375|    669|      size = pn_decoder_readf32(decoder);
  376|    669|      break;
  377|      0|    default:
  ------------------
  |  Branch (377:5): [True: 0, False: 14.1k]
  ------------------
  378|      0|      return pn_error_format(pn_data_error(data), PN_ARG_ERR, "unrecognized variable-width typecode: %u", code);
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  379|  14.1k|    }
  380|       |
  381|  14.0k|    if (pn_decoder_remaining(decoder) < size) return PN_UNDERFLOW;
  ------------------
  |  |   51|    186|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (381:9): [True: 186, False: 13.8k]
  ------------------
  382|       |
  383|  13.8k|    {
  384|  13.8k|      char *start = (char *) decoder->position;
  385|  13.8k|      pn_bytes_t bytes = {size, start};
  386|  13.8k|      switch (code & 0x0F)
  387|  13.8k|      {
  388|  7.77k|      case 0x0:
  ------------------
  |  Branch (388:7): [True: 7.77k, False: 6.07k]
  ------------------
  389|  7.77k|        err = pn_data_put_binary(data, bytes);
  390|  7.77k|        break;
  391|  1.82k|      case 0x1:
  ------------------
  |  Branch (391:7): [True: 1.82k, False: 12.0k]
  ------------------
  392|  1.82k|        err = pn_data_put_string(data, bytes);
  393|  1.82k|        break;
  394|  4.24k|      case 0x3:
  ------------------
  |  Branch (394:7): [True: 4.24k, False: 9.60k]
  ------------------
  395|  4.24k|        err = pn_data_put_symbol(data, bytes);
  396|  4.24k|        break;
  397|      0|      default:
  ------------------
  |  Branch (397:7): [True: 0, False: 13.8k]
  ------------------
  398|      0|        return pn_error_format(pn_data_error(data), PN_ARG_ERR, "unrecognized variable-width typecode: %u", code);
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  399|  13.8k|      }
  400|  13.8k|    }
  401|       |
  402|  13.8k|    decoder->position += size;
  403|  13.8k|    break;
  404|   421k|  case PNE_LIST0:
  ------------------
  |  |   38|   421k|#define PNE_LIST0           (0x45)
  ------------------
  |  Branch (404:3): [True: 421k, False: 5.78M]
  ------------------
  405|   421k|    err = pn_data_put_list(data);
  406|   421k|    break;
  407|  1.49k|  default:
  ------------------
  |  Branch (407:3): [True: 1.49k, False: 6.20M]
  ------------------
  408|  1.49k|    return pn_error_format(pn_data_error(data), PN_ARG_ERR, "unrecognized typecode: %u", code);
  ------------------
  |  |   53|  1.49k|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  409|  6.20M|  }
  410|       |
  411|  6.20M|  return err;
  412|  6.20M|}
decoder.c:pn_decoder_readf16:
   64|  1.08k|{
   65|  1.08k|  uint16_t a = (uint8_t) decoder->position[0];
   66|  1.08k|  uint16_t b = (uint8_t) decoder->position[1];
   67|  1.08k|  uint16_t r = a << 8
   68|  1.08k|    | b;
   69|  1.08k|  decoder->position += 2;
   70|  1.08k|  return r;
   71|  1.08k|}
decoder.c:pn_decoder_readf64:
   88|  1.06k|{
   89|  1.06k|  uint64_t a = pn_decoder_readf32(decoder);
   90|  1.06k|  uint64_t b = pn_decoder_readf32(decoder);
   91|  1.06k|  return a << 32 | b;
   92|  1.06k|}
decoder.c:pn_decoder_readf128:
   95|    398|{
   96|    398|  memmove(dst, decoder->position, 16);
   97|    398|  decoder->position += 16;
   98|    398|}

pni_bad_frame:
   32|    113|int pni_bad_frame(pn_transport_t *transport, uint8_t frame_type, uint16_t channel, pn_bytes_t payload) {
   33|    113|  PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "Error dispatching frame: type: %u: Unknown performative", frame_type);
  ------------------
  |  |   57|    113|    do { \
  |  |   58|    113|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   54|    113|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:6): [Folded, False: 113]
  |  |  |  |  |  Branch (54:38): [True: 113, False: 0]
  |  |  |  |  |  Branch (54:73): [True: 0, False: 113]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|    113|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   60|    113|    } while(0)
  |  |  ------------------
  |  |  |  Branch (60:13): [Folded, False: 113]
  |  |  ------------------
  ------------------
   34|    113|  return PN_ERR;
  ------------------
  |  |   49|    113|#define PN_ERR (-2)            /**< General error */
  ------------------
   35|    113|}
pn_dispatcher_amqp_input:
  123|  80.8k|{
  124|  80.8k|  size_t read = 0;
  125|       |
  126|  3.46M|  while (available && !*halt) {
  ------------------
  |  Branch (126:10): [True: 3.45M, False: 15.9k]
  |  Branch (126:23): [True: 3.45M, False: 0]
  ------------------
  127|  3.45M|    pn_frame_t frame;
  128|       |
  129|  3.45M|    ssize_t n = pn_read_frame(&frame, bytes + read, available, transport->local_max_frame, &transport->logger);
  130|  3.45M|    if (n > 0) {
  ------------------
  |  Branch (130:9): [True: 3.39M, False: 59.6k]
  ------------------
  131|  3.39M|      read += n;
  132|  3.39M|      available -= n;
  133|  3.39M|      transport->input_frames_ct += 1;
  134|  3.39M|      int e = pni_dispatch_amqp_frame(frame, &transport->logger, transport);
  135|  3.39M|      if (e) return e;
  ------------------
  |  Branch (135:11): [True: 5.22k, False: 3.38M]
  ------------------
  136|  3.39M|    } else if (n < 0) {
  ------------------
  |  Branch (136:16): [True: 4.71k, False: 54.9k]
  ------------------
  137|  4.71k|      pn_do_error(transport, "amqp:connection:framing-error", "malformed frame");
  138|  4.71k|      return n;
  139|  54.9k|    } else {
  140|  54.9k|      break;
  141|  54.9k|    }
  142|  3.45M|  }
  143|       |
  144|  70.9k|  return read;
  145|  80.8k|}
pn_dispatcher_output:
  171|   309k|{
  172|   309k|    int n = pn_buffer_get(transport->output_buffer, 0, size, bytes);
  173|   309k|    pn_buffer_trim(transport->output_buffer, n, 0);
  174|       |    // XXX: need to check for errors
  175|   309k|    return n;
  176|   309k|}
dispatcher.c:pni_dispatch_amqp_frame:
   87|  3.39M|{
   88|  3.39M|  pn_bytes_t frame_payload = frame.frame_payload0;
   89|       |
   90|  3.39M|  if (frame_payload.size == 0) { // ignore null frames
  ------------------
  |  Branch (90:7): [True: 3.11k, False: 3.39M]
  ------------------
   91|  3.11k|    return PN_OK;
  ------------------
  |  |   47|  3.11k|#define PN_OK (0)              /**< No error */
  ------------------
   92|  3.11k|  }
   93|       |
   94|  3.39M|  uint64_t lcode;
   95|  3.39M|  int err = pni_performative_code(frame_payload, &lcode);
   96|  3.39M|  if (err != PN_OK) {
  ------------------
  |  |   47|  3.39M|#define PN_OK (0)              /**< No error */
  ------------------
  |  Branch (96:7): [True: 1.51k, False: 3.38M]
  ------------------
   97|  1.51k|    PN_LOG(logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "Error dispatching frame");
  ------------------
  |  |   57|  1.51k|    do { \
  |  |   58|  1.51k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   54|  1.51k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:6): [Folded, False: 1.51k]
  |  |  |  |  |  Branch (54:38): [True: 1.51k, False: 0]
  |  |  |  |  |  Branch (54:73): [True: 0, False: 1.51k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|  1.51k|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   60|  1.51k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (60:13): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
   98|  1.51k|    return err;
   99|  1.51k|  }
  100|       |
  101|  3.38M|  return pni_dispatch_amqp_action(transport, lcode, frame.channel, frame_payload);
  102|  3.39M|}
dispatcher.c:pni_performative_code:
   75|  3.39M|{
   76|  3.39M|  pni_consumer_t consumer = make_consumer_from_bytes(frame_payload);
   77|  3.39M|  pni_consumer_t subconsumer;
   78|  3.39M|  if (!consume_described_ulong_descriptor(&consumer, &subconsumer, lcode)
  ------------------
  |  Branch (78:7): [True: 1.41k, False: 3.38M]
  ------------------
   79|  3.38M|      || !pni_islist(&subconsumer)
  ------------------
  |  Branch (79:10): [True: 101, False: 3.38M]
  ------------------
   80|  3.39M|  ) {
   81|  1.51k|    return PN_ERR;
  ------------------
  |  |   49|  1.51k|#define PN_ERR (-2)            /**< General error */
  ------------------
   82|  1.51k|  }
   83|  3.38M|  return PN_OK;
  ------------------
  |  |   47|  3.38M|#define PN_OK (0)              /**< No error */
  ------------------
   84|  3.39M|}
dispatcher.c:pni_dispatch_amqp_action:
   43|  3.38M|{
   44|  3.38M|  pn_action_t *action;
   45|  3.38M|  switch (lcode) {
   46|   272k|  case AMQP_DESC_OPEN:            action = pn_do_open; break;
  ------------------
  |  |  145|   272k|#define AMQP_DESC_OPEN ((uint64_t) 16)
  ------------------
  |  Branch (46:3): [True: 272k, False: 3.11M]
  ------------------
   47|  1.28M|  case AMQP_DESC_BEGIN:           action = pn_do_begin; break;
  ------------------
  |  |  147|  1.28M|#define AMQP_DESC_BEGIN ((uint64_t) 17)
  ------------------
  |  Branch (47:3): [True: 1.28M, False: 2.10M]
  ------------------
   48|  1.38M|  case AMQP_DESC_ATTACH:          action = pn_do_attach; break;
  ------------------
  |  |  149|  1.38M|#define AMQP_DESC_ATTACH ((uint64_t) 18)
  ------------------
  |  Branch (48:3): [True: 1.38M, False: 2.00M]
  ------------------
   49|  28.1k|  case AMQP_DESC_FLOW:            action = pn_do_flow; break;
  ------------------
  |  |  151|  28.1k|#define AMQP_DESC_FLOW ((uint64_t) 19)
  ------------------
  |  Branch (49:3): [True: 28.1k, False: 3.36M]
  ------------------
   50|   153k|  case AMQP_DESC_TRANSFER:        action = pn_do_transfer; break;
  ------------------
  |  |  153|   153k|#define AMQP_DESC_TRANSFER ((uint64_t) 20)
  ------------------
  |  Branch (50:3): [True: 153k, False: 3.23M]
  ------------------
   51|  34.3k|  case AMQP_DESC_DISPOSITION:     action = pn_do_disposition; break;
  ------------------
  |  |  155|  34.3k|#define AMQP_DESC_DISPOSITION ((uint64_t) 21)
  ------------------
  |  Branch (51:3): [True: 34.3k, False: 3.35M]
  ------------------
   52|   137k|  case AMQP_DESC_DETACH:          action = pn_do_detach; break;
  ------------------
  |  |  157|   137k|#define AMQP_DESC_DETACH ((uint64_t) 22)
  ------------------
  |  Branch (52:3): [True: 137k, False: 3.25M]
  ------------------
   53|  89.7k|  case AMQP_DESC_END:             action = pn_do_end; break;
  ------------------
  |  |  159|  89.7k|#define AMQP_DESC_END ((uint64_t) 23)
  ------------------
  |  Branch (53:3): [True: 89.7k, False: 3.29M]
  ------------------
   54|  9.28k|  case AMQP_DESC_CLOSE:           action = pn_do_close; break;
  ------------------
  |  |  161|  9.28k|#define AMQP_DESC_CLOSE ((uint64_t) 24)
  ------------------
  |  Branch (54:3): [True: 9.28k, False: 3.37M]
  ------------------
   55|    113|  default:                        action = pni_bad_frame; break;
  ------------------
  |  Branch (55:3): [True: 113, False: 3.38M]
  ------------------
   56|  3.38M|  };
   57|  3.38M|  return action(transport, AMQP_FRAME_TYPE, channel, frame_payload);
  ------------------
  |  |   38|  3.38M|#define AMQP_FRAME_TYPE (0)
  ------------------
   58|  3.38M|}

frame_generators.c:make_compound:
   49|   167k|static inline pni_compound_context make_compound(void) {
   50|   167k|  return (pni_compound_context){
   51|   167k|    .count = 0
   52|   167k|  };
   53|   167k|}
frame_generators.c:emit_descriptor:
  254|   265k|static inline void emit_descriptor(pni_emitter_t* emitter, pni_compound_context* compound, uint64_t ulong) {
  255|   265k|  emit_accumulated_nulls(emitter, compound);
  256|   265k|  pni_emitter_writef8(emitter, PNE_DESCRIPTOR);
  ------------------
  |  |    5|   265k|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  257|   265k|  if (ulong < 256) {
  ------------------
  |  Branch (257:7): [True: 265k, False: 0]
  ------------------
  258|   265k|    pni_emitter_writef8(emitter, PNE_SMALLULONG);
  ------------------
  |  |   16|   265k|#define PNE_SMALLULONG      (0x53)
  ------------------
  259|   265k|    pni_emitter_writef8(emitter, ulong);
  260|   265k|  } else {
  261|      0|    pni_emitter_writef8(emitter, PNE_ULONG);
  ------------------
  |  |   15|      0|#define PNE_ULONG           (0x80)
  ------------------
  262|      0|    pni_emitter_writef64(emitter, ulong);
  263|      0|  }
  264|   265k|}
frame_generators.c:emit_accumulated_nulls:
  180|  1.52M|static inline void emit_accumulated_nulls(pni_emitter_t* emitter, pni_compound_context* compound) {
  181|  1.87M|  for (uint32_t i=compound->null_count; i>0; --i) {
  ------------------
  |  Branch (181:41): [True: 350k, False: 1.52M]
  ------------------
  182|   350k|    pni_emitter_writef8(emitter, PNE_NULL);
  ------------------
  |  |    6|   350k|#define PNE_NULL            (0x40)
  ------------------
  183|   350k|    compound->count++;
  184|   350k|  }
  185|  1.52M|  compound->null_count = 0;
  186|  1.52M|}
frame_generators.c:pni_emitter_writef8:
   98|  3.68M|{
   99|  3.68M|  if (pni_emitter_remaining(emitter, 1)) {
  ------------------
  |  Branch (99:7): [True: 3.68M, False: 0]
  ------------------
  100|  3.68M|    emitter->output_start[emitter->position+0] = value;
  101|  3.68M|  }
  102|  3.68M|  emitter->position++;
  103|  3.68M|}
frame_generators.c:pni_emitter_remaining:
   93|  4.04M|static inline bool pni_emitter_remaining(pni_emitter_t* e, size_t need) {
   94|  4.04M|  return (e->size >= e->position+need);
   95|  4.04M|}
frame_generators.c:emit_list:
  266|   265k|static inline pni_compound_context emit_list(pni_emitter_t* emitter, pni_compound_context* compound, bool small_encoding, bool is_described_list) {
  267|   265k|  emit_accumulated_nulls(emitter, compound);
  268|   265k|  if (small_encoding) {
  ------------------
  |  Branch (268:7): [True: 265k, False: 464]
  ------------------
  269|   265k|    pni_emitter_writef8(emitter, PNE_LIST8);
  ------------------
  |  |   39|   265k|#define PNE_LIST8           (0xc0)
  ------------------
  270|       |    // Need to fill in size and count later
  271|   265k|    size_t size_position = emitter->position;
  272|   265k|    pni_emitter_writef8(emitter, 0);
  273|   265k|    size_t start_position = emitter->position;
  274|   265k|    pni_emitter_writef8(emitter, 0);
  275|   265k|    return (pni_compound_context){
  276|   265k|      .previous_compound = compound,
  277|   265k|      .size_position = size_position,
  278|   265k|      .start_position = start_position,
  279|   265k|      .count = 0,
  280|   265k|      .null_count = 0,
  281|   265k|      .is_described_list = is_described_list,
  282|   265k|    };
  283|   265k|  } else {
  284|    464|    pni_emitter_writef8(emitter, PNE_LIST32);
  ------------------
  |  |   40|    464|#define PNE_LIST32          (0xd0)
  ------------------
  285|       |    // Need to fill in size and count later
  286|    464|    size_t size_position = emitter->position;
  287|    464|    pni_emitter_writef32(emitter, 0);
  288|    464|    size_t start_position = emitter->position;
  289|    464|    pni_emitter_writef32(emitter, 0);
  290|    464|    return (pni_compound_context){
  291|    464|      .previous_compound = compound,
  292|    464|      .size_position = size_position,
  293|    464|      .start_position = start_position,
  294|    464|      .count = 0,
  295|    464|      .null_count = 0,
  296|    464|      .is_described_list = is_described_list,
  297|    464|    };
  298|    464|  }
  299|   265k|}
frame_generators.c:pni_emitter_writef32:
  115|   210k|{
  116|   210k|  if (pni_emitter_remaining(emitter, 4)) {
  ------------------
  |  Branch (116:7): [True: 210k, False: 0]
  ------------------
  117|   210k|    emitter->output_start[emitter->position+0] = 0xFF & (value >> 24);
  118|   210k|    emitter->output_start[emitter->position+1] = 0xFF & (value >> 16);
  119|   210k|    emitter->output_start[emitter->position+2] = 0xFF & (value >>  8);
  120|   210k|    emitter->output_start[emitter->position+3] = 0xFF & (value      );
  121|   210k|  }
  122|   210k|  emitter->position += 4;
  123|   210k|}
frame_generators.c:emit_string:
  432|   173k|static inline void emit_string(pni_emitter_t* emitter, pni_compound_context* compound,  pn_bytes_t bytes) {
  433|   173k|  if (bytes.start == NULL) {
  ------------------
  |  Branch (433:7): [True: 103k, False: 69.2k]
  ------------------
  434|   103k|    emit_null(emitter, compound);
  435|   103k|  } else {
  436|  69.2k|    emit_string_bytes(emitter, compound, bytes);
  437|  69.2k|  }
  438|   173k|}
frame_generators.c:emit_string_bytes:
  400|  93.1k|static inline void emit_string_bytes(pni_emitter_t* emitter, pni_compound_context* compound, pn_bytes_t bytes) {
  401|  93.1k|  emit_accumulated_nulls(emitter, compound);
  402|  93.1k|  if (bytes.size < 256) {
  ------------------
  |  Branch (402:7): [True: 92.5k, False: 584]
  ------------------
  403|  92.5k|    pni_emitter_writef8(emitter, PNE_STR8_UTF8);
  ------------------
  |  |   34|  92.5k|#define PNE_STR8_UTF8       (0xa1)
  ------------------
  404|  92.5k|    pni_emitter_writev8(emitter, bytes);
  405|  92.5k|  } else {
  406|    584|    pni_emitter_writef8(emitter, PNE_STR32_UTF8);
  ------------------
  |  |   35|    584|#define PNE_STR32_UTF8      (0xb1)
  ------------------
  407|    584|    pni_emitter_writev32(emitter, bytes);
  408|    584|  }
  409|  93.1k|  compound->count++;
  410|  93.1k|}
frame_generators.c:pni_emitter_writev8:
  147|   116k|{
  148|   116k|  pni_emitter_writef8(emitter, value.size);
  149|   116k|  if (pni_emitter_remaining(emitter, value.size))
  ------------------
  |  Branch (149:7): [True: 116k, False: 0]
  ------------------
  150|   116k|    memcpy(emitter->output_start+emitter->position, value.start, value.size);
  151|   116k|  emitter->position += value.size;
  152|   116k|}
frame_generators.c:pni_emitter_writev32:
  155|    584|{
  156|    584|  pni_emitter_writef32(emitter, value.size);
  157|    584|  if (pni_emitter_remaining(emitter, value.size))
  ------------------
  |  Branch (157:7): [True: 319, False: 265]
  ------------------
  158|    319|    memcpy(emitter->output_start+emitter->position, value.start, value.size);
  159|    584|  emitter->position += value.size;
  160|    584|}
frame_generators.c:emit_uint:
  212|   593k|static inline void emit_uint(pni_emitter_t* emitter, pni_compound_context* compound, uint32_t uint) {
  213|   593k|  emit_accumulated_nulls(emitter, compound);
  214|   593k|  if (uint == 0) {
  ------------------
  |  Branch (214:7): [True: 350k, False: 243k]
  ------------------
  215|   350k|    pni_emitter_writef8(emitter, PNE_UINT0);
  ------------------
  |  |   14|   350k|#define PNE_UINT0           (0x43)
  ------------------
  216|   350k|  } else if (uint < 256) {
  ------------------
  |  Branch (216:14): [True: 35.0k, False: 208k]
  ------------------
  217|  35.0k|    pni_emitter_writef8(emitter, PNE_SMALLUINT);
  ------------------
  |  |   13|  35.0k|#define PNE_SMALLUINT       (0x52)
  ------------------
  218|  35.0k|    pni_emitter_writef8(emitter, uint);
  219|   208k|  } else {
  220|   208k|    pni_emitter_writef8(emitter, PNE_UINT);
  ------------------
  |  |   12|   208k|#define PNE_UINT            (0x70)
  ------------------
  221|   208k|    pni_emitter_writef32(emitter, uint);
  222|   208k|  }
  223|   593k|  compound->count++;
  224|   593k|}
frame_generators.c:emit_bool:
  188|   148k|static inline void emit_bool(pni_emitter_t* emitter, pni_compound_context* compound, bool b) {
  189|   148k|  emit_accumulated_nulls(emitter, compound);
  190|   148k|  if (b) {
  ------------------
  |  Branch (190:7): [True: 44.1k, False: 103k]
  ------------------
  191|  44.1k|    pni_emitter_writef8(emitter, PNE_TRUE);
  ------------------
  |  |    8|  44.1k|#define PNE_TRUE            (0x41)
  ------------------
  192|   103k|  } else {
  193|   103k|    pni_emitter_writef8(emitter, PNE_FALSE);
  ------------------
  |  |    9|   103k|#define PNE_FALSE           (0x42)
  ------------------
  194|   103k|  }
  195|   148k|  compound->count++;
  196|   148k|}
frame_generators.c:emit_ubyte:
  198|  69.2k|static inline void emit_ubyte(pni_emitter_t* emitter, pni_compound_context* compound, uint8_t ubyte) {
  199|  69.2k|  emit_accumulated_nulls(emitter, compound);
  200|  69.2k|  pni_emitter_writef8(emitter, PNE_UBYTE);
  ------------------
  |  |   10|  69.2k|#define PNE_UBYTE           (0x50)
  ------------------
  201|  69.2k|  pni_emitter_writef8(emitter, ubyte);
  202|  69.2k|  compound->count++;
  203|  69.2k|}
frame_generators.c:emit_symbol:
  424|  69.2k|static inline void emit_symbol(pni_emitter_t* emitter, pni_compound_context* compound, pn_bytes_t bytes) {
  425|  69.2k|  if (bytes.start == NULL) {
  ------------------
  |  Branch (425:7): [True: 69.2k, False: 0]
  ------------------
  426|  69.2k|    emit_null(emitter, compound);
  427|  69.2k|  } else {
  428|      0|    emit_symbol_bytes(emitter, compound, bytes);
  429|      0|  }
  430|  69.2k|}
frame_generators.c:emit_symbol_bytes:
  412|  23.8k|static inline void emit_symbol_bytes(pni_emitter_t* emitter, pni_compound_context* compound, pn_bytes_t bytes) {
  413|  23.8k|  emit_accumulated_nulls(emitter, compound);
  414|  23.8k|  if (bytes.size < 256) {
  ------------------
  |  Branch (414:7): [True: 23.8k, False: 0]
  ------------------
  415|  23.8k|    pni_emitter_writef8(emitter, PNE_SYM8);
  ------------------
  |  |   36|  23.8k|#define PNE_SYM8            (0xa3)
  ------------------
  416|  23.8k|    pni_emitter_writev8(emitter, bytes);
  417|  23.8k|  } else {
  418|      0|    pni_emitter_writef8(emitter, PNE_SYM32);
  ------------------
  |  |   37|      0|#define PNE_SYM32           (0xb3)
  ------------------
  419|      0|    pni_emitter_writev32(emitter, bytes);
  420|      0|  }
  421|  23.8k|  compound->count++;
  422|  23.8k|}
frame_generators.c:emit_raw:
  550|   370k|static inline void emit_raw(pni_emitter_t* emitter, pni_compound_context* compound, const pn_bytes_t bytes) {
  551|   370k|  if (bytes.size==0 || bytes.start == 0) {
  ------------------
  |  Branch (551:7): [True: 370k, False: 0]
  |  Branch (551:24): [True: 0, False: 0]
  ------------------
  552|   370k|    emit_null(emitter, compound);
  553|   370k|    return;
  554|   370k|  }
  555|       |
  556|      0|  emit_accumulated_nulls(emitter, compound);
  557|      0|  pni_emitter_raw(emitter, bytes);
  558|      0|  compound->count++;
  559|      0|}
frame_generators.c:emit_null:
  171|   963k|static inline void emit_null(pni_emitter_t* emitter, pni_compound_context* compound) {
  172|   963k|  if (compound->is_described_list) {
  ------------------
  |  Branch (172:7): [True: 963k, False: 0]
  ------------------
  173|   963k|    compound->null_count++;
  174|   963k|    return;
  175|   963k|  }
  176|      0|  pni_emitter_writef8(emitter, PNE_NULL);
  ------------------
  |  |    6|      0|#define PNE_NULL            (0x40)
  ------------------
  177|      0|  compound->count++;
  178|      0|}
frame_generators.c:emit_multiple:
  562|   173k|static inline void emit_multiple(pni_emitter_t* emitter, pni_compound_context* compound, const pn_bytes_t bytes) {
  563|   173k|  emit_raw(emitter, compound, bytes);
  564|   173k|}
frame_generators.c:emit_end_list:
  301|   265k|static inline void emit_end_list(pni_emitter_t* emitter, pni_compound_context* compound, bool small_encoding) {
  302|       |  // Check if list was 0 length
  303|   265k|  if (compound->count==0) {
  ------------------
  |  Branch (303:7): [True: 5.74k, False: 259k]
  ------------------
  304|  5.74k|    emitter->position = compound->size_position - 1;
  305|  5.74k|    pni_emitter_writef8(emitter, PNE_LIST0);
  ------------------
  |  |   38|  5.74k|#define PNE_LIST0           (0x45)
  ------------------
  306|  5.74k|    compound->previous_compound->count++;
  307|  5.74k|    compound->encoding_succeeded = true;
  308|  5.74k|    return;
  309|  5.74k|  }
  310|       |  // Fill in size and count
  311|   259k|  size_t current = emitter->position;
  312|   259k|  emitter->position = compound->size_position;
  313|   259k|  size_t size = current-compound->start_position;
  314|   259k|  if (small_encoding) {
  ------------------
  |  Branch (314:7): [True: 259k, False: 464]
  ------------------
  315|   259k|    if (size>255 || compound->count>255) {
  ------------------
  |  Branch (315:9): [True: 464, False: 259k]
  |  Branch (315:21): [True: 0, False: 259k]
  ------------------
  316|    464|      compound->encoding_succeeded = false;
  317|    464|      emitter->position -= 1;
  318|    464|      return;
  319|    464|    }
  320|   259k|    pni_emitter_writef8(emitter, size);
  321|   259k|    pni_emitter_writef8(emitter, compound->count);
  322|   259k|  } else {
  323|    464|    pni_emitter_writef32(emitter, size);
  324|    464|    pni_emitter_writef32(emitter, compound->count);
  325|    464|  }
  326|   259k|  emitter->position = current;
  327|   259k|  compound->previous_compound->count++;
  328|       |  compound->encoding_succeeded = true;
  329|   259k|}
frame_generators.c:encode_succeeded:
   89|   265k|static inline bool encode_succeeded(pni_emitter_t* emitter, pni_compound_context* compound) {
   90|   265k|  return compound->encoding_succeeded;
   91|   265k|}
frame_generators.c:emit_ulong:
  226|  34.6k|static inline void emit_ulong(pni_emitter_t* emitter, pni_compound_context* compound, uint64_t ulong) {
  227|  34.6k|  emit_accumulated_nulls(emitter, compound);
  228|  34.6k|  if (ulong == 0) {
  ------------------
  |  Branch (228:7): [True: 34.6k, False: 0]
  ------------------
  229|  34.6k|    pni_emitter_writef8(emitter, PNE_ULONG0);
  ------------------
  |  |   17|  34.6k|#define PNE_ULONG0          (0x44)
  ------------------
  230|  34.6k|  } else if (ulong < 256) {
  ------------------
  |  Branch (230:14): [True: 0, False: 0]
  ------------------
  231|      0|    pni_emitter_writef8(emitter, PNE_SMALLULONG);
  ------------------
  |  |   16|      0|#define PNE_SMALLULONG      (0x53)
  ------------------
  232|      0|    pni_emitter_writef8(emitter, ulong);
  233|      0|  } else {
  234|      0|    pni_emitter_writef8(emitter, PNE_ULONG);
  ------------------
  |  |   15|      0|#define PNE_ULONG           (0x80)
  ------------------
  235|      0|    pni_emitter_writef64(emitter, ulong);
  236|      0|  }
  237|  34.6k|  compound->count++;
  238|  34.6k|}
frame_generators.c:resize_required:
   81|   167k|static inline bool resize_required(pni_emitter_t* emitter) {
   82|   167k|  return emitter->position > emitter->size;
   83|   167k|}
frame_generators.c:make_emitter_from_rwbytes:
   61|   167k|static inline pni_emitter_t make_emitter_from_rwbytes(pn_rwbytes_t* output_bytes) {
   62|   167k|  return (pni_emitter_t){
   63|   167k|    .output_start = output_bytes->start,
   64|   167k|    .size = output_bytes->size,
   65|   167k|    .position = 0
   66|   167k|  };
   67|   167k|}
frame_generators.c:size_buffer_to_emitter:
   85|     68|static inline void size_buffer_to_emitter(pn_rwbytes_t* buffer, pni_emitter_t* emitter) {
   86|     68|  pn_rwbytes_realloc(buffer, buffer->size+emitter->position-emitter->size);
   87|     68|}
frame_generators.c:make_bytes_from_emitter:
   77|   167k|static inline pn_bytes_t make_bytes_from_emitter(pni_emitter_t emitter) {
   78|   167k|    return (pn_bytes_t){.size = emitter.position, .start = emitter.output_start};
   79|   167k|}
frame_generators.c:emit_ushort:
  205|  34.6k|static inline void emit_ushort(pni_emitter_t* emitter, pni_compound_context* compound, uint16_t ushort) {
  206|  34.6k|  emit_accumulated_nulls(emitter, compound);
  207|  34.6k|  pni_emitter_writef8(emitter, PNE_USHORT);
  ------------------
  |  |   11|  34.6k|#define PNE_USHORT          (0x60)
  ------------------
  208|  34.6k|  pni_emitter_writef16(emitter, ushort);
  209|  34.6k|  compound->count++;
  210|  34.6k|}
frame_generators.c:pni_emitter_writef16:
  106|  34.6k|{
  107|  34.6k|  if (pni_emitter_remaining(emitter, 2)) {
  ------------------
  |  Branch (107:7): [True: 34.6k, False: 0]
  ------------------
  108|  34.6k|    emitter->output_start[emitter->position+0] = 0xFF & (value >> 8);
  109|  34.6k|    emitter->output_start[emitter->position+1] = 0xFF & (value     );
  110|  34.6k|  }
  111|  34.6k|  emitter->position += 2;
  112|  34.6k|}
frame_generators.c:emit_condition:
  589|  24.5k|static inline void emit_condition(pni_emitter_t* emitter, pni_compound_context* compound0, pn_condition_t* condition) {
  590|  24.5k|  if (!condition || !condition->name || !pn_string_get(condition->name)) {
  ------------------
  |  Branch (590:7): [True: 0, False: 24.5k]
  |  Branch (590:21): [True: 981, False: 23.5k]
  |  Branch (590:41): [True: 0, False: 23.5k]
  ------------------
  591|    981|    emit_null(emitter, compound0);
  592|    981|    return;
  593|    981|  }
  594|       |
  595|  23.5k|  emit_descriptor(emitter, compound0, AMQP_DESC_ERROR);
  ------------------
  |  |  163|  23.5k|#define AMQP_DESC_ERROR ((uint64_t) 29)
  ------------------
  596|  23.8k|  for (bool small_encoding = true; ; small_encoding = false) {
  597|  23.8k|    pni_compound_context c = emit_list(emitter, compound0, small_encoding, true);
  598|  23.8k|    pni_compound_context compound = c;
  599|  23.8k|    pn_bytes_t name_bytes = pn_string_bytes(condition->name);
  600|  23.8k|    if (name_bytes.size==0) {
  ------------------
  |  Branch (600:9): [True: 0, False: 23.8k]
  ------------------
  601|      0|      emit_null(emitter, &compound);
  602|  23.8k|    } else {
  603|  23.8k|      emit_symbol_bytes(emitter, &compound, name_bytes);
  604|  23.8k|    }
  605|  23.8k|    pn_bytes_t description_bytes = pn_string_bytes(condition->description);
  606|  23.8k|    if (description_bytes.size==0) {
  ------------------
  |  Branch (606:9): [True: 0, False: 23.8k]
  ------------------
  607|      0|      emit_null(emitter, &compound);
  608|  23.8k|    } else {
  609|  23.8k|      emit_string_bytes(emitter, &compound, description_bytes);
  610|  23.8k|    }
  611|  23.8k|    emit_copy_or_raw(emitter, &compound, condition->info, condition->info_raw);
  612|  23.8k|    emit_end_list(emitter, &compound, small_encoding);
  613|  23.8k|    if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (613:9): [True: 23.5k, False: 308]
  ------------------
  614|  23.8k|  }
  615|  23.5k|}
frame_generators.c:emit_copy_or_raw:
  575|  23.8k|{
  576|  23.8k|  if (data) {
  ------------------
  |  Branch (576:7): [True: 0, False: 23.8k]
  ------------------
  577|      0|    emit_copy(emitter, compound, data);
  578|  23.8k|  } else {
  579|  23.8k|    emit_raw(emitter, compound, raw);
  580|  23.8k|  }
  581|  23.8k|}

pn_connection_reset:
  117|  34.6k|{
  118|  34.6k|  assert(connection);
  119|  34.6k|  pn_endpoint_t *endpoint = &connection->endpoint;
  120|  34.6k|  endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
  ------------------
  |  |   50|  34.6k|#define PN_LOCAL_UNINIT (1)
  ------------------
                endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
  ------------------
  |  |   65|  34.6k|#define PN_REMOTE_UNINIT (8)
  ------------------
  121|  34.6k|}
pn_connection_open:
  124|  34.6k|{
  125|       |  assert(connection);
  126|  34.6k|  pn_endpoint_open(&connection->endpoint);
  127|  34.6k|}
pn_connection_close:
  130|   235k|{
  131|       |  assert(connection);
  132|   235k|  pn_endpoint_close(&connection->endpoint);
  133|   235k|}
pn_connection_release:
  138|  34.6k|{
  139|  34.6k|  assert(!connection->endpoint.freed);
  140|       |  // free those endpoints that haven't been freed by the application
  141|  34.6k|  LL_REMOVE(connection, endpoint, &connection->endpoint);
  ------------------
  |  |  261|  34.6k|  {                                                                    \
  |  |  262|  34.6k|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (262:9): [True: 0, False: 34.6k]
  |  |  ------------------
  |  |  263|  34.6k|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  264|  34.6k|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (264:9): [True: 34.6k, False: 0]
  |  |  ------------------
  |  |  265|  34.6k|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  266|  34.6k|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  234|  34.6k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (266:9): [True: 34.6k, False: 0]
  |  |  ------------------
  |  |  267|  34.6k|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  234|  34.6k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  268|  34.6k|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  235|  34.6k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (268:9): [True: 0, False: 34.6k]
  |  |  ------------------
  |  |  269|  34.6k|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  235|      0|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  270|  34.6k|  }
  ------------------
  142|  1.33M|  while (connection->endpoint_head) {
  ------------------
  |  Branch (142:10): [True: 1.29M, False: 34.6k]
  ------------------
  143|  1.29M|    pn_endpoint_t *ep = connection->endpoint_head;
  144|  1.29M|    switch (ep->type) {
  145|  1.29M|    case SESSION:
  ------------------
  |  Branch (145:5): [True: 1.29M, False: 0]
  ------------------
  146|       |      // note: this will free all child links:
  147|  1.29M|      pn_session_free((pn_session_t *)ep);
  148|  1.29M|      break;
  149|      0|    case SENDER:
  ------------------
  |  Branch (149:5): [True: 0, False: 1.29M]
  ------------------
  150|      0|    case RECEIVER:
  ------------------
  |  Branch (150:5): [True: 0, False: 1.29M]
  ------------------
  151|      0|      pn_link_free((pn_link_t *)ep);
  152|      0|      break;
  153|      0|    default:
  ------------------
  |  Branch (153:5): [True: 0, False: 1.29M]
  ------------------
  154|      0|      assert(false);
  155|  1.29M|    }
  156|  1.29M|  }
  157|  34.6k|  connection->endpoint.freed = true;
  158|  34.6k|  if (!connection->transport) {
  ------------------
  |  Branch (158:7): [True: 34.6k, False: 0]
  ------------------
  159|       |    // no transport available to consume transport work items,
  160|       |    // so manually clear them:
  161|  34.6k|    pn_ep_incref(&connection->endpoint);
  162|  34.6k|    pn_connection_unbound(connection);
  163|  34.6k|  }
  164|  34.6k|  pn_ep_decref(&connection->endpoint);
  165|  34.6k|}
pn_connection_free:
  167|  34.6k|void pn_connection_free(pn_connection_t *connection) {
  168|  34.6k|  pn_connection_release(connection);
  169|  34.6k|  pn_decref(connection);
  170|  34.6k|}
pn_connection_bound:
  173|  34.6k|{
  174|  34.6k|  pn_collector_put_object(connection->collector, connection, PN_CONNECTION_BOUND);
  175|  34.6k|  pn_ep_incref(&connection->endpoint);
  176|       |
  177|  34.6k|  size_t nsessions = pn_list_size(connection->sessions);
  178|  69.2k|  for (size_t i = 0; i < nsessions; i++) {
  ------------------
  |  Branch (178:22): [True: 34.6k, False: 34.6k]
  ------------------
  179|  34.6k|    pni_session_bound((pn_session_t *) pn_list_get(connection->sessions, i));
  180|  34.6k|  }
  181|  34.6k|}
pn_connection_unbound:
  185|  69.2k|{
  186|  69.2k|  connection->transport = NULL;
  187|  69.2k|  if (connection->endpoint.freed) {
  ------------------
  |  Branch (187:7): [True: 34.6k, False: 34.6k]
  ------------------
  188|       |    // connection has been freed prior to unbinding, thus it
  189|       |    // cannot be re-assigned to a new transport.  Clear the
  190|       |    // transport work lists to allow the connection to be freed.
  191|  69.2k|    while (connection->transport_head) {
  ------------------
  |  Branch (191:12): [True: 34.6k, False: 34.6k]
  ------------------
  192|  34.6k|        pn_clear_modified(connection, connection->transport_head);
  193|  34.6k|    }
  194|  34.6k|    while (connection->tpwork_head) {
  ------------------
  |  Branch (194:12): [True: 0, False: 34.6k]
  ------------------
  195|      0|      pn_clear_tpwork(connection->tpwork_head);
  196|      0|    }
  197|  34.6k|  }
  198|  69.2k|  pn_ep_decref(&connection->endpoint);
  199|  69.2k|}
pn_condition_init:
  227|  5.56M|{
  228|  5.56M|  condition->info_raw = (pn_bytes_t){0, NULL};
  229|  5.56M|  condition->name = NULL;
  230|  5.56M|  condition->description = NULL;
  231|       |  condition->info = NULL;
  232|  5.56M|}
pn_condition_tini:
  241|  5.57M|{
  242|  5.57M|  pn_bytes_free(condition->info_raw);
  243|  5.57M|  pn_data_free(condition->info);
  244|  5.57M|  pn_free(condition->description);
  245|  5.57M|  pn_free(condition->name);
  246|  5.57M|}
pn_session_connection:
  273|   225k|{
  274|   225k|  if (!session) return NULL;
  ------------------
  |  Branch (274:7): [True: 0, False: 225k]
  ------------------
  275|   225k|  return session->connection;
  276|   225k|}
pn_session_open:
  279|  34.6k|{
  280|       |  assert(session);
  281|  34.6k|  pn_endpoint_open(&session->endpoint);
  282|  34.6k|}
pn_session_free:
  291|  1.29M|{
  292|  1.29M|  assert(!session->endpoint.freed);
  293|  2.71M|  while(pn_list_size(session->links)) {
  ------------------
  |  Branch (293:9): [True: 1.41M, False: 1.29M]
  ------------------
  294|  1.41M|    pn_link_t *link = (pn_link_t *)pn_list_get(session->links, 0);
  295|  1.41M|    pn_link_free(link);
  296|  1.41M|  }
  297|  1.29M|  pni_remove_session(session->connection, session);
  298|  1.29M|  pn_list_add(session->connection->freed, session);
  299|  1.29M|  session->endpoint.freed = true;
  300|  1.29M|  pn_ep_decref(&session->endpoint);
  301|       |
  302|       |  // the finalize logic depends on endpoint.freed, so we incref/decref
  303|       |  // to give it a chance to rerun
  304|  1.29M|  pn_incref(session);
  305|  1.29M|  pn_decref(session);
  306|  1.29M|}
pn_link_open:
  342|  34.6k|{
  343|       |  assert(link);
  344|  34.6k|  pn_endpoint_open(&link->endpoint);
  345|  34.6k|}
pn_link_free:
  378|  1.41M|{
  379|  1.41M|  assert(!link->endpoint.freed);
  380|  1.41M|  pni_remove_link(link->session, link);
  381|  1.41M|  pn_list_add(link->session->freed, link);
  382|  1.41M|  pn_delivery_t *delivery = link->unsettled_head;
  383|  1.44M|  while (delivery) {
  ------------------
  |  Branch (383:10): [True: 26.6k, False: 1.41M]
  ------------------
  384|  26.6k|    pn_delivery_t *next = delivery->unsettled_next;
  385|  26.6k|    pn_delivery_settle(delivery);
  386|  26.6k|    delivery = next;
  387|  26.6k|  }
  388|  1.41M|  link->endpoint.freed = true;
  389|  1.41M|  pn_ep_decref(&link->endpoint);
  390|       |
  391|       |  // the finalize logic depends on endpoint.freed (modified above), so
  392|       |  // we incref/decref to give it a chance to rerun
  393|  1.41M|  pn_incref(link);
  394|  1.41M|  pn_decref(link);
  395|  1.41M|}
pn_endpoint_init:
  416|  2.74M|{
  417|  2.74M|  endpoint->type = (pn_endpoint_type_t) type;
  418|  2.74M|  endpoint->referenced = true;
  419|  2.74M|  endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
  ------------------
  |  |   50|  2.74M|#define PN_LOCAL_UNINIT (1)
  ------------------
                endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
  ------------------
  |  |   65|  2.74M|#define PN_REMOTE_UNINIT (8)
  ------------------
  420|  2.74M|  pn_condition_init(&endpoint->condition);
  421|  2.74M|  pn_condition_init(&endpoint->remote_condition);
  422|  2.74M|  endpoint->endpoint_next = NULL;
  423|  2.74M|  endpoint->endpoint_prev = NULL;
  424|  2.74M|  endpoint->transport_next = NULL;
  425|  2.74M|  endpoint->transport_prev = NULL;
  426|  2.74M|  endpoint->modified = false;
  427|  2.74M|  endpoint->freed = false;
  428|  2.74M|  endpoint->refcount = 1;
  429|       |  //fprintf(stderr, "initting 0x%lx\n", (uintptr_t) endpoint);
  430|       |
  431|       |  LL_ADD(conn, endpoint, endpoint);
  ------------------
  |  |  237|  2.74M|  {                                                           \
  |  |  238|  2.74M|    (NODE)-> LIST ## _next = NULL;                            \
  |  |  239|  2.74M|    (NODE)-> LIST ## _prev = (ROOT)-> LIST ## _tail;          \
  |  |  240|  2.74M|    if (LL_TAIL(ROOT, LIST))                                  \
  |  |  ------------------
  |  |  |  |  235|  2.74M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (235:29): [True: 2.71M, False: 34.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  241|  2.74M|      LL_TAIL(ROOT, LIST)-> LIST ## _next = (NODE);           \
  |  |  ------------------
  |  |  |  |  235|  2.71M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  242|  2.74M|    LL_TAIL(ROOT, LIST) = (NODE);                             \
  |  |  ------------------
  |  |  |  |  235|  2.74M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  243|  2.74M|    if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  234|  2.74M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |                   if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  234|  34.6k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (243:9): [True: 34.6k, False: 2.71M]
  |  |  ------------------
  |  |  244|  2.74M|  }
  ------------------
  432|  2.74M|}
pn_ep_incref:
  435|  5.51M|{
  436|  5.51M|  endpoint->refcount++;
  437|  5.51M|}
pn_ep_decref:
  470|  5.80M|{
  471|  5.80M|  assert(endpoint->refcount > 0);
  472|  5.80M|  endpoint->refcount--;
  473|  5.80M|  if (endpoint->refcount == 0) {
  ------------------
  |  Branch (473:7): [True: 297k, False: 5.50M]
  ------------------
  474|   297k|    pn_connection_t *conn = pni_ep_get_connection(endpoint);
  475|   297k|    pn_collector_put_object(conn->collector, endpoint, pn_final_type((pn_endpoint_type_t) endpoint->type));
  476|   297k|  }
  477|  5.80M|}
pn_connection:
  546|  34.6k|{
  547|  34.6k|  static const pn_class_t clazz = PN_CLASS(pn_connection);
  ------------------
  |  |   67|  34.6k|#define PN_CLASS(PREFIX) {                      \
  |  |   68|  34.6k|    #PREFIX,                                    \
  |  |   69|  34.6k|    CID_ ## PREFIX,                             \
  |  |   70|  34.6k|    NULL,                                       \
  |  |   71|  34.6k|    PREFIX ## _initialize,                      \
  |  |  ------------------
  |  |  |  |  540|  34.6k|#define pn_connection_initialize NULL
  |  |  ------------------
  |  |   72|  34.6k|    NULL,                                       \
  |  |   73|  34.6k|    NULL,                                       \
  |  |   74|  34.6k|    NULL,                                       \
  |  |   75|  34.6k|    PREFIX ## _finalize,                        \
  |  |   76|  34.6k|    NULL,                                       \
  |  |   77|  34.6k|    PREFIX ## _hashcode,                        \
  |  |  ------------------
  |  |  |  |  541|  34.6k|#define pn_connection_hashcode NULL
  |  |  ------------------
  |  |   78|  34.6k|    PREFIX ## _compare,                         \
  |  |  ------------------
  |  |  |  |  542|  34.6k|#define pn_connection_compare NULL
  |  |  ------------------
  |  |   79|  34.6k|    PREFIX ## _inspect                          \
  |  |  ------------------
  |  |  |  |  543|  34.6k|#define pn_connection_inspect NULL
  |  |  ------------------
  |  |   80|  34.6k|}
  ------------------
  548|  34.6k|  pn_connection_t *conn = (pn_connection_t *) pn_class_new(&clazz, sizeof(pn_connection_t));
  549|  34.6k|  if (!conn) return NULL;
  ------------------
  |  Branch (549:7): [True: 0, False: 34.6k]
  ------------------
  550|       |
  551|  34.6k|  conn->endpoint_head = NULL;
  552|  34.6k|  conn->endpoint_tail = NULL;
  553|  34.6k|  pn_endpoint_init(&conn->endpoint, CONNECTION, conn);
  554|  34.6k|  conn->transport_head = NULL;
  555|  34.6k|  conn->transport_tail = NULL;
  556|  34.6k|  conn->sessions = pn_list(PN_WEAKREF, 0);
  557|  34.6k|  conn->freed = pn_list(PN_WEAKREF, 0);
  558|  34.6k|  conn->transport = NULL;
  559|  34.6k|  conn->work_head = NULL;
  560|  34.6k|  conn->work_tail = NULL;
  561|  34.6k|  conn->tpwork_head = NULL;
  562|  34.6k|  conn->tpwork_tail = NULL;
  563|  34.6k|  conn->container = pn_string(NULL);
  564|  34.6k|  conn->hostname = pn_string(NULL);
  565|  34.6k|  conn->auth_user = pn_string(NULL);
  566|  34.6k|  conn->authzid = pn_string(NULL);
  567|  34.6k|  conn->auth_password = pn_string(NULL);
  568|  34.6k|  conn->offered_capabilities_raw = (pn_bytes_t){0, NULL};
  569|  34.6k|  conn->desired_capabilities_raw = (pn_bytes_t){0, NULL};
  570|  34.6k|  conn->properties_raw = (pn_bytes_t){0, NULL};
  571|  34.6k|  conn->offered_capabilities = NULL;
  572|  34.6k|  conn->desired_capabilities = NULL;
  573|  34.6k|  conn->properties = NULL;
  574|  34.6k|  conn->remote_offered_capabilities = NULL;
  575|  34.6k|  conn->remote_desired_capabilities = NULL;
  576|  34.6k|  conn->remote_properties = NULL;
  577|  34.6k|  conn->collector = NULL;
  578|  34.6k|  conn->context = pn_record();
  579|  34.6k|  conn->delivery_pool = pn_list(&PN_CLASSCLASS(pn_delivery), 0);
  ------------------
  |  |  102|  34.6k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  580|  34.6k|  conn->driver = NULL;
  581|       |
  582|  34.6k|  return conn;
  583|  34.6k|}
pn_connection_collect:
  592|  69.2k|{
  593|  69.2k|  pn_decref(connection->collector);
  594|  69.2k|  connection->collector = collector;
  595|  69.2k|  pn_incref(connection->collector);
  596|  69.2k|  pn_endpoint_t *endpoint = connection->endpoint_head;
  597|  2.85M|  while (endpoint) {
  ------------------
  |  Branch (597:10): [True: 2.78M, False: 69.2k]
  ------------------
  598|  2.78M|    pn_collector_put_object(connection->collector, endpoint, endpoint_init_event_map[endpoint->type]);
  599|  2.78M|    endpoint = endpoint->endpoint_next;
  600|  2.78M|  }
  601|  69.2k|}
pn_connection_set_container:
  619|  34.6k|{
  620|       |  assert(connection);
  621|  34.6k|  pn_string_set(connection->container, container);
  622|  34.6k|}
pn_work_update:
  771|   314k|{
  772|   314k|  pn_link_t *link = pn_delivery_link(delivery);
  773|   314k|  pn_delivery_t *current = pn_link_current(link);
  774|   314k|  if (delivery->updated && !delivery->local.settled) {
  ------------------
  |  Branch (774:7): [True: 59.7k, False: 254k]
  |  Branch (774:28): [True: 49.6k, False: 10.1k]
  ------------------
  775|  49.6k|    pni_add_work(connection, delivery);
  776|   265k|  } else if (delivery == current) {
  ------------------
  |  Branch (776:14): [True: 89.8k, False: 175k]
  ------------------
  777|  89.8k|    if (link->endpoint.type == SENDER) {
  ------------------
  |  Branch (777:9): [True: 1.89k, False: 87.9k]
  ------------------
  778|  1.89k|      if (pn_link_credit(link) > 0) {
  ------------------
  |  Branch (778:11): [True: 675, False: 1.22k]
  ------------------
  779|    675|        pni_add_work(connection, delivery);
  780|  1.22k|      } else {
  781|  1.22k|        pni_clear_work(connection, delivery);
  782|  1.22k|      }
  783|  87.9k|    } else {
  784|  87.9k|      pni_add_work(connection, delivery);
  785|  87.9k|    }
  786|   175k|  } else {
  787|   175k|    pni_clear_work(connection, delivery);
  788|   175k|  }
  789|   314k|}
pn_clear_tpwork:
  803|   154k|{
  804|   154k|  pn_connection_t *connection = delivery->link->session->connection;
  805|   154k|  if (delivery->tpwork)
  ------------------
  |  Branch (805:7): [True: 90.5k, False: 63.9k]
  ------------------
  806|  90.5k|  {
  807|  90.5k|    LL_REMOVE(connection, tpwork, delivery);
  ------------------
  |  |  261|  90.5k|  {                                                                    \
  |  |  262|  90.5k|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (262:9): [True: 4.06k, False: 86.4k]
  |  |  ------------------
  |  |  263|  90.5k|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  264|  90.5k|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (264:9): [True: 66.1k, False: 24.4k]
  |  |  ------------------
  |  |  265|  90.5k|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  266|  90.5k|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  234|  90.5k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (266:9): [True: 86.4k, False: 4.06k]
  |  |  ------------------
  |  |  267|  90.5k|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  234|  86.4k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  268|  90.5k|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  235|  90.5k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (268:9): [True: 24.4k, False: 66.1k]
  |  |  ------------------
  |  |  269|  90.5k|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  235|  24.4k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  270|  90.5k|  }
  ------------------
  808|  90.5k|    delivery->tpwork = false;
  809|  90.5k|    if (pn_refcount(delivery) > 0) {
  ------------------
  |  Branch (809:9): [True: 63.9k, False: 26.6k]
  ------------------
  810|  63.9k|      pn_incref(delivery);
  811|  63.9k|      pn_decref(delivery);
  812|  63.9k|    }
  813|  90.5k|  }
  814|   154k|}
pn_modified:
  830|  3.07M|{
  831|  3.07M|  if (!endpoint->modified) {
  ------------------
  |  Branch (831:7): [True: 2.85M, False: 210k]
  ------------------
  832|  2.85M|    LL_ADD(connection, transport, endpoint);
  ------------------
  |  |  237|  2.85M|  {                                                           \
  |  |  238|  2.85M|    (NODE)-> LIST ## _next = NULL;                            \
  |  |  239|  2.85M|    (NODE)-> LIST ## _prev = (ROOT)-> LIST ## _tail;          \
  |  |  240|  2.85M|    if (LL_TAIL(ROOT, LIST))                                  \
  |  |  ------------------
  |  |  |  |  235|  2.85M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (235:29): [True: 2.78M, False: 71.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  241|  2.85M|      LL_TAIL(ROOT, LIST)-> LIST ## _next = (NODE);           \
  |  |  ------------------
  |  |  |  |  235|  2.78M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  242|  2.85M|    LL_TAIL(ROOT, LIST) = (NODE);                             \
  |  |  ------------------
  |  |  |  |  235|  2.85M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  243|  2.85M|    if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  234|  2.85M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |                   if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  234|  71.2k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (243:9): [True: 71.2k, False: 2.78M]
  |  |  ------------------
  |  |  244|  2.85M|  }
  ------------------
  833|  2.85M|    endpoint->modified = true;
  834|  2.85M|  }
  835|       |
  836|  3.07M|  if (emit && connection->transport) {
  ------------------
  |  Branch (836:7): [True: 3.06M, False: 5.54k]
  |  Branch (836:15): [True: 2.91M, False: 154k]
  ------------------
  837|  2.91M|    pn_collector_put_object(connection->collector, connection->transport,
  838|  2.91M|                            PN_TRANSPORT);
  839|  2.91M|  }
  840|  3.07M|}
pn_clear_modified:
  843|   145k|{
  844|   145k|  if (endpoint->modified) {
  ------------------
  |  Branch (844:7): [True: 145k, False: 0]
  ------------------
  845|   145k|    LL_REMOVE(connection, transport, endpoint);
  ------------------
  |  |  261|   145k|  {                                                                    \
  |  |  262|   145k|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (262:9): [True: 73.9k, False: 71.2k]
  |  |  ------------------
  |  |  263|   145k|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  264|   145k|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (264:9): [True: 0, False: 145k]
  |  |  ------------------
  |  |  265|   145k|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  266|   145k|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  234|   145k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (266:9): [True: 71.2k, False: 73.9k]
  |  |  ------------------
  |  |  267|   145k|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  234|  71.2k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  268|   145k|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  235|   145k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (268:9): [True: 145k, False: 0]
  |  |  ------------------
  |  |  269|   145k|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  235|   145k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  270|   145k|  }
  ------------------
  846|   145k|    endpoint->transport_next = NULL;
  847|   145k|    endpoint->transport_prev = NULL;
  848|       |    endpoint->modified = false;
  849|   145k|  }
  850|   145k|}
pn_find:
  866|  1.33M|{
  867|  2.78M|  while (endpoint)
  ------------------
  |  Branch (867:10): [True: 2.74M, False: 34.6k]
  ------------------
  868|  2.74M|  {
  869|  2.74M|    if (pni_matches(endpoint, type, state))
  ------------------
  |  Branch (869:9): [True: 1.29M, False: 1.44M]
  ------------------
  870|  1.29M|      return endpoint;
  871|  1.44M|    endpoint = endpoint->endpoint_next;
  872|  1.44M|  }
  873|  34.6k|  return NULL;
  874|  1.33M|}
pn_session_head:
  877|  34.6k|{
  878|  34.6k|  if (conn)
  ------------------
  |  Branch (878:7): [True: 34.6k, False: 0]
  ------------------
  879|  34.6k|    return (pn_session_t *) pn_find(conn->endpoint_head, SESSION, state);
  880|      0|  else
  881|      0|    return NULL;
  882|  34.6k|}
pn_session_next:
  885|  1.29M|{
  886|  1.29M|  if (ssn)
  ------------------
  |  Branch (886:7): [True: 1.29M, False: 0]
  ------------------
  887|  1.29M|    return (pn_session_t *) pn_find(ssn->endpoint.endpoint_next, SESSION, state);
  888|      0|  else
  889|      0|    return NULL;
  890|  1.29M|}
pn_link_head:
  893|    252|{
  894|    252|  if (!conn) return NULL;
  ------------------
  |  Branch (894:7): [True: 0, False: 252]
  ------------------
  895|       |
  896|    252|  pn_endpoint_t *endpoint = conn->endpoint_head;
  897|       |
  898|    756|  while (endpoint)
  ------------------
  |  Branch (898:10): [True: 756, False: 0]
  ------------------
  899|    756|  {
  900|    756|    if (pni_matches(endpoint, SENDER, state) || pni_matches(endpoint, RECEIVER, state))
  ------------------
  |  Branch (900:9): [True: 0, False: 756]
  |  Branch (900:49): [True: 252, False: 504]
  ------------------
  901|    252|      return (pn_link_t *) endpoint;
  902|    504|    endpoint = endpoint->endpoint_next;
  903|    504|  }
  904|       |
  905|      0|  return NULL;
  906|    252|}
pn_link_next:
  909|  34.0k|{
  910|  34.0k|  if (!link) return NULL;
  ------------------
  |  Branch (910:7): [True: 0, False: 34.0k]
  ------------------
  911|       |
  912|  34.0k|  pn_endpoint_t *endpoint = link->endpoint.endpoint_next;
  913|       |
  914|  68.6k|  while (endpoint)
  ------------------
  |  Branch (914:10): [True: 68.4k, False: 252]
  ------------------
  915|  68.4k|  {
  916|  68.4k|    if (pni_matches(endpoint, SENDER, state) || pni_matches(endpoint, RECEIVER, state))
  ------------------
  |  Branch (916:9): [True: 7.44k, False: 60.9k]
  |  Branch (916:49): [True: 26.3k, False: 34.6k]
  ------------------
  917|  33.7k|      return (pn_link_t *) endpoint;
  918|  34.6k|    endpoint = endpoint->endpoint_next;
  919|  34.6k|  }
  920|       |
  921|    252|  return NULL;
  922|  34.0k|}
pn_session:
 1042|  1.29M|{
 1043|  1.29M|  assert(conn);
 1044|  1.29M|#define pn_session_free NULL
 1045|  1.29M|  static const pn_class_t clazz = PN_METACLASS(pn_session);
  ------------------
  |  |   82|  1.29M|#define PN_METACLASS(PREFIX) {                  \
  |  |   83|  1.29M|    #PREFIX,                                    \
  |  |   84|  1.29M|    CID_ ## PREFIX,                             \
  |  |   85|  1.29M|    PREFIX ## _new,                             \
  |  |  ------------------
  |  |  |  | 1033|  1.29M|#define pn_session_new NULL
  |  |  ------------------
  |  |   86|  1.29M|    PREFIX ## _initialize,                      \
  |  |  ------------------
  |  |  |  | 1036|  1.29M|#define pn_session_initialize NULL
  |  |  ------------------
  |  |   87|  1.29M|    PREFIX ## _incref,                          \
  |  |   88|  1.29M|    PREFIX ## _decref,                          \
  |  |  ------------------
  |  |  |  | 1035|  1.29M|#define pn_session_decref NULL
  |  |  ------------------
  |  |   89|  1.29M|    PREFIX ## _refcount,                        \
  |  |  ------------------
  |  |  |  | 1034|  1.29M|#define pn_session_refcount NULL
  |  |  ------------------
  |  |   90|  1.29M|    PREFIX ## _finalize,                        \
  |  |   91|  1.29M|    PREFIX ## _free,                            \
  |  |  ------------------
  |  |  |  | 1044|  1.29M|#define pn_session_free NULL
  |  |  ------------------
  |  |   92|  1.29M|    PREFIX ## _hashcode,                        \
  |  |  ------------------
  |  |  |  | 1037|  1.29M|#define pn_session_hashcode NULL
  |  |  ------------------
  |  |   93|  1.29M|    PREFIX ## _compare,                         \
  |  |  ------------------
  |  |  |  | 1038|  1.29M|#define pn_session_compare NULL
  |  |  ------------------
  |  |   94|  1.29M|    PREFIX ## _inspect                          \
  |  |  ------------------
  |  |  |  | 1039|  1.29M|#define pn_session_inspect NULL
  |  |  ------------------
  |  |   95|  1.29M|}
  ------------------
 1046|  1.29M|#undef pn_session_free
 1047|  1.29M|  pn_session_t *ssn = (pn_session_t *) pn_class_new(&clazz, sizeof(pn_session_t));
 1048|  1.29M|  if (!ssn) return NULL;
  ------------------
  |  Branch (1048:7): [True: 0, False: 1.29M]
  ------------------
 1049|  1.29M|  pn_endpoint_init(&ssn->endpoint, SESSION, conn);
 1050|  1.29M|  pni_add_session(conn, ssn);
 1051|  1.29M|  ssn->links = pn_list(PN_WEAKREF, 0);
 1052|  1.29M|  ssn->freed = pn_list(PN_WEAKREF, 0);
 1053|  1.29M|  ssn->context = pn_record();
 1054|  1.29M|  ssn->incoming_capacity = 0;
 1055|  1.29M|  ssn->incoming_bytes = 0;
 1056|  1.29M|  ssn->outgoing_bytes = 0;
 1057|  1.29M|  ssn->incoming_deliveries = 0;
 1058|  1.29M|  ssn->outgoing_deliveries = 0;
 1059|  1.29M|  ssn->outgoing_window = AMQP_MAX_WINDOW_SIZE;
  ------------------
  |  |   35|  1.29M|#define AMQP_MAX_WINDOW_SIZE (2147483647)
  ------------------
 1060|  1.29M|  ssn->local_handle_max = PN_IMPL_HANDLE_MAX;
  ------------------
  |  |   98|  1.29M|  #define PN_IMPL_HANDLE_MAX 0x7fffffff
  ------------------
 1061|  1.29M|  ssn->incoming_window_lwm = 1;
 1062|  1.29M|  ssn->check_flow = false;
 1063|  1.29M|  ssn->need_flow = false;
 1064|  1.29M|  ssn->lwm_default = true;
 1065|       |
 1066|       |  // begin transport state
 1067|  1.29M|  memset(&ssn->state, 0, sizeof(ssn->state));
 1068|  1.29M|  ssn->state.remote_handle_max = UINT32_MAX;
 1069|  1.29M|  ssn->state.local_channel = (uint16_t)-1;
 1070|  1.29M|  ssn->state.remote_channel = (uint16_t)-1;
 1071|  1.29M|  pn_delivery_map_init(&ssn->state.incoming, 0);
 1072|  1.29M|  pn_delivery_map_init(&ssn->state.outgoing, 0);
 1073|  1.29M|  ssn->state.local_handles = pn_hash(PN_WEAKREF, 0, 0.75);
 1074|  1.29M|  ssn->state.remote_handles = pn_hash(PN_WEAKREF, 0, 0.75);
 1075|       |  // end transport state
 1076|       |
 1077|  1.29M|  pn_collector_put_object(conn->collector, ssn, PN_SESSION_INIT);
 1078|  1.29M|  if (conn->transport) {
  ------------------
  |  Branch (1078:7): [True: 1.26M, False: 34.6k]
  ------------------
 1079|  1.26M|    pni_session_bound(ssn);
 1080|  1.26M|  }
 1081|  1.29M|  pn_decref(ssn);
 1082|  1.29M|  return ssn;
 1083|  1.29M|}
pn_session_unbound:
 1095|  67.2k|{
 1096|       |  assert(ssn);
 1097|  67.2k|  ssn->state.local_channel = (uint16_t)-1;
 1098|  67.2k|  ssn->state.remote_channel = (uint16_t)-1;
 1099|  67.2k|  ssn->incoming_bytes = 0;
 1100|  67.2k|  ssn->outgoing_bytes = 0;
 1101|  67.2k|  ssn->incoming_deliveries = 0;
 1102|  67.2k|  ssn->outgoing_deliveries = 0;
 1103|  67.2k|}
pn_link_new:
 1284|  1.41M|{
 1285|  1.41M|#define pn_link_new NULL
 1286|  1.41M|#define pn_link_free NULL
 1287|  1.41M|  static const pn_class_t clazz = PN_METACLASS(pn_link);
  ------------------
  |  |   82|  1.41M|#define PN_METACLASS(PREFIX) {                  \
  |  |   83|  1.41M|    #PREFIX,                                    \
  |  |   84|  1.41M|    CID_ ## PREFIX,                             \
  |  |   85|  1.41M|    PREFIX ## _new,                             \
  |  |  ------------------
  |  |  |  | 1285|  1.41M|#define pn_link_new NULL
  |  |  ------------------
  |  |   86|  1.41M|    PREFIX ## _initialize,                      \
  |  |  ------------------
  |  |  |  | 1278|  1.41M|#define pn_link_initialize NULL
  |  |  ------------------
  |  |   87|  1.41M|    PREFIX ## _incref,                          \
  |  |   88|  1.41M|    PREFIX ## _decref,                          \
  |  |  ------------------
  |  |  |  | 1277|  1.41M|#define pn_link_decref NULL
  |  |  ------------------
  |  |   89|  1.41M|    PREFIX ## _refcount,                        \
  |  |  ------------------
  |  |  |  | 1276|  1.41M|#define pn_link_refcount NULL
  |  |  ------------------
  |  |   90|  1.41M|    PREFIX ## _finalize,                        \
  |  |   91|  1.41M|    PREFIX ## _free,                            \
  |  |  ------------------
  |  |  |  | 1286|  1.41M|#define pn_link_free NULL
  |  |  ------------------
  |  |   92|  1.41M|    PREFIX ## _hashcode,                        \
  |  |  ------------------
  |  |  |  | 1279|  1.41M|#define pn_link_hashcode NULL
  |  |  ------------------
  |  |   93|  1.41M|    PREFIX ## _compare,                         \
  |  |  ------------------
  |  |  |  | 1280|  1.41M|#define pn_link_compare NULL
  |  |  ------------------
  |  |   94|  1.41M|    PREFIX ## _inspect                          \
  |  |  ------------------
  |  |  |  | 1281|  1.41M|#define pn_link_inspect NULL
  |  |  ------------------
  |  |   95|  1.41M|}
  ------------------
 1288|  1.41M|#undef pn_link_new
 1289|  1.41M|#undef pn_link_free
 1290|  1.41M|  pn_link_t *link = (pn_link_t *) pn_class_new(&clazz, sizeof(pn_link_t));
 1291|       |
 1292|  1.41M|  pn_endpoint_init(&link->endpoint, type, session->connection);
 1293|  1.41M|  pni_add_link(session, link);
 1294|  1.41M|  pn_incref(session);  // keep session until link finalized
 1295|  1.41M|  link->name = name;
 1296|  1.41M|  pni_terminus_init(&link->source, PN_SOURCE);
 1297|  1.41M|  pni_terminus_init(&link->target, PN_TARGET);
 1298|  1.41M|  pni_terminus_init(&link->remote_source, PN_UNSPECIFIED);
 1299|  1.41M|  pni_terminus_init(&link->remote_target, PN_UNSPECIFIED);
 1300|  1.41M|  link->unsettled_head = link->unsettled_tail = link->current = NULL;
 1301|  1.41M|  link->unsettled_count = 0;
 1302|  1.41M|  link->max_message_size = 0;
 1303|  1.41M|  link->remote_max_message_size = 0;
 1304|  1.41M|  link->available = 0;
 1305|  1.41M|  link->credit = 0;
 1306|  1.41M|  link->queued = 0;
 1307|  1.41M|  link->more_id = 0;
 1308|  1.41M|  link->more_tag = pn_bytes_null;
 1309|  1.41M|  link->more_format = 0;
 1310|  1.41M|  link->drain = false;
 1311|  1.41M|  link->drain_flag_mode = true;
 1312|  1.41M|  link->drained = 0;
 1313|  1.41M|  link->context = pn_record();
 1314|  1.41M|  link->snd_settle_mode = PN_SND_MIXED;
 1315|  1.41M|  link->rcv_settle_mode = PN_RCV_FIRST;
 1316|  1.41M|  link->remote_snd_settle_mode = PN_SND_MIXED;
 1317|  1.41M|  link->remote_rcv_settle_mode = PN_RCV_FIRST;
 1318|  1.41M|  link->detached = false;
 1319|  1.41M|  link->more_pending = false;
 1320|  1.41M|  link->tag_truncated = false;
 1321|  1.41M|  link->properties = 0;
 1322|  1.41M|  link->properties_raw = (pn_bytes_t){0, NULL};
 1323|  1.41M|  link->remote_properties = 0;
 1324|  1.41M|  link->remote_properties_raw = (pn_bytes_t){0, NULL};
 1325|       |
 1326|       |  // begin transport state
 1327|  1.41M|  link->state.local_handle = -1;
 1328|  1.41M|  link->state.remote_handle = -1;
 1329|  1.41M|  link->state.delivery_count = 0;
 1330|  1.41M|  link->state.link_credit = 0;
 1331|       |  // end transport state
 1332|       |
 1333|  1.41M|  pn_collector_put_object(session->connection->collector, link, PN_LINK_INIT);
 1334|  1.41M|  if (session->connection->transport) {
  ------------------
  |  Branch (1334:7): [True: 1.38M, False: 34.6k]
  ------------------
 1335|  1.38M|    pni_link_bound(link);
 1336|  1.38M|  }
 1337|  1.41M|  pn_decref(link);
 1338|  1.41M|  return link;
 1339|  1.41M|}
pn_link_unbound:
 1346|  58.7k|{
 1347|       |  assert(link);
 1348|  58.7k|  link->state.local_handle = -1;
 1349|  58.7k|  link->state.remote_handle = -1;
 1350|  58.7k|  link->state.delivery_count = 0;
 1351|  58.7k|  link->state.link_credit = 0;
 1352|  58.7k|}
pn_link_source:
 1355|  34.6k|{
 1356|  34.6k|  return link ? &link->source : NULL;
  ------------------
  |  Branch (1356:10): [True: 34.6k, False: 0]
  ------------------
 1357|  34.6k|}
pn_terminus_set_type:
 1375|  2.76M|{
 1376|  2.76M|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1376:7): [True: 0, False: 2.76M]
  ------------------
 1377|  2.76M|  terminus->type = type;
 1378|  2.76M|  return 0;
 1379|  2.76M|}
pn_terminus_get_type:
 1382|  1.38M|{
 1383|  1.38M|  return (pn_terminus_type_t) (terminus ? terminus->type : 0);
  ------------------
  |  Branch (1383:32): [True: 1.38M, False: 0]
  ------------------
 1384|  1.38M|}
pn_terminus_set_address:
 1393|  34.6k|{
 1394|       |  assert(terminus);
 1395|  34.6k|  return pn_string_set(terminus->address, address);
 1396|  34.6k|}
pn_terminus_set_durability:
 1404|  57.3k|{
 1405|  57.3k|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1405:7): [True: 0, False: 57.3k]
  ------------------
 1406|  57.3k|  terminus->durability = durability;
 1407|  57.3k|  return 0;
 1408|  57.3k|}
pn_terminus_set_expiry_policy:
 1421|  2.23k|{
 1422|  2.23k|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1422:7): [True: 0, False: 2.23k]
  ------------------
 1423|  2.23k|  terminus->expiry_policy = expiry_policy;
 1424|       |  terminus->has_expiry_policy = true;
 1425|  2.23k|  return 0;
 1426|  2.23k|}
pn_terminus_set_timeout:
 1434|  57.3k|{
 1435|  57.3k|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1435:7): [True: 0, False: 57.3k]
  ------------------
 1436|  57.3k|  terminus->timeout = timeout;
 1437|  57.3k|  return 0;
 1438|  57.3k|}
pn_terminus_set_dynamic:
 1446|  57.3k|{
 1447|  57.3k|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1447:7): [True: 0, False: 57.3k]
  ------------------
 1448|  57.3k|  terminus->dynamic = dynamic;
 1449|  57.3k|  return 0;
 1450|  57.3k|}
pn_terminus_set_distribution_mode:
 1494|  52.7k|{
 1495|  52.7k|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1495:7): [True: 0, False: 52.7k]
  ------------------
 1496|  52.7k|  terminus->distribution_mode = m;
 1497|  52.7k|  return 0;
 1498|  52.7k|}
pn_receiver:
 1564|  34.6k|{
 1565|  34.6k|  return pn_link_new(RECEIVER, session, pn_string(name));
 1566|  34.6k|}
pn_link_name:
 1574|      7|{
 1575|       |  assert(link);
 1576|      7|  return pn_string_get(link->name);
 1577|      7|}
pn_link_is_sender:
 1580|   188k|{
 1581|   188k|  return link->endpoint.type == SENDER;
 1582|   188k|}
pn_link_is_receiver:
 1585|   116k|{
 1586|   116k|  return link->endpoint.type == RECEIVER;
 1587|   116k|}
pn_link_session:
 1590|   137k|{
 1591|       |  assert(link);
 1592|   137k|  return link->session;
 1593|   137k|}
pn_disposition_clear:
 1702|   278k|{
 1703|   278k|  pn_disposition_finalize(ds);
 1704|   278k|  pn_disposition_init(ds);
 1705|   278k|}
pn_dtag:
 1719|  90.5k|pn_delivery_tag_t pn_dtag(const char *bytes, size_t size) {
 1720|  90.5k|  pn_delivery_tag_t dtag = {size, bytes};
 1721|  90.5k|  return dtag;
 1722|  90.5k|}
pn_delivery:
 1725|  90.5k|{
 1726|  90.5k|  assert(link);
 1727|  90.5k|  pn_list_t *pool = link->session->connection->delivery_pool;
 1728|  90.5k|  pn_delivery_t *delivery = (pn_delivery_t *) pn_list_pop(pool);
 1729|  90.5k|  if (!delivery) {
  ------------------
  |  Branch (1729:7): [True: 33.2k, False: 57.2k]
  ------------------
 1730|  33.2k|    delivery = (pn_delivery_t *) pn_class_new(&PN_CLASSCLASS(pn_delivery), sizeof(pn_delivery_t));
  ------------------
  |  |  102|  33.2k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
 1731|  33.2k|    if (!delivery) return NULL;
  ------------------
  |  Branch (1731:9): [True: 0, False: 33.2k]
  ------------------
 1732|  33.2k|    delivery->bytes = pn_buffer(64);
 1733|  33.2k|    pn_disposition_init(&delivery->local);
 1734|  33.2k|    pn_disposition_init(&delivery->remote);
 1735|  33.2k|    delivery->context = pn_record();
 1736|  57.2k|  } else {
 1737|  57.2k|    assert(!delivery->state.init);
 1738|  57.2k|  }
 1739|  90.5k|  delivery->link = link;
 1740|  90.5k|  pn_incref(delivery->link);  // keep link until finalized
 1741|       |  // The spec allows at most 32 octets of delivery-tag, so truncate rather than put
 1742|       |  // an illegal transfer on the wire. Only outbound tags: a receiver's tag comes off
 1743|       |  // the wire, and an over long one there is the peer's violation to report, not
 1744|       |  // something to silently rewrite under our own application. Warn once per link, as
 1745|       |  // an over long tag is a property of the caller's tag scheme, not of any one delivery.
 1746|  90.5k|  if (tag.size > AMQP_MAX_DELIVERY_TAG_SIZE && pn_link_is_sender(link)) {
  ------------------
  |  |   36|   181k|#define AMQP_MAX_DELIVERY_TAG_SIZE (32) // maximum delivery-tag octets allowed by the spec
  ------------------
  |  Branch (1746:7): [True: 25, False: 90.5k]
  |  Branch (1746:48): [True: 14, False: 11]
  ------------------
 1747|     14|    size_t original_size = tag.size;
 1748|     14|    tag.size = AMQP_MAX_DELIVERY_TAG_SIZE;
  ------------------
  |  |   36|     14|#define AMQP_MAX_DELIVERY_TAG_SIZE (32) // maximum delivery-tag octets allowed by the spec
  ------------------
 1749|     14|    if (!link->tag_truncated) {
  ------------------
  |  Branch (1749:9): [True: 7, False: 7]
  ------------------
 1750|      7|      link->tag_truncated = true;
 1751|       |      // An unbound connection has no transport, and so no logger of its own.
 1752|      7|      pn_transport_t *transport = link->session->connection->transport;
 1753|      7|      const char *name = pn_link_name(link);
 1754|      7|      char quoted[4*AMQP_MAX_DELIVERY_TAG_SIZE + 1]; // worst case every octet escaped as \xNN
 1755|      7|      pn_quote_data(quoted, sizeof(quoted), tag.start, tag.size);
 1756|      7|      PN_LOG(transport ? &transport->logger : pn_default_logger(),
  ------------------
  |  |   57|      7|    do { \
  |  |   58|      7|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   54|     14|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:6): [Folded, False: 7]
  |  |  |  |  |  Branch (54:38): [True: 7, False: 0]
  |  |  |  |  |  Branch (54:40): [True: 7, False: 0]
  |  |  |  |  |  Branch (54:73): [True: 0, False: 7]
  |  |  |  |  |  Branch (54:75): [True: 7, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|      7|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |  ------------------
  |  |  |  Branch (59:28): [True: 0, False: 0]
  |  |  |  Branch (59:91): [True: 0, False: 0]
  |  |  ------------------
  |  |   60|      7|    } while(0)
  |  |  ------------------
  |  |  |  Branch (60:13): [Folded, False: 7]
  |  |  ------------------
  ------------------
 1757|      7|             PN_SUBSYSTEM_AMQP, PN_LEVEL_WARNING,
 1758|      7|             "link '%s': %zu octet delivery-tag truncated to the %d octet maximum, sending '%s'; "
 1759|      7|             "tags must remain unique amongst the unsettled deliveries on a link",
 1760|      7|             name ? name : "", original_size, AMQP_MAX_DELIVERY_TAG_SIZE, quoted);
 1761|      7|    }
 1762|     14|  }
 1763|  90.5k|  delivery->tag = pn_bytes_dup(tag);
 1764|  90.5k|  pn_disposition_clear(&delivery->local);
 1765|  90.5k|  pn_disposition_clear(&delivery->remote);
 1766|  90.5k|  delivery->updated = false;
 1767|  90.5k|  delivery->settled = false;
 1768|  90.5k|  LL_ADD(link, unsettled, delivery);
  ------------------
  |  |  237|  90.5k|  {                                                           \
  |  |  238|  90.5k|    (NODE)-> LIST ## _next = NULL;                            \
  |  |  239|  90.5k|    (NODE)-> LIST ## _prev = (ROOT)-> LIST ## _tail;          \
  |  |  240|  90.5k|    if (LL_TAIL(ROOT, LIST))                                  \
  |  |  ------------------
  |  |  |  |  235|  90.5k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (235:29): [True: 2.88k, False: 87.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  241|  90.5k|      LL_TAIL(ROOT, LIST)-> LIST ## _next = (NODE);           \
  |  |  ------------------
  |  |  |  |  235|  2.88k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  242|  90.5k|    LL_TAIL(ROOT, LIST) = (NODE);                             \
  |  |  ------------------
  |  |  |  |  235|  90.5k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  243|  90.5k|    if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  234|  90.5k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |                   if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  234|  87.6k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (243:9): [True: 87.6k, False: 2.88k]
  |  |  ------------------
  |  |  244|  90.5k|  }
  ------------------
 1769|  90.5k|  delivery->referenced = true;
 1770|  90.5k|  delivery->work_next = NULL;
 1771|  90.5k|  delivery->work_prev = NULL;
 1772|  90.5k|  delivery->work = false;
 1773|  90.5k|  delivery->tpwork_next = NULL;
 1774|  90.5k|  delivery->tpwork_prev = NULL;
 1775|  90.5k|  delivery->tpwork = false;
 1776|  90.5k|  pn_buffer_clear(delivery->bytes);
 1777|  90.5k|  delivery->done = false;
 1778|  90.5k|  delivery->aborted = false;
 1779|  90.5k|  pn_record_clear(delivery->context);
 1780|       |
 1781|       |  // begin delivery state
 1782|  90.5k|  delivery->state.init = false;
 1783|  90.5k|  delivery->state.sending = false; /* True if we have sent at least 1 frame */
 1784|  90.5k|  delivery->state.sent = false;    /* True if we have sent the entire delivery */
 1785|       |  // end delivery state
 1786|       |
 1787|  90.5k|  if (!link->current)
  ------------------
  |  Branch (1787:7): [True: 87.6k, False: 2.88k]
  ------------------
 1788|  87.6k|    link->current = delivery;
 1789|       |
 1790|  90.5k|  link->unsettled_count++;
 1791|       |
 1792|  90.5k|  pn_work_update(link->session->connection, delivery);
 1793|       |
 1794|       |  // XXX: could just remove incref above
 1795|  90.5k|  pn_decref(delivery);
 1796|       |
 1797|  90.5k|  return delivery;
 1798|  90.5k|}
pn_delivery_current:
 1840|   205k|{
 1841|   205k|  pn_link_t *link = delivery->link;
 1842|   205k|  return pn_link_current(link) == delivery;
 1843|   205k|}
pn_link_current:
 2222|   522k|{
 2223|   522k|  if (!link) return NULL;
  ------------------
  |  Branch (2223:7): [True: 0, False: 522k]
  ------------------
 2224|   522k|  return link->current;
 2225|   522k|}
pn_link_advance:
 2269|  90.5k|{
 2270|  90.5k|  if (link && link->current) {
  ------------------
  |  Branch (2270:7): [True: 90.5k, False: 0]
  |  Branch (2270:15): [True: 90.5k, False: 0]
  ------------------
 2271|  90.5k|    pn_delivery_t *prev = link->current;
 2272|  90.5k|    if (link->endpoint.type == SENDER) {
  ------------------
  |  Branch (2272:9): [True: 578, False: 89.9k]
  ------------------
 2273|    578|      pni_advance_sender(link);
 2274|  89.9k|    } else {
 2275|  89.9k|      pni_advance_receiver(link);
 2276|  89.9k|    }
 2277|  90.5k|    pn_delivery_t *next = link->current;
 2278|  90.5k|    pn_work_update(link->session->connection, prev);
 2279|  90.5k|    if (next) pn_work_update(link->session->connection, next);
  ------------------
  |  Branch (2279:9): [True: 2.88k, False: 87.6k]
  ------------------
 2280|  90.5k|    return prev != next;
 2281|  90.5k|  } else {
 2282|       |    return false;
 2283|      0|  }
 2284|  90.5k|}
pn_link_credit:
 2287|  1.89k|{
 2288|  1.89k|  return link ? link->credit : 0;
  ------------------
  |  Branch (2288:10): [True: 1.89k, False: 0]
  ------------------
 2289|  1.89k|}
pn_link_queued:
 2297|  7.44k|{
 2298|  7.44k|  return link ? link->queued : 0;
  ------------------
  |  Branch (2298:10): [True: 7.44k, False: 0]
  ------------------
 2299|  7.44k|}
pn_delivery_settle:
 2348|   102k|{
 2349|   102k|  assert(delivery);
 2350|   102k|  if (!delivery->local.settled) {
  ------------------
  |  Branch (2350:7): [True: 90.5k, False: 11.4k]
  ------------------
 2351|  90.5k|    pn_link_t *link = delivery->link;
 2352|  90.5k|    if (pn_delivery_current(delivery)) {
  ------------------
  |  Branch (2352:9): [True: 15.1k, False: 75.3k]
  ------------------
 2353|  15.1k|      pn_link_advance(link);
 2354|  15.1k|    }
 2355|       |
 2356|  90.5k|    link->unsettled_count--;
 2357|       |    delivery->local.settled = true;
 2358|  90.5k|    pni_add_tpwork(delivery);
 2359|  90.5k|    pn_work_update(delivery->link->session->connection, delivery);
 2360|  90.5k|    pn_incref(delivery);
 2361|  90.5k|    pn_decref(delivery);
 2362|  90.5k|  }
 2363|   102k|}
pn_link_recv:
 2403|  74.8k|{
 2404|  74.8k|  if (!receiver) return PN_ARG_ERR;
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (2404:7): [True: 0, False: 74.8k]
  ------------------
 2405|  74.8k|  pn_delivery_t *delivery = receiver->current;
 2406|  74.8k|  if (!delivery) return PN_STATE_ERR;
  ------------------
  |  |   52|      0|#define PN_STATE_ERR (-5)      /**< State error */
  ------------------
  |  Branch (2406:7): [True: 0, False: 74.8k]
  ------------------
 2407|  74.8k|  if (delivery->aborted) return PN_ABORTED;
  ------------------
  |  |   58|     48|#define PN_ABORTED (-11)       /**< Delivery aborted error */
  ------------------
  |  Branch (2407:7): [True: 48, False: 74.7k]
  ------------------
 2408|  74.7k|  size_t size = pn_buffer_get(delivery->bytes, 0, n, bytes);
 2409|  74.7k|  pn_buffer_trim(delivery->bytes, size, 0);
 2410|  74.7k|  if (size) {
  ------------------
  |  Branch (2410:7): [True: 73.1k, False: 1.61k]
  ------------------
 2411|  73.1k|    pn_session_t *ssn = receiver->session;
 2412|  73.1k|    ssn->incoming_bytes -= size;
 2413|  73.1k|    pn_transport_t *t = ssn->connection->transport;
 2414|  73.1k|    if (t) t->buffered_delivery_bytes -= size;
  ------------------
  |  Branch (2414:9): [True: 73.1k, False: 0]
  ------------------
 2415|  73.1k|    if (!ssn->check_flow && ssn->state.incoming_window < ssn->incoming_window_lwm) {
  ------------------
  |  Branch (2415:9): [True: 73.1k, False: 0]
  |  Branch (2415:29): [True: 0, False: 73.1k]
  ------------------
 2416|      0|      ssn->check_flow = true;
 2417|      0|      pni_add_tpwork(delivery);
 2418|      0|    }
 2419|  73.1k|    return size;
 2420|  73.1k|  } else {
 2421|  1.61k|    return delivery->done ? PN_EOS : 0;
  ------------------
  |  |   48|  1.61k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
  |  Branch (2421:12): [True: 1.61k, False: 0]
  ------------------
 2422|  1.61k|  }
 2423|  74.7k|}
pn_link_flow:
 2427|  34.6k|{
 2428|  34.6k|  assert(receiver);
 2429|  34.6k|  assert(pn_link_is_receiver(receiver));
 2430|  34.6k|  receiver->credit += credit;
 2431|  34.6k|  pn_modified(receiver->session->connection, &receiver->endpoint, true);
 2432|  34.6k|  if (!receiver->drain_flag_mode) {
  ------------------
  |  Branch (2432:7): [True: 0, False: 34.6k]
  ------------------
 2433|      0|    pn_link_set_drain(receiver, false);
 2434|       |    receiver->drain_flag_mode = false;
 2435|      0|  }
 2436|  34.6k|}
pn_delivery_link:
 2499|   464k|{
 2500|       |  assert(delivery);
 2501|   464k|  return delivery->link;
 2502|   464k|}
pn_delivery_update:
 2545|  75.3k|{
 2546|  75.3k|  if (!delivery) return;
  ------------------
  |  Branch (2546:7): [True: 0, False: 75.3k]
  ------------------
 2547|  75.3k|  if (delivery->local.type == PN_DISP_CUSTOM) {
  ------------------
  |  Branch (2547:7): [True: 0, False: 75.3k]
  ------------------
 2548|      0|    switch (state) {
 2549|      0|      case PN_ACCEPTED:
  ------------------
  |  |   66|      0|#define PN_ACCEPTED (0x0000000000000024)
  ------------------
  |  Branch (2549:7): [True: 0, False: 0]
  ------------------
 2550|      0|      case PN_REJECTED:
  ------------------
  |  |   74|      0|#define PN_REJECTED (0x0000000000000025)
  ------------------
  |  Branch (2550:7): [True: 0, False: 0]
  ------------------
 2551|      0|      case PN_RECEIVED:
  ------------------
  |  |   58|      0|#define PN_RECEIVED (0x0000000000000023)
  ------------------
  |  Branch (2551:7): [True: 0, False: 0]
  ------------------
 2552|      0|      case PN_MODIFIED:
  ------------------
  |  |   91|      0|#define PN_MODIFIED (0x0000000000000027)
  ------------------
  |  Branch (2552:7): [True: 0, False: 0]
  ------------------
 2553|      0|      case PN_RELEASED:
  ------------------
  |  |   82|      0|#define PN_RELEASED (0x0000000000000026)
  ------------------
  |  Branch (2553:7): [True: 0, False: 0]
  ------------------
 2554|      0|      case PN_DECLARED:
  ------------------
  |  |   98|      0|#define PN_DECLARED (0x0000000000000033)
  ------------------
  |  Branch (2554:7): [True: 0, False: 0]
  ------------------
 2555|      0|      case PN_TRANSACTIONAL_STATE:
  ------------------
  |  |  104|      0|#define PN_TRANSACTIONAL_STATE (0x0000000000000034)
  ------------------
  |  Branch (2555:7): [True: 0, False: 0]
  ------------------
 2556|      0|        break;
 2557|      0|      default:
  ------------------
  |  Branch (2557:7): [True: 0, False: 0]
  ------------------
 2558|      0|        delivery->local.u.s_custom.type = state;
 2559|      0|        pni_add_tpwork(delivery);
 2560|      0|        return;
 2561|      0|    }
 2562|      0|  }
 2563|  75.3k|  if (delivery->local.type != state) pn_disposition_clear(&delivery->local);
  ------------------
  |  Branch (2563:7): [True: 75.3k, False: 0]
  ------------------
 2564|  75.3k|  switch (state) {
 2565|  75.3k|    case PN_ACCEPTED:
  ------------------
  |  |   66|  75.3k|#define PN_ACCEPTED (0x0000000000000024)
  ------------------
  |  Branch (2565:5): [True: 75.3k, False: 0]
  ------------------
 2566|  75.3k|    case PN_REJECTED:
  ------------------
  |  |   74|  75.3k|#define PN_REJECTED (0x0000000000000025)
  ------------------
  |  Branch (2566:5): [True: 0, False: 75.3k]
  ------------------
 2567|  75.3k|    case PN_RECEIVED:
  ------------------
  |  |   58|  75.3k|#define PN_RECEIVED (0x0000000000000023)
  ------------------
  |  Branch (2567:5): [True: 0, False: 75.3k]
  ------------------
 2568|  75.3k|    case PN_MODIFIED:
  ------------------
  |  |   91|  75.3k|#define PN_MODIFIED (0x0000000000000027)
  ------------------
  |  Branch (2568:5): [True: 0, False: 75.3k]
  ------------------
 2569|  75.3k|    case PN_RELEASED:
  ------------------
  |  |   82|  75.3k|#define PN_RELEASED (0x0000000000000026)
  ------------------
  |  Branch (2569:5): [True: 0, False: 75.3k]
  ------------------
 2570|  75.3k|    case PN_DECLARED:
  ------------------
  |  |   98|  75.3k|#define PN_DECLARED (0x0000000000000033)
  ------------------
  |  Branch (2570:5): [True: 0, False: 75.3k]
  ------------------
 2571|  75.3k|    case PN_TRANSACTIONAL_STATE:
  ------------------
  |  |  104|  75.3k|#define PN_TRANSACTIONAL_STATE (0x0000000000000034)
  ------------------
  |  Branch (2571:5): [True: 0, False: 75.3k]
  ------------------
 2572|  75.3k|      delivery->local.type = state;
 2573|  75.3k|      break;
 2574|      0|    default:
  ------------------
  |  Branch (2574:5): [True: 0, False: 75.3k]
  ------------------
 2575|      0|      delivery->local.type = PN_DISP_CUSTOM;
 2576|      0|      delivery->local.u.s_custom.type = state;
 2577|      0|      break;
 2578|  75.3k|  }
 2579|  75.3k|  pni_add_tpwork(delivery);
 2580|  75.3k|}
pn_delivery_readable:
 2591|   116k|{
 2592|   116k|  if (delivery) {
  ------------------
  |  Branch (2592:7): [True: 116k, False: 0]
  ------------------
 2593|   116k|    pn_link_t *link = delivery->link;
 2594|   116k|    return pn_link_is_receiver(link) && pn_delivery_current(delivery);
  ------------------
  |  Branch (2594:12): [True: 114k, False: 2.06k]
  |  Branch (2594:41): [True: 91.4k, False: 23.3k]
  ------------------
 2595|   116k|  } else {
 2596|       |    return false;
 2597|      0|  }
 2598|   116k|}
pn_delivery_pending:
 2601|  75.3k|{
 2602|       |  /* Aborted deliveries: for clients that don't check pn_delivery_aborted(),
 2603|       |     return 1 rather than 0. This will force them to call pn_link_recv() and get
 2604|       |     the PN_ABORTED error return code.
 2605|       |  */
 2606|  75.3k|  if (delivery->aborted) return 1;
  ------------------
  |  Branch (2606:7): [True: 48, False: 75.3k]
  ------------------
 2607|  75.3k|  return pn_buffer_size(delivery->bytes);
 2608|  75.3k|}
pn_delivery_partial:
 2611|  91.4k|{
 2612|  91.4k|  return !delivery->done;
 2613|  91.4k|}
pn_connection_condition:
 2629|    981|{
 2630|       |  assert(connection);
 2631|    981|  return &connection->endpoint.condition;
 2632|    981|}
pn_connection_remote_condition:
 2635|  1.47k|{
 2636|  1.47k|  assert(connection);
 2637|  1.47k|  pn_transport_t *transport = connection->transport;
 2638|  1.47k|  return transport ? &transport->remote_condition : NULL;
  ------------------
  |  Branch (2638:10): [True: 1.47k, False: 0]
  ------------------
 2639|  1.47k|}
pn_session_remote_condition:
 2648|  88.3k|{
 2649|       |  assert(session);
 2650|  88.3k|  return &session->endpoint.remote_condition;
 2651|  88.3k|}
pn_link_remote_condition:
 2660|   137k|{
 2661|       |  assert(link);
 2662|   137k|  return &link->endpoint.remote_condition;
 2663|   137k|}
pn_condition_is_set:
 2666|   293k|{
 2667|   293k|  return condition && condition->name && pn_string_get(condition->name);
  ------------------
  |  Branch (2667:10): [True: 293k, False: 0]
  |  Branch (2667:23): [True: 235k, False: 58.1k]
  |  Branch (2667:42): [True: 8.69k, False: 226k]
  ------------------
 2668|   293k|}
pn_condition_clear:
 2671|  2.74M|{
 2672|  2.74M|  assert(condition);
 2673|  2.74M|  if (condition->name) pn_string_clear(condition->name);
  ------------------
  |  Branch (2673:7): [True: 140k, False: 2.60M]
  ------------------
 2674|  2.74M|  if (condition->description) pn_string_clear(condition->description);
  ------------------
  |  Branch (2674:7): [True: 140k, False: 2.60M]
  ------------------
 2675|  2.74M|  if (condition->info) pn_data_clear(condition->info);
  ------------------
  |  Branch (2675:7): [True: 0, False: 2.74M]
  ------------------
 2676|  2.74M|  pn_bytes_free (condition->info_raw);
 2677|       |  condition->info_raw = (pn_bytes_t){0, NULL};
 2678|  2.74M|}
pn_condition_set_name:
 2691|  23.4k|{
 2692|  23.4k|  assert(condition);
 2693|  23.4k|  if (condition->name == NULL) {
  ------------------
  |  Branch (2693:7): [True: 23.4k, False: 0]
  ------------------
 2694|  23.4k|    condition->name = pn_string(name);
 2695|  23.4k|    return 0;
 2696|  23.4k|  } else {
 2697|      0|    return pn_string_set(condition->name, name);
 2698|      0|  }
 2699|  23.4k|}
pn_condition_set_description:
 2712|  23.4k|{
 2713|  23.4k|  assert(condition);
 2714|  23.4k|  if (condition->description == NULL) {
  ------------------
  |  Branch (2714:7): [True: 23.4k, False: 0]
  ------------------
 2715|  23.4k|    condition->description = pn_string(description);
 2716|  23.4k|    return 0;
 2717|  23.4k|  } else {
 2718|      0|    return pn_string_set(condition->description, description);
 2719|      0|  }
 2720|  23.4k|}
pn_event_connection:
 2787|   271k|{
 2788|   271k|  pn_session_t *ssn;
 2789|   271k|  pn_transport_t *transport;
 2790|       |
 2791|   271k|  switch (pn_class_id(pn_event_class(event))) {
 2792|  37.5k|  case CID_pn_connection:
  ------------------
  |  Branch (2792:3): [True: 37.5k, False: 233k]
  ------------------
 2793|  37.5k|    return (pn_connection_t *) pn_event_context(event);
 2794|  8.60k|  case CID_pn_transport:
  ------------------
  |  Branch (2794:3): [True: 8.60k, False: 262k]
  ------------------
 2795|  8.60k|    transport = pn_event_transport(event);
 2796|  8.60k|    if (transport)
  ------------------
  |  Branch (2796:9): [True: 8.60k, False: 0]
  ------------------
 2797|  8.60k|      return transport->connection;
 2798|      0|    return NULL;
 2799|   225k|  default:
  ------------------
  |  Branch (2799:3): [True: 225k, False: 46.1k]
  ------------------
 2800|   225k|    ssn = pn_event_session(event);
 2801|   225k|    if (ssn)
  ------------------
  |  Branch (2801:9): [True: 225k, False: 0]
  ------------------
 2802|   225k|     return pn_session_connection(ssn);
 2803|   271k|  }
 2804|      0|  return NULL;
 2805|   271k|}
pn_event_session:
 2808|   313k|{
 2809|   313k|  pn_link_t *link;
 2810|   313k|  switch (pn_class_id(pn_event_class(event))) {
 2811|   176k|  case CID_pn_session:
  ------------------
  |  Branch (2811:3): [True: 176k, False: 137k]
  ------------------
 2812|   176k|    return (pn_session_t *) pn_event_context(event);
 2813|   137k|  default:
  ------------------
  |  Branch (2813:3): [True: 137k, False: 176k]
  ------------------
 2814|   137k|    link = pn_event_link(event);
 2815|   137k|    if (link)
  ------------------
  |  Branch (2815:9): [True: 137k, False: 0]
  ------------------
 2816|   137k|      return pn_link_session(link);
 2817|   313k|  }
 2818|      0|  return NULL;
 2819|   313k|}
pn_event_link:
 2822|   274k|{
 2823|   274k|  pn_delivery_t *dlv;
 2824|   274k|  switch (pn_class_id(pn_event_class(event))) {
 2825|   274k|  case CID_pn_link:
  ------------------
  |  Branch (2825:3): [True: 274k, False: 0]
  ------------------
 2826|   274k|    return (pn_link_t *) pn_event_context(event);
 2827|      0|  default:
  ------------------
  |  Branch (2827:3): [True: 0, False: 274k]
  ------------------
 2828|      0|    dlv = pn_event_delivery(event);
 2829|      0|    if (dlv)
  ------------------
  |  Branch (2829:9): [True: 0, False: 0]
  ------------------
 2830|      0|      return pn_delivery_link(dlv);
 2831|   274k|  }
 2832|      0|  return NULL;
 2833|   274k|}
pn_event_delivery:
 2836|   116k|{
 2837|   116k|  switch (pn_class_id(pn_event_class(event))) {
 2838|   116k|  case CID_pn_delivery:
  ------------------
  |  Branch (2838:3): [True: 116k, False: 0]
  ------------------
 2839|   116k|    return (pn_delivery_t *) pn_event_context(event);
 2840|      0|  default:
  ------------------
  |  Branch (2840:3): [True: 0, False: 116k]
  ------------------
 2841|       |    return NULL;
 2842|   116k|  }
 2843|   116k|}
pn_event_transport:
 2846|  17.2k|{
 2847|  17.2k|  switch (pn_class_id(pn_event_class(event))) {
 2848|  17.2k|  case CID_pn_transport:
  ------------------
  |  Branch (2848:3): [True: 17.2k, False: 0]
  ------------------
 2849|  17.2k|    return (pn_transport_t *) pn_event_context(event);
 2850|      0|  default:
  ------------------
  |  Branch (2850:3): [True: 0, False: 17.2k]
  ------------------
 2851|      0|    {
 2852|      0|      pn_connection_t *conn = pn_event_connection(event);
 2853|      0|      if (conn)
  ------------------
  |  Branch (2853:11): [True: 0, False: 0]
  ------------------
 2854|      0|        return pn_connection_transport(conn);
 2855|      0|      return NULL;
 2856|      0|    }
 2857|  17.2k|  }
 2858|  17.2k|}
engine.c:pn_endpoint_open:
   95|   103k|{
   96|   103k|  if (!(endpoint->state & PN_LOCAL_ACTIVE)) {
  ------------------
  |  |   55|   103k|#define PN_LOCAL_ACTIVE (2)
  ------------------
  |  Branch (96:7): [True: 103k, False: 0]
  ------------------
   97|   103k|    PN_SET_LOCAL(endpoint->state, PN_LOCAL_ACTIVE);
  ------------------
  |  |  424|   103k|  (OLD) = ((OLD) & PN_REMOTE_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   87|   103k|#define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   103k|#define PN_REMOTE_UNINIT (8)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|   103k|#define PN_REMOTE_ACTIVE (16)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|   103k|#define PN_REMOTE_CLOSED (32)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   98|   103k|    pn_connection_t *conn = pni_ep_get_connection(endpoint);
   99|   103k|    pn_collector_put_object(conn->collector, endpoint,
  100|   103k|                            endpoint_event((pn_endpoint_type_t) endpoint->type, true));
  101|       |    pn_modified(conn, endpoint, true);
  102|   103k|  }
  103|   103k|}
engine.c:endpoint_event:
   79|   114k|static pn_event_type_t endpoint_event(pn_endpoint_type_t type, bool open) {
   80|   114k|  switch (type) {
   81|  45.0k|  case CONNECTION:
  ------------------
  |  Branch (81:3): [True: 45.0k, False: 69.2k]
  ------------------
   82|  45.0k|    return open ? PN_CONNECTION_LOCAL_OPEN : PN_CONNECTION_LOCAL_CLOSE;
  ------------------
  |  Branch (82:12): [True: 34.6k, False: 10.4k]
  ------------------
   83|  34.6k|  case SESSION:
  ------------------
  |  Branch (83:3): [True: 34.6k, False: 79.6k]
  ------------------
   84|  34.6k|    return open ? PN_SESSION_LOCAL_OPEN : PN_SESSION_LOCAL_CLOSE;
  ------------------
  |  Branch (84:12): [True: 34.6k, False: 0]
  ------------------
   85|      0|  case SENDER:
  ------------------
  |  Branch (85:3): [True: 0, False: 114k]
  ------------------
   86|  34.6k|  case RECEIVER:
  ------------------
  |  Branch (86:3): [True: 34.6k, False: 79.6k]
  ------------------
   87|  34.6k|    return open ? PN_LINK_LOCAL_OPEN : PN_LINK_LOCAL_CLOSE;
  ------------------
  |  Branch (87:12): [True: 34.6k, False: 0]
  ------------------
   88|      0|  default:
  ------------------
  |  Branch (88:3): [True: 0, False: 114k]
  ------------------
   89|       |    assert(false);
   90|      0|    return PN_EVENT_NONE;
   91|   114k|  }
   92|   114k|}
engine.c:pn_endpoint_close:
  106|   235k|{
  107|   235k|  if (!(endpoint->state & PN_LOCAL_CLOSED)) {
  ------------------
  |  |   60|   235k|#define PN_LOCAL_CLOSED (4)
  ------------------
  |  Branch (107:7): [True: 10.4k, False: 225k]
  ------------------
  108|  10.4k|    PN_SET_LOCAL(endpoint->state, PN_LOCAL_CLOSED);
  ------------------
  |  |  424|  10.4k|  (OLD) = ((OLD) & PN_REMOTE_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   87|  10.4k|#define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  10.4k|#define PN_REMOTE_UNINIT (8)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|  10.4k|#define PN_REMOTE_ACTIVE (16)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|  10.4k|#define PN_REMOTE_CLOSED (32)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  109|  10.4k|    pn_connection_t *conn = pni_ep_get_connection(endpoint);
  110|  10.4k|    pn_collector_put_object(conn->collector, endpoint,
  111|  10.4k|                            endpoint_event((pn_endpoint_type_t) endpoint->type, false));
  112|       |    pn_modified(conn, endpoint, true);
  113|  10.4k|  }
  114|   235k|}
engine.c:pni_remove_session:
  265|  2.59M|{
  266|  2.59M|  if (pn_list_remove(conn->sessions, ssn)) {
  ------------------
  |  Branch (266:7): [True: 1.29M, False: 1.29M]
  ------------------
  267|  1.29M|    pn_ep_decref(&conn->endpoint);
  268|  1.29M|    LL_REMOVE(conn, endpoint, &ssn->endpoint);
  ------------------
  |  |  261|  1.29M|  {                                                                    \
  |  |  262|  1.29M|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (262:9): [True: 0, False: 1.29M]
  |  |  ------------------
  |  |  263|  1.29M|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  264|  1.29M|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (264:9): [True: 1.26M, False: 34.6k]
  |  |  ------------------
  |  |  265|  1.29M|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  266|  1.29M|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  234|  1.29M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (266:9): [True: 1.29M, False: 0]
  |  |  ------------------
  |  |  267|  1.29M|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  234|  1.29M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  268|  1.29M|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  235|  1.29M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (268:9): [True: 34.6k, False: 1.26M]
  |  |  ------------------
  |  |  269|  1.29M|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  235|  34.6k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  270|  1.29M|  }
  ------------------
  269|  1.29M|  }
  270|  2.59M|}
engine.c:pni_remove_link:
  334|  2.82M|{
  335|  2.82M|  if (pn_list_remove(ssn->links, link)) {
  ------------------
  |  Branch (335:7): [True: 1.41M, False: 1.41M]
  ------------------
  336|  1.41M|    pn_ep_decref(&ssn->endpoint);
  337|  1.41M|    LL_REMOVE(ssn->connection, endpoint, &link->endpoint);
  ------------------
  |  |  261|  1.41M|  {                                                                    \
  |  |  262|  1.41M|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (262:9): [True: 1.41M, False: 0]
  |  |  ------------------
  |  |  263|  1.41M|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  264|  1.41M|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (264:9): [True: 1.38M, False: 31.5k]
  |  |  ------------------
  |  |  265|  1.41M|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  266|  1.41M|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  234|  1.41M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (266:9): [True: 0, False: 1.41M]
  |  |  ------------------
  |  |  267|  1.41M|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  234|      0|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  268|  1.41M|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  235|  1.41M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (268:9): [True: 31.5k, False: 1.38M]
  |  |  ------------------
  |  |  269|  1.41M|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  235|  31.5k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  270|  1.41M|  }
  ------------------
  338|  1.41M|  }
  339|  2.82M|}
engine.c:pni_ep_get_connection:
   65|  10.1M|{
   66|  10.1M|  switch (endpoint->type) {
  ------------------
  |  Branch (66:11): [True: 10.1M, False: 0]
  ------------------
   67|  79.6k|  case CONNECTION:
  ------------------
  |  Branch (67:3): [True: 79.6k, False: 10.0M]
  ------------------
   68|  79.6k|    return (pn_connection_t *) endpoint;
   69|  5.51M|  case SESSION:
  ------------------
  |  Branch (69:3): [True: 5.51M, False: 4.64M]
  ------------------
   70|  5.51M|    return ((pn_session_t *) endpoint)->connection;
   71|   791k|  case SENDER:
  ------------------
  |  Branch (71:3): [True: 791k, False: 9.37M]
  ------------------
   72|  4.56M|  case RECEIVER:
  ------------------
  |  Branch (72:3): [True: 3.77M, False: 6.38M]
  ------------------
   73|  4.56M|    return ((pn_link_t *) endpoint)->session->connection;
   74|  10.1M|  }
   75|       |
   76|      0|  return NULL;
   77|  10.1M|}
engine.c:pn_final_type:
  439|   297k|static pn_event_type_t pn_final_type(pn_endpoint_type_t type) {
  440|   297k|  switch (type) {
  441|  34.6k|  case CONNECTION:
  ------------------
  |  Branch (441:3): [True: 34.6k, False: 263k]
  ------------------
  442|  34.6k|    return PN_CONNECTION_FINAL;
  443|  63.9k|  case SESSION:
  ------------------
  |  Branch (443:3): [True: 63.9k, False: 233k]
  ------------------
  444|  63.9k|    return PN_SESSION_FINAL;
  445|  10.8k|  case SENDER:
  ------------------
  |  Branch (445:3): [True: 10.8k, False: 286k]
  ------------------
  446|   199k|  case RECEIVER:
  ------------------
  |  Branch (446:3): [True: 188k, False: 109k]
  ------------------
  447|   199k|    return PN_LINK_FINAL;
  448|      0|  default:
  ------------------
  |  Branch (448:3): [True: 0, False: 297k]
  ------------------
  449|       |    assert(false);
  450|      0|    return PN_EVENT_NONE;
  451|   297k|  }
  452|   297k|}
engine.c:pn_connection_finalize:
  504|  34.6k|{
  505|  34.6k|  pn_connection_t *conn = (pn_connection_t *) object;
  506|  34.6k|  pn_endpoint_t *endpoint = &conn->endpoint;
  507|       |
  508|  34.6k|  if (conn->transport) {
  ------------------
  |  Branch (508:7): [True: 0, False: 34.6k]
  ------------------
  509|      0|    assert(!conn->transport->referenced);
  510|      0|    pn_free(conn->transport);
  511|      0|  }
  512|       |
  513|       |  // freeing the transport could post events
  514|  34.6k|  if (pn_refcount(conn) > 0) {
  ------------------
  |  Branch (514:7): [True: 0, False: 34.6k]
  ------------------
  515|      0|    return;
  516|      0|  }
  517|       |
  518|  34.6k|  pni_free_children(conn->sessions, conn->freed);
  519|  34.6k|  pn_free(conn->context);
  520|  34.6k|  pn_decref(conn->collector);
  521|       |
  522|  34.6k|  pn_free(conn->container);
  523|  34.6k|  pn_free(conn->hostname);
  524|  34.6k|  pn_free(conn->auth_user);
  525|  34.6k|  pn_free(conn->authzid);
  526|  34.6k|  pn_free(conn->auth_password);
  527|  34.6k|  pn_bytes_free(conn->offered_capabilities_raw);
  528|  34.6k|  pn_bytes_free(conn->desired_capabilities_raw);
  529|  34.6k|  pn_bytes_free(conn->properties_raw);
  530|  34.6k|  pn_free(conn->offered_capabilities);
  531|  34.6k|  pn_free(conn->desired_capabilities);
  532|  34.6k|  pn_free(conn->properties);
  533|  34.6k|  pn_free(conn->remote_offered_capabilities);
  534|  34.6k|  pn_free(conn->remote_desired_capabilities);
  535|  34.6k|  pn_free(conn->remote_properties);
  536|  34.6k|  pni_endpoint_tini(endpoint);
  537|  34.6k|  pn_free(conn->delivery_pool);
  538|  34.6k|}
engine.c:pni_free_children:
  486|  1.33M|{
  487|  1.33M|  while (pn_list_size(children) > 0) {
  ------------------
  |  Branch (487:10): [True: 0, False: 1.33M]
  ------------------
  488|      0|    pn_endpoint_t *endpoint = (pn_endpoint_t *) pn_list_get(children, 0);
  489|      0|    assert(!endpoint->referenced);
  490|      0|    pn_free(endpoint);
  491|      0|  }
  492|       |
  493|  1.33M|  while (pn_list_size(freed) > 0) {
  ------------------
  |  Branch (493:10): [True: 0, False: 1.33M]
  ------------------
  494|      0|    pn_endpoint_t *endpoint = (pn_endpoint_t *) pn_list_get(freed, 0);
  495|      0|    assert(!endpoint->referenced);
  496|      0|    pn_free(endpoint);
  497|      0|  }
  498|       |
  499|  1.33M|  pn_free(children);
  500|  1.33M|  pn_free(freed);
  501|  1.33M|}
engine.c:pni_endpoint_tini:
  480|  2.74M|{
  481|  2.74M|  pn_condition_tini(&endpoint->remote_condition);
  482|  2.74M|  pn_condition_tini(&endpoint->condition);
  483|  2.74M|}
engine.c:pn_delivery_incref:
 1627|   425k|{
 1628|   425k|  pn_delivery_t *delivery = (pn_delivery_t *) object;
 1629|   425k|  if (delivery->link && !delivery->referenced) {
  ------------------
  |  Branch (1629:7): [True: 276k, False: 148k]
  |  Branch (1629:25): [True: 175k, False: 101k]
  ------------------
 1630|   175k|    delivery->referenced = true;
 1631|   175k|    pn_incref(delivery->link);
 1632|   250k|  } else {
 1633|   250k|    pn_object_incref(object);
 1634|   250k|  }
 1635|   425k|}
engine.c:pn_delivery_finalize:
 1644|   311k|{
 1645|   311k|  pn_delivery_t *delivery = (pn_delivery_t *) object;
 1646|   311k|  pn_link_t *link = delivery->link;
 1647|       |  //  assert(!delivery->state.init);
 1648|       |
 1649|   311k|  bool pooled = false;
 1650|   311k|  bool referenced = true;
 1651|   311k|  if (link) {
  ------------------
  |  Branch (1651:7): [True: 277k, False: 33.2k]
  ------------------
 1652|   277k|    if (pni_link_live(link) && pni_preserve_delivery(delivery) && delivery->referenced) {
  ------------------
  |  Branch (1652:9): [True: 277k, False: 0]
  |  Branch (1652:32): [True: 187k, False: 90.5k]
  |  Branch (1652:67): [True: 187k, False: 0]
  ------------------
 1653|   187k|      delivery->referenced = false;
 1654|   187k|      pn_object_incref(delivery);
 1655|   187k|      pn_decref(link);
 1656|   187k|      return;
 1657|   187k|    }
 1658|  90.5k|    referenced = delivery->referenced;
 1659|       |
 1660|  90.5k|    pn_clear_tpwork(delivery);
 1661|  90.5k|    LL_REMOVE(link, unsettled, delivery);
  ------------------
  |  |  261|  90.5k|  {                                                                    \
  |  |  262|  90.5k|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (262:9): [True: 92, False: 90.4k]
  |  |  ------------------
  |  |  263|  90.5k|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  264|  90.5k|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (264:9): [True: 2.79k, False: 87.7k]
  |  |  ------------------
  |  |  265|  90.5k|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  266|  90.5k|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  234|  90.5k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (266:9): [True: 90.4k, False: 92]
  |  |  ------------------
  |  |  267|  90.5k|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  234|  90.4k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  268|  90.5k|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  235|  90.5k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (268:9): [True: 87.7k, False: 2.79k]
  |  |  ------------------
  |  |  269|  90.5k|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  235|  87.7k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  270|  90.5k|  }
  ------------------
 1662|  90.5k|    pn_delivery_map_del(pn_link_is_sender(link)
  ------------------
  |  Branch (1662:25): [True: 578, False: 89.9k]
  ------------------
 1663|  90.5k|                        ? &link->session->state.outgoing
 1664|  90.5k|                        : &link->session->state.incoming,
 1665|  90.5k|                        delivery);
 1666|  90.5k|    pn_bytes_free(delivery->tag);
 1667|  90.5k|    delivery->tag = (pn_delivery_tag_t){0, NULL};
 1668|  90.5k|    pn_buffer_clear(delivery->bytes);
 1669|  90.5k|    pn_record_clear(delivery->context);
 1670|  90.5k|    delivery->settled = true;
 1671|  90.5k|    pn_connection_t *conn = link->session->connection;
 1672|  90.5k|    assert(pn_refcount(delivery) == 0);
 1673|  90.5k|    if (pni_connection_live(conn)) {
  ------------------
  |  Branch (1673:9): [True: 90.5k, False: 0]
  ------------------
 1674|  90.5k|      pn_list_t *pool = link->session->connection->delivery_pool;
 1675|  90.5k|      delivery->link = NULL;
 1676|  90.5k|      pn_list_add(pool, delivery);
 1677|  90.5k|      pooled = true;
 1678|  90.5k|      assert(pn_refcount(delivery) == 1);
 1679|  90.5k|    }
 1680|  90.5k|  }
 1681|       |
 1682|   123k|  if (!pooled) {
  ------------------
  |  Branch (1682:7): [True: 33.2k, False: 90.5k]
  ------------------
 1683|  33.2k|    pn_free(delivery->context);
 1684|  33.2k|    pn_bytes_free(delivery->tag);
 1685|  33.2k|    delivery->tag = (pn_delivery_tag_t){0, NULL};
 1686|  33.2k|    pn_buffer_free(delivery->bytes);
 1687|  33.2k|    pn_disposition_finalize(&delivery->local);
 1688|  33.2k|    pn_disposition_finalize(&delivery->remote);
 1689|  33.2k|  }
 1690|       |
 1691|   123k|  if (referenced) {
  ------------------
  |  Branch (1691:7): [True: 112k, False: 11.4k]
  ------------------
 1692|   112k|    pn_decref(link);
 1693|   112k|  }
 1694|   123k|}
engine.c:pni_link_live:
  968|   277k|static bool pni_link_live(pn_link_t *link) {
  969|   277k|  return pni_session_live(link->session) || pn_refcount(link) > 1;
  ------------------
  |  Branch (969:10): [True: 277k, False: 0]
  |  Branch (969:45): [True: 0, False: 0]
  ------------------
  970|   277k|}
engine.c:pni_session_live:
  964|  3.19M|static bool pni_session_live(pn_session_t *ssn) {
  965|  3.19M|  return pni_connection_live(ssn->connection) || pn_refcount(ssn) > 1;
  ------------------
  |  Branch (965:10): [True: 3.19M, False: 0]
  |  Branch (965:50): [True: 0, False: 0]
  ------------------
  966|  3.19M|}
engine.c:pni_preserve_delivery:
 1638|   277k|{
 1639|   277k|  pn_connection_t *conn = delivery->link->session->connection;
 1640|   277k|  return !delivery->local.settled || (conn->transport && (delivery->state.init || delivery->tpwork));
  ------------------
  |  Branch (1640:10): [True: 106k, False: 171k]
  |  Branch (1640:39): [True: 144k, False: 26.6k]
  |  Branch (1640:59): [True: 16.6k, False: 128k]
  |  Branch (1640:83): [True: 64.2k, False: 63.9k]
  ------------------
 1641|   277k|}
engine.c:pni_connection_live:
  960|  7.40M|static bool pni_connection_live(pn_connection_t *conn) {
  961|  7.40M|  return pn_refcount(conn) > 1;
  962|  7.40M|}
engine.c:pni_add_work:
  753|   138k|{
  754|   138k|  if (!delivery->work)
  ------------------
  |  Branch (754:7): [True: 90.9k, False: 47.2k]
  ------------------
  755|  90.9k|  {
  756|  90.9k|    LL_ADD(connection, work, delivery);
  ------------------
  |  |  237|  90.9k|  {                                                           \
  |  |  238|  90.9k|    (NODE)-> LIST ## _next = NULL;                            \
  |  |  239|  90.9k|    (NODE)-> LIST ## _prev = (ROOT)-> LIST ## _tail;          \
  |  |  240|  90.9k|    if (LL_TAIL(ROOT, LIST))                                  \
  |  |  ------------------
  |  |  |  |  235|  90.9k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (235:29): [True: 84.2k, False: 6.74k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  241|  90.9k|      LL_TAIL(ROOT, LIST)-> LIST ## _next = (NODE);           \
  |  |  ------------------
  |  |  |  |  235|  84.2k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  242|  90.9k|    LL_TAIL(ROOT, LIST) = (NODE);                             \
  |  |  ------------------
  |  |  |  |  235|  90.9k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  243|  90.9k|    if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  234|  90.9k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |                   if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  234|  6.74k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (243:9): [True: 6.74k, False: 84.2k]
  |  |  ------------------
  |  |  244|  90.9k|  }
  ------------------
  757|       |    delivery->work = true;
  758|  90.9k|  }
  759|   138k|}
engine.c:pni_clear_work:
  762|   176k|{
  763|   176k|  if (delivery->work)
  ------------------
  |  Branch (763:7): [True: 90.9k, False: 85.4k]
  ------------------
  764|  90.9k|  {
  765|  90.9k|    LL_REMOVE(connection, work, delivery);
  ------------------
  |  |  261|  90.9k|  {                                                                    \
  |  |  262|  90.9k|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (262:9): [True: 56.4k, False: 34.4k]
  |  |  ------------------
  |  |  263|  90.9k|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  264|  90.9k|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (264:9): [True: 79.9k, False: 11.0k]
  |  |  ------------------
  |  |  265|  90.9k|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  266|  90.9k|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  234|  90.9k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (266:9): [True: 34.4k, False: 56.4k]
  |  |  ------------------
  |  |  267|  90.9k|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  234|  34.4k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  268|  90.9k|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  235|  90.9k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (268:9): [True: 11.0k, False: 79.9k]
  |  |  ------------------
  |  |  269|  90.9k|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  235|  11.0k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  270|  90.9k|  }
  ------------------
  766|       |    delivery->work = false;
  767|  90.9k|  }
  768|   176k|}
engine.c:pni_matches:
  853|  2.88M|{
  854|  2.88M|  if (endpoint->type != type) return false;
  ------------------
  |  Branch (854:7): [True: 1.54M, False: 1.33M]
  ------------------
  855|       |
  856|  1.33M|  if (!state) return true;
  ------------------
  |  Branch (856:7): [True: 1.33M, False: 0]
  ------------------
  857|       |
  858|      0|  int st = endpoint->state;
  859|      0|  if ((state & PN_REMOTE_MASK) == 0 || (state & PN_LOCAL_MASK) == 0)
  ------------------
  |  |   87|      0|#define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  ------------------
  |  |  |  |   65|      0|#define PN_REMOTE_UNINIT (8)
  |  |  ------------------
  |  |               #define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  ------------------
  |  |  |  |   70|      0|#define PN_REMOTE_ACTIVE (16)
  |  |  ------------------
  |  |               #define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  ------------------
  |  |  |  |   75|      0|#define PN_REMOTE_CLOSED (32)
  |  |  ------------------
  ------------------
                if ((state & PN_REMOTE_MASK) == 0 || (state & PN_LOCAL_MASK) == 0)
  ------------------
  |  |   81|      0|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  ------------------
  |  |  |  |   50|      0|#define PN_LOCAL_UNINIT (1)
  |  |  ------------------
  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  ------------------
  |  |  |  |   55|      0|#define PN_LOCAL_ACTIVE (2)
  |  |  ------------------
  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  ------------------
  |  |  |  |   60|      0|#define PN_LOCAL_CLOSED (4)
  |  |  ------------------
  ------------------
  |  Branch (859:7): [True: 0, False: 0]
  |  Branch (859:40): [True: 0, False: 0]
  ------------------
  860|      0|    return st & state;
  861|      0|  else
  862|      0|    return st == state;
  863|      0|}
engine.c:pn_session_incref:
  925|  6.92M|{
  926|  6.92M|  pn_session_t *session = (pn_session_t *) object;
  927|  6.92M|  if (!session->endpoint.referenced) {
  ------------------
  |  Branch (927:7): [True: 2.81M, False: 4.10M]
  ------------------
  928|  2.81M|    session->endpoint.referenced = true;
  929|  2.81M|    pn_incref(session->connection);
  930|  4.10M|  } else {
  931|  4.10M|    pn_object_incref(object);
  932|  4.10M|  }
  933|  6.92M|}
engine.c:pn_session_finalize:
 1004|  4.11M|{
 1005|  4.11M|  pn_session_t *session = (pn_session_t *) object;
 1006|  4.11M|  pn_endpoint_t *endpoint = &session->endpoint;
 1007|       |
 1008|  4.11M|  if (pni_preserve_child(endpoint)) {
  ------------------
  |  Branch (1008:7): [True: 2.81M, False: 1.29M]
  ------------------
 1009|  2.81M|    return;
 1010|  2.81M|  }
 1011|       |
 1012|  1.29M|  pn_free(session->context);
 1013|  1.29M|  pni_free_children(session->links, session->freed);
 1014|  1.29M|  pni_endpoint_tini(endpoint);
 1015|  1.29M|  pn_delivery_map_free(&session->state.incoming);
 1016|  1.29M|  pn_delivery_map_free(&session->state.outgoing);
 1017|  1.29M|  pn_free(session->state.local_handles);
 1018|  1.29M|  pn_free(session->state.remote_handles);
 1019|  1.29M|  pni_remove_session(session->connection, session);
 1020|  1.29M|  pn_list_remove(session->connection->freed, session);
 1021|       |
 1022|  1.29M|  if (session->connection->transport) {
  ------------------
  |  Branch (1022:7): [True: 0, False: 1.29M]
  ------------------
 1023|      0|    pn_transport_t *transport = session->connection->transport;
 1024|      0|    pn_hash_del(transport->local_channels, session->state.local_channel);
 1025|      0|    pn_hash_del(transport->remote_channels, session->state.remote_channel);
 1026|      0|  }
 1027|       |
 1028|  1.29M|  if (endpoint->referenced) {
  ------------------
  |  Branch (1028:7): [True: 1.29M, False: 0]
  ------------------
 1029|  1.29M|    pn_decref(session->connection);
 1030|  1.29M|  }
 1031|  1.29M|}
engine.c:pni_preserve_child:
  988|  7.03M|{
  989|  7.03M|  pn_connection_t *conn = pni_ep_get_connection(endpoint);
  990|  7.03M|  pn_endpoint_t *parent = pn_ep_parent(endpoint);
  991|  7.03M|  if (pni_endpoint_live(parent) && (!endpoint->freed || (pn_ep_bound(endpoint)))
  ------------------
  |  Branch (991:7): [True: 7.03M, False: 0]
  |  Branch (991:37): [True: 4.32M, False: 2.71M]
  |  Branch (991:57): [True: 0, False: 2.71M]
  ------------------
  992|  4.32M|      && endpoint->referenced) {
  ------------------
  |  Branch (992:10): [True: 4.32M, False: 0]
  ------------------
  993|  4.32M|    pn_object_incref(endpoint);
  994|  4.32M|    endpoint->referenced = false;
  995|  4.32M|    pn_decref(parent);
  996|  4.32M|    return true;
  997|  4.32M|  } else {
  998|  2.71M|    LL_REMOVE(conn, transport, endpoint);
  ------------------
  |  |  261|  2.71M|  {                                                                    \
  |  |  262|  2.71M|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (262:9): [True: 2.71M, False: 0]
  |  |  ------------------
  |  |  263|  2.71M|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  264|  2.71M|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (264:9): [True: 2.64M, False: 66.1k]
  |  |  ------------------
  |  |  265|  2.71M|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  266|  2.71M|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  234|  2.71M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (266:9): [True: 0, False: 2.71M]
  |  |  ------------------
  |  |  267|  2.71M|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  234|      0|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  268|  2.71M|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  235|  2.71M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (268:9): [True: 66.1k, False: 2.64M]
  |  |  ------------------
  |  |  269|  2.71M|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  235|  66.1k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  270|  2.71M|  }
  ------------------
  999|       |    return false;
 1000|  2.71M|  }
 1001|  7.03M|}
engine.c:pn_ep_parent:
  454|  7.03M|static pn_endpoint_t *pn_ep_parent(pn_endpoint_t *endpoint) {
  455|  7.03M|  switch (endpoint->type) {
  456|      0|  case CONNECTION:
  ------------------
  |  Branch (456:3): [True: 0, False: 7.03M]
  ------------------
  457|      0|    return NULL;
  458|  4.11M|  case SESSION:
  ------------------
  |  Branch (458:3): [True: 4.11M, False: 2.91M]
  ------------------
  459|  4.11M|    return &((pn_session_t *) endpoint)->connection->endpoint;
  460|   520k|  case SENDER:
  ------------------
  |  Branch (460:3): [True: 520k, False: 6.51M]
  ------------------
  461|  2.91M|  case RECEIVER:
  ------------------
  |  Branch (461:3): [True: 2.39M, False: 4.63M]
  ------------------
  462|  2.91M|    return &((pn_link_t *) endpoint)->session->endpoint;
  463|      0|  default:
  ------------------
  |  Branch (463:3): [True: 0, False: 7.03M]
  ------------------
  464|      0|    assert(false);
  465|       |    return NULL;
  466|  7.03M|  }
  467|  7.03M|}
engine.c:pni_endpoint_live:
  972|  7.03M|static bool pni_endpoint_live(pn_endpoint_t *endpoint) {
  973|  7.03M|  switch (endpoint->type) {
  974|  4.11M|  case CONNECTION:
  ------------------
  |  Branch (974:3): [True: 4.11M, False: 2.91M]
  ------------------
  975|  4.11M|    return pni_connection_live((pn_connection_t *)endpoint);
  976|  2.91M|  case SESSION:
  ------------------
  |  Branch (976:3): [True: 2.91M, False: 4.11M]
  ------------------
  977|  2.91M|    return pni_session_live((pn_session_t *) endpoint);
  978|      0|  case SENDER:
  ------------------
  |  Branch (978:3): [True: 0, False: 7.03M]
  ------------------
  979|      0|  case RECEIVER:
  ------------------
  |  Branch (979:3): [True: 0, False: 7.03M]
  ------------------
  980|      0|    return pni_link_live((pn_link_t *) endpoint);
  981|      0|  default:
  ------------------
  |  Branch (981:3): [True: 0, False: 7.03M]
  ------------------
  982|      0|    assert(false);
  983|       |    return false;
  984|  7.03M|  }
  985|  7.03M|}
engine.c:pn_ep_bound:
  936|  2.71M|{
  937|  2.71M|  pn_connection_t *conn = pni_ep_get_connection(endpoint);
  938|  2.71M|  pn_session_t *ssn;
  939|  2.71M|  pn_link_t *lnk;
  940|       |
  941|  2.71M|  if (!conn->transport) return false;
  ------------------
  |  Branch (941:7): [True: 2.71M, False: 0]
  ------------------
  942|      0|  if (endpoint->modified) return true;
  ------------------
  |  Branch (942:7): [True: 0, False: 0]
  ------------------
  943|       |
  944|      0|  switch (endpoint->type) {
  945|      0|  case CONNECTION:
  ------------------
  |  Branch (945:3): [True: 0, False: 0]
  ------------------
  946|      0|    return ((pn_connection_t *)endpoint)->transport != NULL;
  947|      0|  case SESSION:
  ------------------
  |  Branch (947:3): [True: 0, False: 0]
  ------------------
  948|      0|    ssn = (pn_session_t *) endpoint;
  949|      0|    return (((int16_t) ssn->state.local_channel) >= 0 || ((int16_t) ssn->state.remote_channel) >= 0);
  ------------------
  |  Branch (949:13): [True: 0, False: 0]
  |  Branch (949:58): [True: 0, False: 0]
  ------------------
  950|      0|  case SENDER:
  ------------------
  |  Branch (950:3): [True: 0, False: 0]
  ------------------
  951|      0|  case RECEIVER:
  ------------------
  |  Branch (951:3): [True: 0, False: 0]
  ------------------
  952|      0|    lnk = (pn_link_t *) endpoint;
  953|      0|    return ((int32_t) lnk->state.local_handle) >= 0 || ((int32_t) lnk->state.remote_handle) >= 0;
  ------------------
  |  Branch (953:12): [True: 0, False: 0]
  |  Branch (953:56): [True: 0, False: 0]
  ------------------
  954|      0|  default:
  ------------------
  |  Branch (954:3): [True: 0, False: 0]
  ------------------
  955|      0|    assert(false);
  956|       |    return false;
  957|      0|  }
  958|      0|}
engine.c:pni_add_session:
  257|  1.29M|{
  258|  1.29M|  pn_list_add(conn->sessions, ssn);
  259|  1.29M|  ssn->connection = conn;
  260|  1.29M|  pn_incref(conn);  // keep around until finalized
  261|  1.29M|  pn_ep_incref(&conn->endpoint);
  262|  1.29M|}
engine.c:pni_session_bound:
 1086|  1.29M|{
 1087|  1.29M|  assert(ssn);
 1088|  1.29M|  size_t nlinks = pn_list_size(ssn->links);
 1089|  1.33M|  for (size_t i = 0; i < nlinks; i++) {
  ------------------
  |  Branch (1089:22): [True: 34.6k, False: 1.29M]
  ------------------
 1090|  34.6k|    pni_link_bound((pn_link_t *) pn_list_get(ssn->links, i));
 1091|  34.6k|  }
 1092|  1.29M|}
engine.c:pn_link_incref:
 1231|  4.64M|{
 1232|  4.64M|  pn_link_t *link = (pn_link_t *) object;
 1233|  4.64M|  if (!link->endpoint.referenced) {
  ------------------
  |  Branch (1233:7): [True: 1.50M, False: 3.14M]
  ------------------
 1234|  1.50M|    link->endpoint.referenced = true;
 1235|  1.50M|    pn_incref(link->session);
 1236|  3.14M|  } else {
 1237|  3.14M|    pn_object_incref(object);
 1238|  3.14M|  }
 1239|  4.64M|}
engine.c:pn_link_finalize:
 1242|  2.91M|{
 1243|  2.91M|  pn_link_t *link = (pn_link_t *) object;
 1244|  2.91M|  pn_endpoint_t *endpoint = &link->endpoint;
 1245|       |
 1246|  2.91M|  if (pni_preserve_child(endpoint)) {
  ------------------
  |  Branch (1246:7): [True: 1.50M, False: 1.41M]
  ------------------
 1247|  1.50M|    return;
 1248|  1.50M|  }
 1249|       |
 1250|  1.42M|  while (link->unsettled_head) {
  ------------------
  |  Branch (1250:10): [True: 11.4k, False: 1.41M]
  ------------------
 1251|  11.4k|    assert(!link->unsettled_head->referenced);
 1252|  11.4k|    pn_free(link->unsettled_head);
 1253|  11.4k|  }
 1254|       |
 1255|  1.41M|  pn_bytes_free(link->more_tag);
 1256|  1.41M|  pn_free(link->context);
 1257|  1.41M|  pni_terminus_free(&link->source);
 1258|  1.41M|  pni_terminus_free(&link->target);
 1259|  1.41M|  pni_terminus_free(&link->remote_source);
 1260|  1.41M|  pni_terminus_free(&link->remote_target);
 1261|  1.41M|  pn_free(link->name);
 1262|  1.41M|  pni_endpoint_tini(endpoint);
 1263|  1.41M|  pni_remove_link(link->session, link);
 1264|  1.41M|  pn_hash_del(link->session->state.local_handles, link->state.local_handle);
 1265|  1.41M|  pn_hash_del(link->session->state.remote_handles, link->state.remote_handle);
 1266|  1.41M|  pn_list_remove(link->session->freed, link);
 1267|  1.41M|  if (endpoint->referenced) {
  ------------------
  |  Branch (1267:7): [True: 1.41M, False: 0]
  ------------------
 1268|  1.41M|    pn_decref(link->session);
 1269|  1.41M|  }
 1270|  1.41M|  pn_free(link->properties);
 1271|  1.41M|  pn_bytes_free(link->properties_raw);
 1272|  1.41M|  pn_free(link->remote_properties);
 1273|  1.41M|  pn_bytes_free(link->remote_properties_raw);
 1274|  1.41M|}
engine.c:pni_terminus_free:
  365|  5.65M|{
  366|  5.65M|  pn_free(terminus->address);
  367|  5.65M|  pn_bytes_free(terminus->properties_raw);
  368|  5.65M|  pn_bytes_free(terminus->capabilities_raw);
  369|  5.65M|  pn_bytes_free(terminus->outcomes_raw);
  370|  5.65M|  pn_bytes_free(terminus->filter_raw);
  371|  5.65M|  pn_free(terminus->properties);
  372|  5.65M|  pn_free(terminus->capabilities);
  373|  5.65M|  pn_free(terminus->outcomes);
  374|  5.65M|  pn_free(terminus->filter);
  375|  5.65M|}
engine.c:pni_add_link:
  327|  1.41M|{
  328|  1.41M|  pn_list_add(ssn->links, link);
  329|  1.41M|  link->session = ssn;
  330|  1.41M|  pn_ep_incref(&ssn->endpoint);
  331|  1.41M|}
engine.c:pni_terminus_init:
 1211|  5.65M|{
 1212|  5.65M|  terminus->type = type;
 1213|  5.65M|  terminus->address = pn_string(NULL);
 1214|  5.65M|  terminus->durability = PN_NONDURABLE;
 1215|  5.65M|  terminus->has_expiry_policy = false;
 1216|  5.65M|  terminus->expiry_policy = PN_EXPIRE_WITH_SESSION;
 1217|  5.65M|  terminus->timeout = 0;
 1218|  5.65M|  terminus->dynamic = false;
 1219|  5.65M|  terminus->distribution_mode = PN_DIST_MODE_UNSPECIFIED;
 1220|  5.65M|  terminus->properties_raw = (pn_bytes_t){0, NULL};
 1221|  5.65M|  terminus->capabilities_raw = (pn_bytes_t){0, NULL};
 1222|  5.65M|  terminus->outcomes_raw = (pn_bytes_t){0, NULL};
 1223|  5.65M|  terminus->filter_raw = (pn_bytes_t){0, NULL};
 1224|  5.65M|  terminus->properties = NULL;
 1225|  5.65M|  terminus->capabilities = NULL;
 1226|  5.65M|  terminus->outcomes = NULL;
 1227|       |  terminus->filter = NULL;
 1228|  5.65M|}
engine.c:pni_link_bound:
 1342|  1.41M|{
 1343|  1.41M|}
engine.c:pn_disposition_finalize:
 1596|   344k|{
 1597|   344k|  switch (ds->type) {
  ------------------
  |  Branch (1597:11): [True: 344k, False: 0]
  ------------------
 1598|   243k|    case PN_DISP_EMPTY:
  ------------------
  |  Branch (1598:5): [True: 243k, False: 101k]
  ------------------
 1599|   243k|      break;
 1600|    103|    case PN_DISP_RECEIVED:
  ------------------
  |  Branch (1600:5): [True: 103, False: 344k]
  ------------------
 1601|    103|      break;
 1602|  11.0k|    case PN_DISP_MODIFIED:
  ------------------
  |  Branch (1602:5): [True: 11.0k, False: 333k]
  ------------------
 1603|  11.0k|      pn_data_free(ds->u.s_modified.annotations);
 1604|  11.0k|      pn_bytes_free(ds->u.s_modified.annotations_raw);
 1605|  11.0k|      break;
 1606|  7.63k|    case PN_DISP_REJECTED:
  ------------------
  |  Branch (1606:5): [True: 7.63k, False: 337k]
  ------------------
 1607|  7.63k|      pn_condition_tini(&ds->u.s_rejected.condition);
 1608|  7.63k|      break;
 1609|  76.4k|    case PN_DISP_ACCEPTED:
  ------------------
  |  Branch (1609:5): [True: 76.4k, False: 268k]
  ------------------
 1610|  76.7k|    case PN_DISP_RELEASED:
  ------------------
  |  Branch (1610:5): [True: 285, False: 344k]
  ------------------
 1611|  76.7k|      break;
 1612|  1.42k|    case PN_DISP_CUSTOM:
  ------------------
  |  Branch (1612:5): [True: 1.42k, False: 343k]
  ------------------
 1613|  1.42k|      pn_data_free(ds->u.s_custom.data);
 1614|  1.42k|      pn_bytes_free(ds->u.s_custom.data_raw);
 1615|  1.42k|      break;
 1616|  4.19k|    case PN_DISP_TRANSACTIONAL:
  ------------------
  |  Branch (1616:5): [True: 4.19k, False: 340k]
  ------------------
 1617|  4.19k|      pn_bytes_free(ds->u.s_transactional.id);
 1618|  4.19k|      pn_bytes_free(ds->u.s_transactional.outcome_raw);
 1619|  4.19k|      break;
 1620|    221|    case PN_DISP_DECLARED:
  ------------------
  |  Branch (1620:5): [True: 221, False: 344k]
  ------------------
 1621|    221|      pn_bytes_free(ds->u.s_declared.id);
 1622|    221|      break;
 1623|   344k|  }
 1624|   344k|}
engine.c:pn_disposition_init:
 1697|   344k|{
 1698|   344k|  memset(ds, 0, sizeof(*ds));
 1699|   344k|}
engine.c:pni_advance_sender:
 2228|    578|{
 2229|    578|  link->current->done = true;
 2230|       |  /* Skip accounting if the link is aborted and has not sent any frames.
 2231|       |     A delivery that was aborted before sending the first frame was not accounted
 2232|       |     for in pni_process_tpwork_sender() so we don't need to account for it being sent here.
 2233|       |  */
 2234|    578|  bool skip = link->current->aborted && !link->current->state.sending;
  ------------------
  |  Branch (2234:15): [True: 3, False: 575]
  |  Branch (2234:41): [True: 3, False: 0]
  ------------------
 2235|    578|  if (!skip) {
  ------------------
  |  Branch (2235:7): [True: 575, False: 3]
  ------------------
 2236|    575|    link->queued++;
 2237|    575|    link->credit--;
 2238|    575|    link->session->outgoing_deliveries++;
 2239|    575|  }
 2240|    578|  pni_add_tpwork(link->current);
 2241|    578|  link->current = link->current->unsettled_next;
 2242|    578|}
engine.c:pni_advance_receiver:
 2245|  89.9k|{
 2246|  89.9k|  link->credit--;
 2247|  89.9k|  link->queued--;
 2248|  89.9k|  link->session->incoming_deliveries--;
 2249|       |
 2250|  89.9k|  pn_delivery_t *current = link->current;
 2251|  89.9k|  size_t drop_count = pn_buffer_size(current->bytes);
 2252|  89.9k|  pn_buffer_clear(current->bytes);
 2253|       |
 2254|  89.9k|  if (drop_count) {
  ------------------
  |  Branch (2254:7): [True: 15.0k, False: 74.8k]
  ------------------
 2255|  15.0k|    pn_session_t *ssn = link->session;
 2256|  15.0k|    ssn->incoming_bytes -= drop_count;
 2257|  15.0k|    pn_transport_t *t = ssn->connection->transport;
 2258|  15.0k|    if (t) t->buffered_delivery_bytes -= drop_count;
  ------------------
  |  Branch (2258:9): [True: 609, False: 14.4k]
  ------------------
 2259|  15.0k|    if (!ssn->check_flow && ssn->state.incoming_window < ssn->incoming_window_lwm) {
  ------------------
  |  Branch (2259:9): [True: 15.0k, False: 0]
  |  Branch (2259:29): [True: 0, False: 15.0k]
  ------------------
 2260|      0|      ssn->check_flow = true;
 2261|      0|      pni_add_tpwork(current);
 2262|      0|    }
 2263|  15.0k|  }
 2264|       |
 2265|  89.9k|  link->current = link->current->unsettled_next;
 2266|  89.9k|}
engine.c:pni_add_tpwork:
  792|   166k|{
  793|   166k|  pn_connection_t *connection = delivery->link->session->connection;
  794|   166k|  if (!delivery->tpwork)
  ------------------
  |  Branch (794:7): [True: 90.5k, False: 75.9k]
  ------------------
  795|  90.5k|  {
  796|  90.5k|    LL_ADD(connection, tpwork, delivery);
  ------------------
  |  |  237|  90.5k|  {                                                           \
  |  |  238|  90.5k|    (NODE)-> LIST ## _next = NULL;                            \
  |  |  239|  90.5k|    (NODE)-> LIST ## _prev = (ROOT)-> LIST ## _tail;          \
  |  |  240|  90.5k|    if (LL_TAIL(ROOT, LIST))                                  \
  |  |  ------------------
  |  |  |  |  235|  90.5k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (235:29): [True: 70.1k, False: 20.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  241|  90.5k|      LL_TAIL(ROOT, LIST)-> LIST ## _next = (NODE);           \
  |  |  ------------------
  |  |  |  |  235|  70.1k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  242|  90.5k|    LL_TAIL(ROOT, LIST) = (NODE);                             \
  |  |  ------------------
  |  |  |  |  235|  90.5k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  243|  90.5k|    if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  234|  90.5k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |                   if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  234|  20.3k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (243:9): [True: 20.3k, False: 70.1k]
  |  |  ------------------
  |  |  244|  90.5k|  }
  ------------------
  797|  90.5k|    delivery->tpwork = true;
  798|  90.5k|  }
  799|       |  pn_modified(connection, &connection->endpoint, true);
  800|   166k|}

pn_error:
   45|   110k|{
   46|   110k|  pn_error_t *error = (pn_error_t *) pni_mem_allocate(PN_CLASSCLASS(pn_error), sizeof(pn_error_t));
  ------------------
  |  |  102|   110k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   47|   110k|  if (error != NULL) {
  ------------------
  |  Branch (47:7): [True: 110k, False: 0]
  ------------------
   48|   110k|    error->code = 0;
   49|       |    error->text = NULL;
   50|   110k|  }
   51|   110k|  return error;
   52|   110k|}
pn_error_free:
   55|   180k|{
   56|   180k|  if (error) {
  ------------------
  |  Branch (56:7): [True: 110k, False: 70.3k]
  ------------------
   57|   110k|    pni_mem_subdeallocate(PN_CLASSCLASS(pn_error), error, error->text);
  ------------------
  |  |  102|   110k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   58|   110k|    pni_mem_deallocate(PN_CLASSCLASS(pn_error), error);
  ------------------
  |  |  102|   110k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   59|   110k|  }
   60|   180k|}
pn_error_clear:
   63|  5.85k|{
   64|  5.85k|  if (error) {
  ------------------
  |  Branch (64:7): [True: 2.77k, False: 3.07k]
  ------------------
   65|  2.77k|    error->code = 0;
   66|  2.77k|    pni_mem_subdeallocate(PN_CLASSCLASS(pn_error), error, error->text);
  ------------------
  |  |  102|  2.77k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   67|       |    error->text = NULL;
   68|  2.77k|  }
   69|  5.85k|}
pn_error_set:
   72|  2.77k|{
   73|  2.77k|  assert(error);
   74|  2.77k|  if (!code) {
  ------------------
  |  Branch (74:7): [True: 0, False: 2.77k]
  ------------------
   75|      0|    pn_error_clear(error);
   76|      0|    return 0;
   77|      0|  }
   78|  2.77k|  char *new_text = pn_strdup(text);
   79|  2.77k|  pn_error_clear(error);
   80|  2.77k|  error->code = code;
   81|  2.77k|  error->text = new_text;
   82|  2.77k|  return code;
   83|  2.77k|}
pn_error_vformat:
   86|  2.70k|{
   87|  2.70k|  assert(error);
   88|  2.70k|  char text[1024];
   89|  2.70k|  int n = vsnprintf(text, 1024, fmt, ap);
   90|  2.70k|  if (n >= 1024) {
  ------------------
  |  Branch (90:7): [True: 0, False: 2.70k]
  ------------------
   91|      0|    text[1023] = '\0';
   92|      0|  }
   93|  2.70k|  return pn_error_set(error, code, text);
   94|  2.70k|}
pn_error_format:
   97|  2.70k|{
   98|  2.70k|  assert(error);
   99|  2.70k|  va_list ap;
  100|  2.70k|  va_start(ap, fmt);
  101|  2.70k|  int rcode = pn_error_vformat(error, code, fmt, ap);
  102|       |  va_end(ap);
  103|  2.70k|  return rcode;
  104|  2.70k|}

pn_collector_drain:
   67|  69.2k|{
   68|  69.2k|  assert(collector);
   69|   244k|  while (pn_collector_next(collector))
  ------------------
  |  Branch (69:10): [True: 175k, False: 69.2k]
  ------------------
   70|   175k|    ;
   71|  69.2k|  assert(!collector->head);
   72|       |  assert(!collector->tail);
   73|  69.2k|}
pn_collector:
  113|  34.6k|{
  114|       |  static const pn_class_t clazz = PN_CLASS(pn_collector);
  ------------------
  |  |   67|  34.6k|#define PN_CLASS(PREFIX) {                      \
  |  |   68|  34.6k|    #PREFIX,                                    \
  |  |   69|  34.6k|    CID_ ## PREFIX,                             \
  |  |   70|  34.6k|    NULL,                                       \
  |  |   71|  34.6k|    PREFIX ## _initialize,                      \
  |  |   72|  34.6k|    NULL,                                       \
  |  |   73|  34.6k|    NULL,                                       \
  |  |   74|  34.6k|    NULL,                                       \
  |  |   75|  34.6k|    PREFIX ## _finalize,                        \
  |  |   76|  34.6k|    NULL,                                       \
  |  |   77|  34.6k|    PREFIX ## _hashcode,                        \
  |  |  ------------------
  |  |  |  |  109|  34.6k|#define pn_collector_hashcode NULL
  |  |  ------------------
  |  |   78|  34.6k|    PREFIX ## _compare,                         \
  |  |  ------------------
  |  |  |  |  110|  34.6k|#define pn_collector_compare NULL
  |  |  ------------------
  |  |   79|  34.6k|    PREFIX ## _inspect                          \
  |  |   80|  34.6k|}
  ------------------
  115|  34.6k|  return (pn_collector_t *) pn_class_new(&clazz, sizeof(pn_collector_t));
  116|  34.6k|}
pn_collector_free:
  119|  34.6k|{
  120|       |  assert(collector);
  121|  34.6k|  pn_collector_release(collector);
  122|  34.6k|  pn_decref(collector);
  123|  34.6k|}
pn_collector_release:
  126|  34.9k|{
  127|  34.9k|  assert(collector);
  128|  34.9k|  if (!collector->freed) {
  ------------------
  |  Branch (128:7): [True: 34.6k, False: 312]
  ------------------
  129|       |    collector->freed = true;
  130|  34.6k|    pn_collector_drain(collector);
  131|  34.6k|    pn_collector_shrink(collector);
  132|  34.6k|  }
  133|  34.9k|}
pn_collector_put:
  140|  12.3M|{
  141|  12.3M|  if (!collector) {
  ------------------
  |  Branch (141:7): [True: 3.04M, False: 9.33M]
  ------------------
  142|  3.04M|    return NULL;
  143|  3.04M|  }
  144|       |
  145|  12.3M|  assert(context);
  146|       |
  147|  9.33M|  if (collector->freed) {
  ------------------
  |  Branch (147:7): [True: 634k, False: 8.70M]
  ------------------
  148|   634k|    return NULL;
  149|   634k|  }
  150|       |
  151|  8.70M|  pn_event_t *tail = collector->tail;
  152|  8.70M|  if (tail && tail->type == type && tail->context == context) {
  ------------------
  |  Branch (152:7): [True: 8.54M, False: 156k]
  |  Branch (152:15): [True: 2.57M, False: 5.97M]
  |  Branch (152:37): [True: 2.54M, False: 24.1k]
  ------------------
  153|  2.54M|    return NULL;
  154|  2.54M|  }
  155|       |
  156|  6.15M|  pn_event_t *event = (pn_event_t *) pn_list_pop(collector->pool);
  157|       |
  158|  6.15M|  if (!event) {
  ------------------
  |  Branch (158:7): [True: 1.82M, False: 4.32M]
  ------------------
  159|  1.82M|    event = pn_event();
  160|  1.82M|  }
  161|       |
  162|  6.15M|  event->pool = collector->pool;
  163|  6.15M|  pn_incref(event->pool);
  164|       |
  165|  6.15M|  if (tail) {
  ------------------
  |  Branch (165:7): [True: 5.99M, False: 156k]
  ------------------
  166|  5.99M|    tail->next = event;
  167|  5.99M|    collector->tail = event;
  168|  5.99M|  } else {
  169|   156k|    collector->tail = event;
  170|   156k|    collector->head = event;
  171|   156k|  }
  172|       |
  173|  6.15M|  event->clazz = clazz;
  174|  6.15M|  event->context = context;
  175|  6.15M|  event->type = type;
  176|  6.15M|  pn_class_incref(clazz, event->context);
  177|       |
  178|  6.15M|  return event;
  179|  8.70M|}
pn_collector_put_object:
  182|  12.3M|{
  183|  12.3M|  const pn_class_t *clazz = pn_class(object);
  184|  12.3M|  return pn_collector_put(collector, clazz, object, type);
  185|  12.3M|}
pn_collector_next:
  212|  6.30M|pn_event_t *pn_collector_next(pn_collector_t *collector) {
  213|  6.30M|  if (collector->prev) {
  ------------------
  |  Branch (213:7): [True: 6.15M, False: 153k]
  ------------------
  214|  6.15M|    pn_decref(collector->prev);
  215|  6.15M|  }
  216|  6.30M|  collector->prev = pop_internal(collector);
  217|  6.30M|  return collector->prev;
  218|  6.30M|}
pn_collector_prev:
  220|  6.06M|pn_event_t *pn_collector_prev(pn_collector_t *collector) {
  221|  6.06M|  return collector->prev;
  222|  6.06M|}
pn_event:
  286|  1.82M|{
  287|  1.82M|  return pn_class_new(&PN_CLASSCLASS(pn_event), sizeof(pn_event_t));
  ------------------
  |  |  102|  1.82M|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  288|  1.82M|}
pn_event_type:
  291|  11.9M|{
  292|  11.9M|  return event ? event->type : PN_EVENT_NONE;
  ------------------
  |  Branch (292:10): [True: 11.9M, False: 0]
  ------------------
  293|  11.9M|}
pn_event_class:
  296|   993k|{
  297|       |  assert(event);
  298|   993k|  return event->clazz;
  299|   993k|}
pn_event_context:
  302|   622k|{
  303|       |  assert(event);
  304|   622k|  return event->context;
  305|   622k|}
event.c:pn_collector_initialize:
   57|  34.6k|{
   58|  34.6k|  pn_collector_t *collector = (pn_collector_t *)object;
   59|  34.6k|  collector->pool = pn_list(&PN_CLASSCLASS(pn_event), 0);
  ------------------
  |  |  102|  34.6k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   60|  34.6k|  collector->head = NULL;
   61|  34.6k|  collector->tail = NULL;
   62|  34.6k|  collector->prev = NULL;
   63|       |  collector->freed = false;
   64|  34.6k|}
event.c:pn_collector_finalize:
   82|  34.6k|{
   83|  34.6k|  pn_collector_t *collector = (pn_collector_t *)object;
   84|  34.6k|  pn_collector_drain(collector);
   85|  34.6k|  pn_decref(collector->pool);
   86|  34.6k|}
event.c:pn_collector_shrink:
   76|  34.6k|{
   77|       |  assert(collector);
   78|  34.6k|  pn_list_clear(collector->pool);
   79|  34.6k|}
event.c:pop_internal:
  193|  6.30M|static pn_event_t *pop_internal(pn_collector_t *collector) {
  194|  6.30M|  pn_event_t *event = collector->head;
  195|  6.30M|  if (event) {
  ------------------
  |  Branch (195:7): [True: 6.15M, False: 153k]
  ------------------
  196|  6.15M|    collector->head = event->next;
  197|  6.15M|    if (!collector->head) {
  ------------------
  |  Branch (197:9): [True: 156k, False: 5.99M]
  ------------------
  198|       |      collector->tail = NULL;
  199|   156k|    }
  200|  6.15M|  }
  201|  6.30M|  return event;
  202|  6.30M|}
event.c:pn_event_initialize:
  231|  1.82M|{
  232|  1.82M|  pn_event_t *event = (pn_event_t *)object;
  233|  1.82M|  event->pool = NULL;
  234|  1.82M|  event->type = PN_EVENT_NONE;
  235|  1.82M|  event->clazz = NULL;
  236|  1.82M|  event->context = NULL;
  237|       |  event->next = NULL;
  238|  1.82M|  event->attachments = pn_record();
  239|  1.82M|}
event.c:pn_event_finalize:
  241|  7.98M|static void pn_event_finalize(void *object) {
  242|  7.98M|  pn_event_t *event = (pn_event_t *)object;
  243|       |  // decref before adding to the free list
  244|  7.98M|  if (event->clazz && event->context) {
  ------------------
  |  Branch (244:7): [True: 6.15M, False: 1.82M]
  |  Branch (244:23): [True: 6.15M, False: 0]
  ------------------
  245|  6.15M|    pn_class_decref(event->clazz, event->context);
  246|  6.15M|  }
  247|       |
  248|  7.98M|  pn_list_t *pool = event->pool;
  249|       |
  250|  7.98M|  if (pool && pn_refcount(pool) > 1) {
  ------------------
  |  Branch (250:7): [True: 6.15M, False: 1.82M]
  |  Branch (250:15): [True: 6.15M, False: 0]
  ------------------
  251|  6.15M|    event->pool = NULL;
  252|  6.15M|    event->type = PN_EVENT_NONE;
  253|  6.15M|    event->clazz = NULL;
  254|  6.15M|    event->context = NULL;
  255|  6.15M|    event->next = NULL;
  256|  6.15M|    pn_record_clear(event->attachments);
  257|  6.15M|    pn_list_add(pool, event);
  258|  6.15M|  } else {
  259|  1.82M|    pn_decref(event->attachments);
  260|  1.82M|  }
  261|       |
  262|  7.98M|  pn_decref(pool);
  263|  7.98M|}

object.c:pn_fixed_string:
   46|  73.1k|static inline pn_fixed_string_t pn_fixed_string(char *bytes, uint32_t size) {
   47|       |  // A fixed string has nowhere to put even the terminating null unless it has
   48|       |  // at least one byte, so a zero sized buffer is never meaningful.
   49|       |  assert(size > 0);
   50|  73.1k|  return (pn_fixed_string_t) {.bytes=bytes, .size=size, .position=0};
   51|  73.1k|}
object.c:pn_fixed_string_terminate:
  103|  73.1k|static inline void pn_fixed_string_terminate(pn_fixed_string_t *str) {
  104|  73.1k|  if (pn_fixed_string_is_full(str)) str->position--;
  ------------------
  |  Branch (104:7): [True: 338, False: 72.8k]
  ------------------
  105|  73.1k|  str->bytes[str->position] = 0;
  106|  73.1k|}
object.c:pn_fixed_string_is_full:
   99|  73.1k|static inline bool pn_fixed_string_is_full(pn_fixed_string_t *str) {
  100|  73.1k|  return str->position==str->size;
  101|  73.1k|}
logger.c:pn_fixed_string:
   46|  2.41k|static inline pn_fixed_string_t pn_fixed_string(char *bytes, uint32_t size) {
   47|       |  // A fixed string has nowhere to put even the terminating null unless it has
   48|       |  // at least one byte, so a zero sized buffer is never meaningful.
   49|       |  assert(size > 0);
   50|  2.41k|  return (pn_fixed_string_t) {.bytes=bytes, .size=size, .position=0};
   51|  2.41k|}
logger.c:pn_fixed_string_terminate:
  103|  2.41k|static inline void pn_fixed_string_terminate(pn_fixed_string_t *str) {
  104|  2.41k|  if (pn_fixed_string_is_full(str)) str->position--;
  ------------------
  |  Branch (104:7): [True: 0, False: 2.41k]
  ------------------
  105|  2.41k|  str->bytes[str->position] = 0;
  106|  2.41k|}
logger.c:pn_fixed_string_is_full:
   99|  2.41k|static inline bool pn_fixed_string_is_full(pn_fixed_string_t *str) {
  100|  2.41k|  return str->position==str->size;
  101|  2.41k|}
logger.c:pn_fixed_string_vaddf:
   67|  2.41k|static inline void pn_fixed_string_vaddf(pn_fixed_string_t *str, const char *format, va_list ap){
   68|  2.41k|  uint32_t bytes_left = str->size-str->position;
   69|  2.41k|  if (bytes_left==0) return;
  ------------------
  |  Branch (69:7): [True: 0, False: 2.41k]
  ------------------
   70|       |
   71|  2.41k|  char *out = &str->bytes[str->position];
   72|  2.41k|  int out_size = vsnprintf(out, bytes_left, format, ap);
   73|  2.41k|  if ( out_size<0 ) return;
  ------------------
  |  Branch (73:8): [True: 0, False: 2.41k]
  ------------------
   74|  2.41k|  str->position += pn_min((uint32_t)out_size, bytes_left);
  ------------------
  |  |  272|  2.41k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (272:22): [True: 0, False: 2.41k]
  |  |  ------------------
  ------------------
   75|  2.41k|}
codec.c:pn_fixed_string_addf:
   78|  12.8M|static inline void pn_fixed_string_addf(pn_fixed_string_t *str, PN_PRINTF_FORMAT const char *format, ...) {
   79|  12.8M|  va_list ap;
   80|  12.8M|  va_start(ap, format);
   81|  12.8M|  pn_fixed_string_vaddf(str, format, ap);
   82|       |  va_end(ap);
   83|  12.8M|}
codec.c:pn_fixed_string_vaddf:
   67|  12.8M|static inline void pn_fixed_string_vaddf(pn_fixed_string_t *str, const char *format, va_list ap){
   68|  12.8M|  uint32_t bytes_left = str->size-str->position;
   69|  12.8M|  if (bytes_left==0) return;
  ------------------
  |  Branch (69:7): [True: 12.6M, False: 202k]
  ------------------
   70|       |
   71|   202k|  char *out = &str->bytes[str->position];
   72|   202k|  int out_size = vsnprintf(out, bytes_left, format, ap);
   73|   202k|  if ( out_size<0 ) return;
  ------------------
  |  Branch (73:8): [True: 0, False: 202k]
  ------------------
   74|   202k|  str->position += pn_min((uint32_t)out_size, bytes_left);
  ------------------
  |  |  272|   202k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (272:22): [True: 146, False: 202k]
  |  |  ------------------
  ------------------
   75|   202k|}
codec.c:pn_fixed_string_quote:
   85|  13.8k|static inline void pn_fixed_string_quote(pn_fixed_string_t *str, const char *data, size_t size) {
   86|  13.8k|  size_t bytes_left = str->size-str->position;
   87|  13.8k|  if (bytes_left==0) return;
  ------------------
  |  Branch (87:7): [True: 1.74k, False: 12.0k]
  ------------------
   88|       |
   89|  12.0k|  char *out = &str->bytes[str->position];
   90|  12.0k|  ssize_t out_size = pn_quote_data(out, bytes_left, data, size);
   91|       |  // The only error (ie value less than 0) that can come from pn_quote_data is PN_OVERFLOW
   92|  12.0k|  if ( out_size>=0 ) {
  ------------------
  |  Branch (92:8): [True: 12.0k, False: 62]
  ------------------
   93|  12.0k|    str->position += out_size;
   94|  12.0k|  } else {
   95|     62|    str->position = str->size;
   96|     62|  }
   97|  12.0k|}

pn_read_frame:
   67|  3.45M|{
   68|  3.45M|  if (available < AMQP_HEADER_SIZE) return 0;
  ------------------
  |  |   33|  3.45M|#define AMQP_HEADER_SIZE (8)
  ------------------
  |  Branch (68:7): [True: 26.5k, False: 3.42M]
  ------------------
   69|  3.42M|  uint32_t size = pni_read32(&bytes[0]);
   70|  3.42M|  if (max && size > max) return PN_ERR;
  ------------------
  |  |   49|  3.97k|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (70:7): [True: 3.42M, False: 0]
  |  Branch (70:14): [True: 3.97k, False: 3.42M]
  ------------------
   71|  3.42M|  if (available < size) return 0;
  ------------------
  |  Branch (71:7): [True: 28.4k, False: 3.39M]
  ------------------
   72|  3.39M|  unsigned int doff = 4 * (uint8_t)bytes[4];
   73|  3.39M|  if (doff < AMQP_HEADER_SIZE || doff > size) return PN_ERR;
  ------------------
  |  |   33|  6.78M|#define AMQP_HEADER_SIZE (8)
  ------------------
                if (doff < AMQP_HEADER_SIZE || doff > size) return PN_ERR;
  ------------------
  |  |   49|    744|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (73:7): [True: 339, False: 3.39M]
  |  Branch (73:34): [True: 405, False: 3.39M]
  ------------------
   74|       |
   75|  3.39M|  frame->frame_payload0 = (pn_bytes_t){.size=size-doff, .start=bytes+doff};
   76|  3.39M|  frame->frame_payload1 = (pn_bytes_t){.size=0,.start=NULL};
   77|  3.39M|  frame->extended = (pn_bytes_t){.size=doff-AMQP_HEADER_SIZE, .start=bytes+AMQP_HEADER_SIZE};
  ------------------
  |  |   33|  3.39M|#define AMQP_HEADER_SIZE (8)
  ------------------
                frame->extended = (pn_bytes_t){.size=doff-AMQP_HEADER_SIZE, .start=bytes+AMQP_HEADER_SIZE};
  ------------------
  |  |   33|  3.39M|#define AMQP_HEADER_SIZE (8)
  ------------------
   78|  3.39M|  frame->type = bytes[5];
   79|  3.39M|  frame->channel = pni_read16(&bytes[6]);
   80|       |
   81|  3.39M|  pn_do_rx_trace(logger, frame->channel, frame->frame_payload0);
   82|  3.39M|  pn_do_raw_rx_trace(logger, (pn_bytes_t){.size=size, .start=bytes}, AMQP_HEADER_SIZE+frame->extended.size+frame->frame_payload0.size+frame->frame_payload1.size);
  ------------------
  |  |   33|  3.39M|#define AMQP_HEADER_SIZE (8)
  ------------------
   83|       |
   84|  3.39M|  return size;
   85|  3.39M|}
pn_write_frame:
   88|   167k|{
   89|   167k|  size_t size = AMQP_HEADER_SIZE + frame.extended.size + frame.frame_payload0.size + frame.frame_payload1.size;
  ------------------
  |  |   33|   167k|#define AMQP_HEADER_SIZE (8)
  ------------------
   90|   167k|  if (size <= pn_buffer_available(buffer))
  ------------------
  |  Branch (90:7): [True: 167k, False: 0]
  ------------------
   91|   167k|  {
   92|       |    // Prepare header
   93|   167k|    char bytes[8];
   94|   167k|    pni_write32(&bytes[0], size);
   95|   167k|    int doff = (frame.extended.size + AMQP_HEADER_SIZE - 1)/4 + 1;
  ------------------
  |  |   33|   167k|#define AMQP_HEADER_SIZE (8)
  ------------------
   96|   167k|    bytes[4] = doff;
   97|   167k|    bytes[5] = frame.type;
   98|   167k|    pni_write16(&bytes[6], frame.channel);
   99|       |
  100|       |    // Write header then rest of frame
  101|   167k|    pn_buffer_append(buffer, bytes, 8);
  102|   167k|    pn_buffer_append(buffer, frame.extended.start, frame.extended.size);
  103|       |
  104|       |    // Don't mess with the buffer unless we are logging frame traces to avoid
  105|       |    // shuffling the buffer unnecessarily.
  106|   167k|    if (
  107|   167k|      PN_SHOULD_LOG(logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_FRAME) ||
  ------------------
  |  |   54|   335k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  ------------------
  |  |  |  Branch (54:6): [Folded, False: 167k]
  |  |  |  Branch (54:38): [True: 167k, False: 0]
  |  |  |  Branch (54:73): [True: 0, False: 167k]
  |  |  ------------------
  ------------------
  108|   167k|      PN_SHOULD_LOG(logger, PN_SUBSYSTEM_IO, PN_LEVEL_RAW))
  ------------------
  |  |   54|   167k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  ------------------
  |  |  |  Branch (54:6): [Folded, False: 167k]
  |  |  |  Branch (54:38): [True: 167k, False: 0]
  |  |  |  Branch (54:73): [True: 0, False: 167k]
  |  |  ------------------
  ------------------
  109|      0|    {
  110|       |      // Get current buffer pointer so we can trace dump performative and payload together
  111|      0|      pn_bytes_t smem = pn_buffer_bytes(buffer);
  112|      0|      pn_buffer_append(buffer, frame.frame_payload0.start, frame.frame_payload0.size);
  113|      0|      pn_buffer_append(buffer, frame.frame_payload1.start, frame.frame_payload1.size);
  114|      0|      pn_bytes_t emem = pn_buffer_bytes(buffer);
  115|       |
  116|       |      // The buffer can't have moved
  117|      0|      assert(smem.start==emem.start);
  118|      0|      pn_bytes_t frame_payload = {.size=emem.size-smem.size, .start=smem.start+smem.size};
  119|      0|      pn_do_tx_trace(logger, frame.channel, frame_payload);
  120|      0|      pn_do_raw_tx_trace(logger, emem, AMQP_HEADER_SIZE+frame.extended.size+frame.frame_payload0.size+frame.frame_payload1.size);
  ------------------
  |  |   33|      0|#define AMQP_HEADER_SIZE (8)
  ------------------
  121|   167k|    } else {
  122|   167k|      pn_buffer_append(buffer, frame.frame_payload0.start, frame.frame_payload0.size);
  123|   167k|      pn_buffer_append(buffer, frame.frame_payload1.start, frame.frame_payload1.size);
  124|   167k|    }
  125|   167k|    return size;
  126|   167k|  } else {
  127|      0|    return 0;
  128|      0|  }
  129|   167k|}
pn_framing_send_amqp:
  144|   167k|{
  145|   167k|  if (!performative.start)
  ------------------
  |  Branch (145:7): [True: 0, False: 167k]
  ------------------
  146|      0|    return PN_ERR;
  ------------------
  |  |   49|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
  147|       |
  148|   167k|  pn_post_frame(transport->output_buffer, &transport->logger, AMQP_FRAME_TYPE, ch, performative, (pn_bytes_t){0, NULL});
  ------------------
  |  |   38|   167k|#define AMQP_FRAME_TYPE (0)
  ------------------
  149|   167k|  transport->output_frames_ct += 1;
  150|   167k|  return 0;
  151|   167k|}
framing.c:pn_do_rx_trace:
   42|  3.39M|{
   43|  3.39M|  if (PN_SHOULD_LOG(logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_FRAME) ) {
  ------------------
  |  |   54|  3.39M|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  ------------------
  |  |  |  Branch (54:6): [Folded, False: 3.39M]
  |  |  |  Branch (54:38): [True: 3.39M, False: 0]
  |  |  |  Branch (54:73): [True: 0, False: 3.39M]
  |  |  ------------------
  ------------------
   44|      0|    if (frame.size==0) {
  ------------------
  |  Branch (44:9): [True: 0, False: 0]
  ------------------
   45|      0|      pn_logger_logf(logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_FRAME, "%u <- (EMPTY FRAME)", ch);
   46|      0|    } else {
   47|      0|      pni_logger_log_msg_frame(logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_FRAME, frame, "%u <- ", ch);
   48|      0|    }
   49|      0|  }
   50|  3.39M|}
framing.c:pn_do_raw_rx_trace:
   60|  3.39M|{
   61|  3.39M|  if (PN_SHOULD_LOG(logger, PN_SUBSYSTEM_IO, PN_LEVEL_RAW)) {
  ------------------
  |  |   54|  3.39M|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  ------------------
  |  |  |  Branch (54:6): [Folded, False: 3.39M]
  |  |  |  Branch (54:38): [True: 3.39M, False: 0]
  |  |  |  Branch (54:73): [True: 0, False: 3.39M]
  |  |  ------------------
  ------------------
   62|      0|    pni_logger_log_raw(logger, PN_SUBSYSTEM_IO, PN_LEVEL_RAW, frame, size, "<-");
   63|      0|  }
   64|  3.39M|}
framing.c:pn_post_frame:
  132|   167k|{
  133|   167k|  pn_frame_t frame = {
  134|   167k|    .type = type,
  135|   167k|    .channel = ch,
  136|   167k|    .frame_payload0 = performative,
  137|   167k|    .frame_payload1 = payload
  138|   167k|  };
  139|   167k|  pn_buffer_ensure(output, AMQP_HEADER_SIZE+frame.extended.size+frame.frame_payload0.size+frame.frame_payload1.size);
  ------------------
  |  |   33|   167k|#define AMQP_HEADER_SIZE (8)
  ------------------
  140|   167k|  pn_write_frame(output, frame, logger);
  141|   167k|}

pni_logger_default_init:
   48|  34.6k|{
   49|  34.6k|  *logger = the_default_logger;
   50|  34.6k|  if (logger->sink == pni_default_log_sink) {
  ------------------
  |  Branch (50:7): [True: 1, False: 34.6k]
  ------------------
   51|      1|    logger->sink_context = (intptr_t) logger;
   52|      1|  }
   53|  34.6k|}
pni_logger_fini:
   56|  34.6k|{
   57|  34.6k|}
pn_default_logger:
  155|  34.6k|{
  156|  34.6k|  return &the_default_logger;
  157|  34.6k|}
pn_logger_set_log_sink:
  172|  34.6k|{
  173|  34.6k|  logger->sink = sink;
  174|  34.6k|  logger->sink_context = sink_context;
  175|  34.6k|}
pni_logger_log:
  267|  2.41k|{
  268|       |  assert(logger);
  269|  2.41k|  logger->sink(logger->sink_context, subsystem, severity, message);
  270|  2.41k|}
pni_logger_vlogf:
  273|  2.41k|{
  274|  2.41k|  assert(logger);
  275|  2.41k|  char buf[1024];
  276|  2.41k|  pn_fixed_string_t output = pn_fixed_string(buf, sizeof(buf));
  277|  2.41k|  pn_fixed_string_vaddf(&output, fmt, ap);
  278|  2.41k|  if (output.position==output.size) {
  ------------------
  |  Branch (278:7): [True: 0, False: 2.41k]
  ------------------
  279|       |    // Message overflow
  280|      0|    const char truncated[] = " ... (truncated)";
  281|      0|    output.position -= sizeof(truncated);
  282|      0|    pn_fixed_string_append(&output, pn_string_const(truncated, sizeof(truncated)));
  283|      0|  }
  284|  2.41k|  pn_fixed_string_terminate(&output);
  285|  2.41k|  pni_logger_log(logger, subsystem, severity, buf);
  286|  2.41k|}
pn_logger_logf:
  289|  2.41k|{
  290|  2.41k|  va_list ap;
  291|       |
  292|  2.41k|  va_start(ap, fmt);
  293|  2.41k|  pni_logger_vlogf(logger, subsystem, severity, fmt, ap);
  294|       |  va_end(ap);
  295|  2.41k|}

pni_mem_allocate:
  270|   187k|void *pni_mem_allocate(const pn_class_t *clazz, size_t size) { return malloc(size); }
pni_mem_zallocate:
  271|  25.6M|void *pni_mem_zallocate(const pn_class_t *clazz, size_t size) { return calloc(1, size); }
pni_mem_deallocate:
  272|  26.4M|void pni_mem_deallocate(const pn_class_t *clazz, void *object) { free(object); }
pni_mem_suballocate:
  274|  8.14M|void *pni_mem_suballocate(const pn_class_t *clazz, void *object, size_t size) { return malloc(size); }
pni_mem_subreallocate:
  275|  12.9M|void *pni_mem_subreallocate(const pn_class_t *clazz, void *object, void *buffer, size_t size) { return realloc(buffer, size); }
pni_mem_subdeallocate:
  276|  21.1M|void pni_mem_subdeallocate(const pn_class_t *clazz, void *object, void *buffer) { free(buffer); }

pni_msgid_clear:
   83|   161k|void pni_msgid_clear(pn_atom_t* msgid) {
   84|   161k|  switch (msgid->type) {
   85|    438|    case PN_BINARY:
  ------------------
  |  Branch (85:5): [True: 438, False: 161k]
  ------------------
   86|    620|    case PN_STRING:
  ------------------
  |  Branch (86:5): [True: 182, False: 161k]
  ------------------
   87|    620|      free((void*)msgid->u.as_bytes.start);
   88|    620|      PN_FALLTHROUGH;
  ------------------
  |  |  105|    620|        #define PN_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
   89|    986|    case PN_ULONG:
  ------------------
  |  Branch (89:5): [True: 366, False: 161k]
  ------------------
   90|  1.15k|    case PN_UUID:
  ------------------
  |  Branch (90:5): [True: 170, False: 161k]
  ------------------
   91|  1.15k|      msgid->type = PN_NULL;
   92|  1.15k|      PN_FALLTHROUGH;
  ------------------
  |  |  105|  1.15k|        #define PN_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
   93|   161k|    case PN_NULL:
  ------------------
  |  Branch (93:5): [True: 160k, False: 1.15k]
  ------------------
   94|   161k|      return;
   95|      0|    default:
  ------------------
  |  Branch (95:5): [True: 0, False: 161k]
  ------------------
   96|      0|      break;
   97|   161k|  }
   98|   161k|  assert(false);
   99|      0|}
pni_msgid_validate_intern:
  101|  15.2k|void pni_msgid_validate_intern(pn_atom_t* msgid) {
  102|  15.2k|  switch (msgid->type) {
  103|    438|    case PN_BINARY:
  ------------------
  |  Branch (103:5): [True: 438, False: 14.7k]
  ------------------
  104|    620|    case PN_STRING: {
  ------------------
  |  Branch (104:5): [True: 182, False: 15.0k]
  ------------------
  105|    620|      char* new = malloc(msgid->u.as_bytes.size);
  106|    620|      assert(new);
  107|    620|      memcpy(new, msgid->u.as_bytes.start, msgid->u.as_bytes.size);
  108|    620|      msgid->u.as_bytes.start = new;
  109|    620|      return;
  110|    438|    }
  111|    366|    case PN_ULONG:
  ------------------
  |  Branch (111:5): [True: 366, False: 14.8k]
  ------------------
  112|    536|    case PN_UUID:
  ------------------
  |  Branch (112:5): [True: 170, False: 15.0k]
  ------------------
  113|  9.73k|    case PN_NULL:
  ------------------
  |  Branch (113:5): [True: 9.19k, False: 6.03k]
  ------------------
  114|  9.73k|      return;
  115|  4.88k|    default:
  ------------------
  |  Branch (115:5): [True: 4.88k, False: 10.3k]
  ------------------
  116|       |      // Not a legal msgid type
  117|  4.88k|      msgid->type = PN_NULL;
  118|  4.88k|      return;
  119|  15.2k|  }
  120|  15.2k|}
pni_msgid_fix_interop:
  123|  15.2k|void pni_msgid_fix_interop(pn_atom_t* msgid) {
  124|  15.2k|  switch (msgid->type) {
  125|      0|    case PN_INT: {
  ------------------
  |  Branch (125:5): [True: 0, False: 15.2k]
  ------------------
  126|      0|      int32_t v = msgid->u.as_int;
  127|       |      // Only fix if the value actually is positive
  128|      0|      if (v < 0) return;
  ------------------
  |  Branch (128:11): [True: 0, False: 0]
  ------------------
  129|      0|      msgid->type = PN_ULONG;
  130|      0|      msgid->u.as_ulong = v;
  131|      0|      return;
  132|      0|    }
  133|      0|    case PN_LONG: {
  ------------------
  |  Branch (133:5): [True: 0, False: 15.2k]
  ------------------
  134|      0|      int64_t v = msgid->u.as_long;
  135|       |      // Only fix if the value actually is positive
  136|      0|      if (v < 0) return;
  ------------------
  |  Branch (136:11): [True: 0, False: 0]
  ------------------
  137|      0|      msgid->type = PN_ULONG;
  138|      0|      msgid->u.as_ulong = v;
  139|      0|      return;
  140|      0|    }
  141|  15.2k|    default:
  ------------------
  |  Branch (141:5): [True: 15.2k, False: 0]
  ------------------
  142|  15.2k|      return;
  143|  15.2k|  }
  144|  15.2k|}
pn_message_finalize:
  147|  73.1k|{
  148|  73.1k|  pn_message_t *msg = (pn_message_t *) obj;
  149|  73.1k|  pn_free(msg->user_id);
  150|  73.1k|  pn_free(msg->address);
  151|  73.1k|  pn_free(msg->subject);
  152|  73.1k|  pn_free(msg->reply_to);
  153|  73.1k|  pn_free(msg->content_type);
  154|  73.1k|  pn_free(msg->content_encoding);
  155|  73.1k|  pn_free(msg->group_id);
  156|  73.1k|  pn_free(msg->reply_to_group_id);
  157|  73.1k|  pni_msgid_clear(&msg->id);
  158|  73.1k|  pni_msgid_clear(&msg->correlation_id);
  159|  73.1k|  pn_bytes_free(msg->instructions_raw);
  160|  73.1k|  pn_bytes_free(msg->annotations_raw);
  161|  73.1k|  pn_bytes_free(msg->properties_raw);
  162|  73.1k|  pn_bytes_free(msg->body_raw);
  163|  73.1k|  pn_data_free(msg->id_deprecated);
  164|  73.1k|  pn_data_free(msg->correlation_id_deprecated);
  165|  73.1k|  pn_data_free(msg->instructions_deprecated);
  166|  73.1k|  pn_data_free(msg->annotations_deprecated);
  167|  73.1k|  pn_data_free(msg->properties_deprecated);
  168|  73.1k|  pn_data_free(msg->body_deprecated);
  169|  73.1k|  pn_error_free(msg->error);
  170|  73.1k|}
pn_message:
  375|  73.1k|pn_message_t *pn_message(void) {
  376|  73.1k|  return pni_message_new(sizeof(pn_message_t));
  377|  73.1k|}
pn_message_free:
  394|  73.1k|{
  395|  73.1k|  pn_free(msg);
  396|  73.1k|}
pn_message_set_id:
  551|  7.61k|{
  552|  7.61k|  assert(msg);
  553|  7.61k|  if (msg->id_deprecated) {
  ------------------
  |  Branch (553:7): [True: 0, False: 7.61k]
  ------------------
  554|      0|    pn_data_rewind(msg->id_deprecated);
  555|      0|    pn_data_put_atom(msg->id_deprecated, id);
  556|  7.61k|  } else {
  557|  7.61k|    pni_msgid_clear(&msg->id);
  558|  7.61k|    msg->id = id;
  559|  7.61k|    pni_msgid_validate_intern(&msg->id);
  560|  7.61k|  }
  561|  7.61k|  return 0;
  562|  7.61k|}
pn_message_set_correlation_id:
  637|  7.61k|{
  638|  7.61k|  assert(msg);
  639|  7.61k|  if (msg->correlation_id_deprecated) {
  ------------------
  |  Branch (639:7): [True: 0, False: 7.61k]
  ------------------
  640|      0|    pn_data_rewind(msg->correlation_id_deprecated);
  641|      0|    pn_data_put_atom(msg->correlation_id_deprecated, id);
  642|  7.61k|  } else {
  643|  7.61k|    pni_msgid_clear(&msg->correlation_id);
  644|  7.61k|    msg->correlation_id = id;
  645|  7.61k|    pni_msgid_validate_intern(&msg->correlation_id);
  646|  7.61k|  }
  647|  7.61k|  return 0;
  648|  7.61k|}
pn_message_decode:
  732|  73.1k|{
  733|  73.1k|  assert(msg);
  734|       |
  735|  73.1k|  if (!bytes || !size) {
  ------------------
  |  Branch (735:7): [True: 0, False: 73.1k]
  |  Branch (735:17): [True: 0, False: 73.1k]
  ------------------
  736|      0|    return pn_error_format(msg->error, PN_ARG_ERR, "invalid message bytes");
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  737|      0|  }
  738|       |
  739|  73.1k|  pn_bytes_t msg_bytes = {.size=size, .start=bytes};
  740|  73.1k|  pn_bytes_t instructions_bytes = {0, 0};
  741|  73.1k|  pn_bytes_t annotations_bytes = {0, 0};
  742|  73.1k|  pn_bytes_t properties_bytes = {0, 0};
  743|  73.1k|  pn_bytes_t body_bytes = {0, 0};
  744|  73.1k|  pn_bytes_t unknown_section_bytes = {0, 0};
  745|       |
  746|   221k|  while (msg_bytes.size) {
  ------------------
  |  Branch (746:10): [True: 148k, False: 73.1k]
  ------------------
  747|   148k|    bool scanned;
  748|   148k|    uint64_t desc;
  749|   148k|    size_t section_size = pn_amqp_decode_described_type_anything(msg_bytes, &scanned, &desc);
  750|   148k|    if (!scanned) {
  ------------------
  |  Branch (750:9): [True: 128k, False: 19.6k]
  ------------------
  751|   128k|      desc = 0;
  752|   128k|    }
  753|       |
  754|   148k|    switch (desc) {
  755|  3.35k|      case AMQP_DESC_HEADER: {
  ------------------
  |  |  165|  3.35k|#define AMQP_DESC_HEADER ((uint64_t) 112)
  ------------------
  |  Branch (755:7): [True: 3.35k, False: 145k]
  ------------------
  756|  3.35k|        bool priority_q;
  757|  3.35k|        uint8_t priority;
  758|  3.35k|        pn_amqp_decode_message_header(msg_bytes,
  759|  3.35k|                                  &msg->durable,
  760|  3.35k|                                  &priority_q, &priority,
  761|  3.35k|                                  &msg->ttl,
  762|  3.35k|                                  &msg->first_acquirer,
  763|  3.35k|                                  &msg->delivery_count);
  764|  3.35k|        msg->priority = priority_q ? priority : AMQP_HEADER_PRIORITY_DEFAULT;
  ------------------
  |  |   81|  6.59k|#define AMQP_HEADER_PRIORITY_DEFAULT (4) /* ubyte */
  ------------------
  |  Branch (764:25): [True: 107, False: 3.24k]
  ------------------
  765|  3.35k|        break;
  766|      0|      }
  767|  7.61k|      case AMQP_DESC_PROPERTIES: {
  ------------------
  |  |  167|  7.61k|#define AMQP_DESC_PROPERTIES ((uint64_t) 115)
  ------------------
  |  Branch (767:7): [True: 7.61k, False: 140k]
  ------------------
  768|  7.61k|        pn_bytes_t user_id, address, subject, reply_to, ctype, cencoding,
  769|  7.61k|                   group_id, reply_to_group_id;
  770|  7.61k|        pn_atom_t id;
  771|  7.61k|        pn_atom_t correlation_id;
  772|  7.61k|        pn_amqp_decode_message_properties(msg_bytes,  &id,
  773|  7.61k|                           &user_id, &address, &subject, &reply_to,
  774|  7.61k|                           &correlation_id, &ctype, &cencoding,
  775|  7.61k|                           &msg->expiry_time, &msg->creation_time, &group_id,
  776|  7.61k|                           &msg->group_sequence, &reply_to_group_id);
  777|  7.61k|        pni_msgid_fix_interop(&id);
  778|  7.61k|        pn_message_set_id(msg, id);
  779|  7.61k|        int err = pn_string_set_bytes(msg->user_id, user_id);
  780|  7.61k|        if (err) return pn_error_format(msg->error, err, "error setting user_id");
  ------------------
  |  Branch (780:13): [True: 0, False: 7.61k]
  ------------------
  781|  7.61k|        err = pn_string_setn(msg->address, address.start, address.size);
  782|  7.61k|        if (err) return pn_error_format(msg->error, err, "error setting address");
  ------------------
  |  Branch (782:13): [True: 0, False: 7.61k]
  ------------------
  783|  7.61k|        err = pn_string_setn(msg->subject, subject.start, subject.size);
  784|  7.61k|        if (err) return pn_error_format(msg->error, err, "error setting subject");
  ------------------
  |  Branch (784:13): [True: 0, False: 7.61k]
  ------------------
  785|  7.61k|        err = pn_string_setn(msg->reply_to, reply_to.start, reply_to.size);
  786|  7.61k|        if (err) return pn_error_format(msg->error, err, "error setting reply_to");
  ------------------
  |  Branch (786:13): [True: 0, False: 7.61k]
  ------------------
  787|  7.61k|        pni_msgid_fix_interop(&correlation_id);
  788|  7.61k|        pn_message_set_correlation_id(msg, correlation_id);
  789|  7.61k|        err = pn_string_setn(msg->content_type, ctype.start, ctype.size);
  790|  7.61k|        if (err) return pn_error_format(msg->error, err, "error setting content_type");
  ------------------
  |  Branch (790:13): [True: 0, False: 7.61k]
  ------------------
  791|  7.61k|        err = pn_string_setn(msg->content_encoding, cencoding.start,
  792|  7.61k|                             cencoding.size);
  793|  7.61k|        if (err) return pn_error_format(msg->error, err, "error setting content_encoding");
  ------------------
  |  Branch (793:13): [True: 0, False: 7.61k]
  ------------------
  794|  7.61k|        err = pn_string_setn(msg->group_id, group_id.start, group_id.size);
  795|  7.61k|        if (err) return pn_error_format(msg->error, err, "error setting group_id");
  ------------------
  |  Branch (795:13): [True: 0, False: 7.61k]
  ------------------
  796|  7.61k|        err = pn_string_setn(msg->reply_to_group_id, reply_to_group_id.start,
  797|  7.61k|                             reply_to_group_id.size);
  798|  7.61k|        if (err) return pn_error_format(msg->error, err, "error setting reply_to_group_id");
  ------------------
  |  Branch (798:13): [True: 0, False: 7.61k]
  ------------------
  799|  7.61k|        break;
  800|  7.61k|      }
  801|  7.61k|      case AMQP_DESC_DELIVERY_ANNOTATIONS: {
  ------------------
  |  |  211|    405|#define AMQP_DESC_DELIVERY_ANNOTATIONS ((uint64_t) 113)
  ------------------
  |  Branch (801:7): [True: 405, False: 148k]
  ------------------
  802|    405|        pn_amqp_decode_described_raw(msg_bytes, &instructions_bytes);
  803|    405|        break;
  804|  7.61k|      }
  805|    367|      case AMQP_DESC_MESSAGE_ANNOTATIONS: {
  ------------------
  |  |  213|    367|#define AMQP_DESC_MESSAGE_ANNOTATIONS ((uint64_t) 114)
  ------------------
  |  Branch (805:7): [True: 367, False: 148k]
  ------------------
  806|    367|        pn_amqp_decode_described_raw(msg_bytes, &annotations_bytes);
  807|    367|        break;
  808|  7.61k|      }
  809|    196|      case AMQP_DESC_APPLICATION_PROPERTIES: {
  ------------------
  |  |  215|    196|#define AMQP_DESC_APPLICATION_PROPERTIES ((uint64_t) 116)
  ------------------
  |  Branch (809:7): [True: 196, False: 148k]
  ------------------
  810|    196|        pn_amqp_decode_described_raw(msg_bytes, &properties_bytes);
  811|    196|        break;
  812|  7.61k|      }
  813|  1.13k|      case AMQP_DESC_DATA:
  ------------------
  |  |  217|  1.13k|#define AMQP_DESC_DATA ((uint64_t) 117)
  ------------------
  |  Branch (813:7): [True: 1.13k, False: 147k]
  ------------------
  814|  2.09k|      case AMQP_DESC_AMQP_SEQUENCE: {
  ------------------
  |  |  219|  2.09k|#define AMQP_DESC_AMQP_SEQUENCE ((uint64_t) 118)
  ------------------
  |  Branch (814:7): [True: 967, False: 147k]
  ------------------
  815|  2.09k|        msg->inferred = true;
  816|  2.09k|        pn_amqp_decode_described_raw(msg_bytes, &body_bytes);
  817|  2.09k|        break;
  818|  1.13k|      }
  819|  2.53k|      case AMQP_DESC_AMQP_VALUE: {
  ------------------
  |  |  221|  2.53k|#define AMQP_DESC_AMQP_VALUE ((uint64_t) 119)
  ------------------
  |  Branch (819:7): [True: 2.53k, False: 145k]
  ------------------
  820|  2.53k|        msg->inferred = false;
  821|  2.53k|        pn_amqp_decode_described_raw(msg_bytes, &body_bytes);
  822|  2.53k|        break;
  823|  1.13k|      }
  824|     97|      case AMQP_DESC_FOOTER:
  ------------------
  |  |  223|     97|#define AMQP_DESC_FOOTER ((uint64_t) 120)
  ------------------
  |  Branch (824:7): [True: 97, False: 148k]
  ------------------
  825|     97|        break;
  826|   131k|      default: {
  ------------------
  |  Branch (826:7): [True: 131k, False: 16.6k]
  ------------------
  827|   131k|        pn_amqp_decode_raw(msg_bytes, &unknown_section_bytes);
  828|   131k|        break;
  829|  1.13k|      }
  830|   148k|    }
  831|   148k|    msg_bytes = (pn_bytes_t){.size=msg_bytes.size-section_size, .start=msg_bytes.start+section_size};
  832|   148k|  }
  833|  73.1k|  pn_bytes_free(msg->instructions_raw);
  834|  73.1k|  msg->instructions_raw = pn_bytes_dup(instructions_bytes);
  835|  73.1k|  pn_bytes_free(msg->annotations_raw);
  836|  73.1k|  msg->annotations_raw = pn_bytes_dup(annotations_bytes);
  837|  73.1k|  pn_bytes_free(msg->properties_raw);
  838|  73.1k|  msg->properties_raw = pn_bytes_dup(properties_bytes);
  839|  73.1k|  pn_bytes_free(msg->body_raw);
  840|  73.1k|  msg->body_raw = pn_bytes_dup(body_bytes);
  841|  73.1k|  return 0;
  842|  73.1k|}
pn_message_body:
 1083|  73.1k|{
 1084|  73.1k|  if (!msg) return NULL;
  ------------------
  |  Branch (1084:7): [True: 0, False: 73.1k]
  ------------------
 1085|       |  /* No node limit - application body values could be complex,
 1086|       |     and the backing buffer is already limited*/
 1087|  73.1k|  pni_switch_to_data(&msg->body_raw, &msg->body_deprecated,
 1088|  73.1k|                     PNI_DATA_BODY_MAX_NODES);
  ------------------
  |  |  156|  73.1k|#define PNI_DATA_BODY_MAX_NODES    0
  ------------------
 1089|  73.1k|  return msg->body_deprecated;
 1090|  73.1k|}
message.c:pni_message_new:
  337|  73.1k|{
  338|  73.1k|  static const pn_class_t clazz = PN_CLASS(pn_message);
  ------------------
  |  |   67|  73.1k|#define PN_CLASS(PREFIX) {                      \
  |  |   68|  73.1k|    #PREFIX,                                    \
  |  |   69|  73.1k|    CID_ ## PREFIX,                             \
  |  |   70|  73.1k|    NULL,                                       \
  |  |   71|  73.1k|    PREFIX ## _initialize,                      \
  |  |  ------------------
  |  |  |  |  332|  73.1k|#define pn_message_initialize NULL
  |  |  ------------------
  |  |   72|  73.1k|    NULL,                                       \
  |  |   73|  73.1k|    NULL,                                       \
  |  |   74|  73.1k|    NULL,                                       \
  |  |   75|  73.1k|    PREFIX ## _finalize,                        \
  |  |   76|  73.1k|    NULL,                                       \
  |  |   77|  73.1k|    PREFIX ## _hashcode,                        \
  |  |  ------------------
  |  |  |  |  333|  73.1k|#define pn_message_hashcode NULL
  |  |  ------------------
  |  |   78|  73.1k|    PREFIX ## _compare,                         \
  |  |  ------------------
  |  |  |  |  334|  73.1k|#define pn_message_compare NULL
  |  |  ------------------
  |  |   79|  73.1k|    PREFIX ## _inspect                          \
  |  |   80|  73.1k|}
  ------------------
  339|  73.1k|  pn_message_t *msg = (pn_message_t *) pn_class_new(&clazz, size);
  340|  73.1k|  msg->durable = false;
  341|  73.1k|  msg->priority = AMQP_HEADER_PRIORITY_DEFAULT;
  ------------------
  |  |   81|  73.1k|#define AMQP_HEADER_PRIORITY_DEFAULT (4) /* ubyte */
  ------------------
  342|  73.1k|  msg->ttl = 0;
  343|  73.1k|  msg->first_acquirer = false;
  344|  73.1k|  msg->delivery_count = 0;
  345|  73.1k|  msg->id = (pn_atom_t){.type=PN_NULL};
  346|  73.1k|  msg->user_id = pn_string(NULL);
  347|  73.1k|  msg->address = pn_string(NULL);
  348|  73.1k|  msg->subject = pn_string(NULL);
  349|  73.1k|  msg->reply_to = pn_string(NULL);
  350|  73.1k|  msg->correlation_id = (pn_atom_t){.type=PN_NULL};
  351|  73.1k|  msg->content_type = pn_string(NULL);
  352|  73.1k|  msg->content_encoding = pn_string(NULL);
  353|  73.1k|  msg->expiry_time = 0;
  354|  73.1k|  msg->creation_time = 0;
  355|  73.1k|  msg->group_id = pn_string(NULL);
  356|  73.1k|  msg->group_sequence = 0;
  357|  73.1k|  msg->reply_to_group_id = pn_string(NULL);
  358|  73.1k|  msg->instructions_raw = (pn_bytes_t){0, 0};
  359|  73.1k|  msg->annotations_raw = (pn_bytes_t){0, 0};
  360|  73.1k|  msg->properties_raw = (pn_bytes_t){0, 0};
  361|  73.1k|  msg->body_raw = (pn_bytes_t){0, 0};
  362|       |
  363|  73.1k|  msg->inferred = false;
  364|  73.1k|  msg->id_deprecated = NULL;
  365|  73.1k|  msg->correlation_id_deprecated = NULL;
  366|  73.1k|  msg->instructions_deprecated = NULL;
  367|  73.1k|  msg->annotations_deprecated = NULL;
  368|  73.1k|  msg->properties_deprecated = NULL;
  369|  73.1k|  msg->body_deprecated = NULL;
  370|       |
  371|  73.1k|  msg->error = pn_error();
  372|  73.1k|  return msg;
  373|  73.1k|}
message.c:pn_string_set_bytes:
  565|  7.61k|{
  566|  7.61k|  return pn_string_setn(string, bytes.start, bytes.size);
  567|  7.61k|}

pn_list_size:
   36|  76.3M|{
   37|       |  assert(list);
   38|  76.3M|  return list->size;
   39|  76.3M|}
pn_list_get:
   42|  69.7M|{
   43|  69.7M|  assert(list); assert(list->size);
   44|  69.7M|  return list->elements[index % list->size];
   45|  69.7M|}
pn_list_add:
   69|  11.6M|{
   70|       |  assert(list);
   71|  11.6M|  pni_list_ensure(list, list->size + 1);
   72|  11.6M|  list->elements[list->size++] = value;
   73|  11.6M|  pn_class_incref(list->clazz, value);
   74|  11.6M|  return 0;
   75|  11.6M|}
pn_list_pop:
   78|  6.24M|{
   79|  6.24M|  assert(list);
   80|  6.24M|  if (list->size) {
  ------------------
  |  Branch (80:7): [True: 4.38M, False: 1.85M]
  ------------------
   81|  4.38M|    return list->elements[--list->size];
   82|  4.38M|  } else {
   83|       |    return NULL;
   84|  1.85M|  }
   85|  6.24M|}
pn_list_index:
   88|  8.14M|{
   89|  1.49G|  for (size_t i = 0; i < list->size; i++) {
  ------------------
  |  Branch (89:22): [True: 1.49G, False: 2.71M]
  ------------------
   90|  1.49G|    if (pn_class_equals(list->clazz, list->elements[i], value)) {
  ------------------
  |  Branch (90:9): [True: 5.42M, False: 1.48G]
  ------------------
   91|  5.42M|      return i;
   92|  5.42M|    }
   93|  1.49G|  }
   94|       |
   95|  2.71M|  return -1;
   96|  8.14M|}
pn_list_remove:
   99|  8.14M|{
  100|  8.14M|  assert(list);
  101|  8.14M|  ssize_t idx = pn_list_index(list, value);
  102|  8.14M|  if (idx < 0) {
  ------------------
  |  Branch (102:7): [True: 2.71M, False: 5.42M]
  ------------------
  103|  2.71M|    return false;
  104|  5.42M|  } else {
  105|  5.42M|    pn_list_del(list, idx, 1);
  106|  5.42M|  }
  107|       |
  108|  5.42M|  return true;
  109|  8.14M|}
pn_list_del:
  112|  5.46M|{
  113|  5.46M|  assert(list);
  114|  5.46M|  if (!list->size) { return; }
  ------------------
  |  Branch (114:7): [True: 0, False: 5.46M]
  ------------------
  115|  5.46M|  index %= list->size;
  116|       |
  117|  12.7M|  for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (117:19): [True: 7.25M, False: 5.46M]
  ------------------
  118|  7.25M|    pn_class_decref(list->clazz, list->elements[index + i]);
  119|  7.25M|  }
  120|       |
  121|  5.46M|  size_t slide = list->size - (index + n);
  122|  1.49G|  for (size_t i = 0; i < slide; i++) {
  ------------------
  |  Branch (122:22): [True: 1.48G, False: 5.46M]
  ------------------
  123|  1.48G|    list->elements[index + i] = list->elements[index + n + i];
  124|  1.48G|  }
  125|       |
  126|  5.46M|  list->size -= n;
  127|  5.46M|}
pn_list_clear:
  130|  34.6k|{
  131|       |  assert(list);
  132|  34.6k|  pn_list_del(list, 0, list->size);
  133|  34.6k|}
pn_list:
  257|  2.73M|{
  258|  2.73M|  static const pn_class_t list_clazz = PN_CLASS(pn_list);
  ------------------
  |  |   67|  2.73M|#define PN_CLASS(PREFIX) {                      \
  |  |   68|  2.73M|    #PREFIX,                                    \
  |  |   69|  2.73M|    CID_ ## PREFIX,                             \
  |  |   70|  2.73M|    NULL,                                       \
  |  |   71|  2.73M|    PREFIX ## _initialize,                      \
  |  |  ------------------
  |  |  |  |  254|  2.73M|#define pn_list_initialize NULL
  |  |  ------------------
  |  |   72|  2.73M|    NULL,                                       \
  |  |   73|  2.73M|    NULL,                                       \
  |  |   74|  2.73M|    NULL,                                       \
  |  |   75|  2.73M|    PREFIX ## _finalize,                        \
  |  |   76|  2.73M|    NULL,                                       \
  |  |   77|  2.73M|    PREFIX ## _hashcode,                        \
  |  |   78|  2.73M|    PREFIX ## _compare,                         \
  |  |   79|  2.73M|    PREFIX ## _inspect                          \
  |  |   80|  2.73M|}
  ------------------
  259|       |
  260|  2.73M|  pn_list_t *list = (pn_list_t *) pn_class_new(&list_clazz, sizeof(pn_list_t));
  261|  2.73M|  list->clazz = clazz;
  262|  2.73M|  list->capacity = capacity ? capacity : 16;
  ------------------
  |  Branch (262:20): [True: 0, False: 2.73M]
  ------------------
  263|  2.73M|  list->elements = (void **) pni_mem_suballocate(&list_clazz, list, list->capacity * sizeof(void *));
  264|  2.73M|  list->size = 0;
  265|  2.73M|  return list;
  266|  2.73M|}
list.c:pni_list_ensure:
   57|  11.6M|{
   58|  11.6M|  assert(list);
   59|  11.6M|  if (list->capacity < capacity) {
  ------------------
  |  Branch (59:7): [True: 42.3k, False: 11.6M]
  ------------------
   60|  42.3k|    size_t newcap = list->capacity;
   61|  84.7k|    while (newcap < capacity) { newcap *= 2; }
  ------------------
  |  Branch (61:12): [True: 42.3k, False: 42.3k]
  ------------------
   62|  42.3k|    list->elements = (void **) pni_mem_subreallocate(pn_class(list), list, list->elements, newcap * sizeof(void *));
   63|       |    assert(list->elements);
   64|  42.3k|    list->capacity = newcap;
   65|  42.3k|  }
   66|  11.6M|}
list.c:pn_list_finalize:
  196|  2.73M|{
  197|  2.73M|  assert(object);
  198|  2.73M|  pn_list_t *list = (pn_list_t *) object;
  199|  2.77M|  for (size_t i = 0; i < list->size; i++) {
  ------------------
  |  Branch (199:22): [True: 33.2k, False: 2.73M]
  ------------------
  200|  33.2k|    pn_class_decref(list->clazz, pn_list_get(list, i));
  201|  33.2k|  }
  202|  2.73M|  pni_mem_subdeallocate(pn_class(list), list, list->elements);
  203|  2.73M|}

pn_map:
  123|  5.26M|{
  124|  5.26M|  static const pn_class_t clazz = PN_CLASS(pn_map);
  ------------------
  |  |   67|  5.26M|#define PN_CLASS(PREFIX) {                      \
  |  |   68|  5.26M|    #PREFIX,                                    \
  |  |   69|  5.26M|    CID_ ## PREFIX,                             \
  |  |   70|  5.26M|    NULL,                                       \
  |  |   71|  5.26M|    PREFIX ## _initialize,                      \
  |  |  ------------------
  |  |  |  |  118|  5.26M|#define pn_map_initialize NULL
  |  |  ------------------
  |  |   72|  5.26M|    NULL,                                       \
  |  |   73|  5.26M|    NULL,                                       \
  |  |   74|  5.26M|    NULL,                                       \
  |  |   75|  5.26M|    PREFIX ## _finalize,                        \
  |  |   76|  5.26M|    NULL,                                       \
  |  |   77|  5.26M|    PREFIX ## _hashcode,                        \
  |  |   78|  5.26M|    PREFIX ## _compare,                         \
  |  |  ------------------
  |  |  |  |  119|  5.26M|#define pn_map_compare NULL
  |  |  ------------------
  |  |   79|  5.26M|    PREFIX ## _inspect                          \
  |  |   80|  5.26M|}
  ------------------
  125|       |
  126|  5.26M|  pn_map_t *map = (pn_map_t *) pn_class_new(&clazz, sizeof(pn_map_t));
  127|  5.26M|  map->key = key;
  128|  5.26M|  map->value = value;
  129|  5.26M|  map->capacity = capacity ? capacity : 16;
  ------------------
  |  Branch (129:19): [True: 0, False: 5.26M]
  ------------------
  130|  5.26M|  map->addressable = (size_t) (map->capacity * 0.86);
  131|  5.26M|  if (!map->addressable) map->addressable = map->capacity;
  ------------------
  |  Branch (131:7): [True: 0, False: 5.26M]
  ------------------
  132|  5.26M|  map->load_factor = load_factor;
  133|  5.26M|  map->hashcode = pn_hashcode;
  134|  5.26M|  map->equals = pn_equals;
  135|  5.26M|  pni_map_allocate(map);
  136|  5.26M|  return map;
  137|  5.26M|}
pn_map_size:
  140|  34.2k|{
  141|       |  assert(map);
  142|  34.2k|  return map->size;
  143|  34.2k|}
pn_map_put:
  249|  2.82M|{
  250|  2.82M|  assert(map);
  251|  2.82M|  pni_entry_t *entry = pni_map_entry(map, key, NULL, true);
  252|  2.82M|  void *dref_val = entry->value;
  253|  2.82M|  entry->value = value;
  254|  2.82M|  pn_class_incref(map->value, value);
  255|  2.82M|  pn_class_decref(map->value, dref_val);
  256|  2.82M|  return 0;
  257|  2.82M|}
pn_map_get:
  260|  2.43M|{
  261|  2.43M|  assert(map);
  262|  2.43M|  pni_entry_t *entry = pni_map_entry(map, key, NULL, false);
  263|  2.43M|  return entry ? entry->value : NULL;
  ------------------
  |  Branch (263:10): [True: 2.27M, False: 154k]
  ------------------
  264|  2.43M|}
pn_map_del:
  311|  3.27M|{
  312|  3.27M|  assert(map);
  313|  3.27M|  pni_entry_t *prev = NULL;
  314|  3.27M|  pni_entry_t *entry = pni_map_entry(map, key, &prev, false);
  315|  3.27M|  if (entry) {
  ------------------
  |  Branch (315:7): [True: 1.42M, False: 1.85M]
  ------------------
  316|  1.42M|    uint8_t orig_state = entry->state;
  317|  1.42M|    size_t orig_next = entry->next;
  318|       |
  319|  1.42M|    void *dref_key = entry->key;
  320|  1.42M|    void *dref_value = entry->value;
  321|  1.42M|    if (prev) {
  ------------------
  |  Branch (321:9): [True: 1.91k, False: 1.42M]
  ------------------
  322|  1.91k|      prev->next = 0;
  323|  1.91k|      prev->state = PNI_ENTRY_TAIL;
  ------------------
  |  |   30|  1.91k|#define PNI_ENTRY_TAIL (2)
  ------------------
  324|  1.91k|    }
  325|  1.42M|    entry->state = PNI_ENTRY_FREE;
  ------------------
  |  |   28|  1.42M|#define PNI_ENTRY_FREE (0)
  ------------------
  326|  1.42M|    entry->next = 0;
  327|  1.42M|    entry->key = NULL;
  328|  1.42M|    entry->value = NULL;
  329|  1.42M|    map->size--;
  330|       |
  331|  1.42M|    if (orig_state == PNI_ENTRY_LINK) {
  ------------------
  |  |   29|  1.42M|#define PNI_ENTRY_LINK (1)
  ------------------
  |  Branch (331:9): [True: 1.81k, False: 1.42M]
  ------------------
  332|  1.81k|      pni_map_rehash(map, orig_next);
  333|  1.81k|    }
  334|       |
  335|       |    // do this last as it may trigger further deletions
  336|  1.42M|    pn_class_decref(map->key, dref_key);
  337|  1.42M|    pn_class_decref(map->value, dref_value);
  338|  1.42M|  }
  339|  3.27M|}
pn_map_head:
  342|  3.14M|{
  343|  3.14M|  assert(map);
  344|  50.0M|  for (size_t i = 0; i < map->capacity; i++)
  ------------------
  |  Branch (344:22): [True: 47.1M, False: 2.92M]
  ------------------
  345|  47.1M|  {
  346|  47.1M|    if (map->entries[i].state != PNI_ENTRY_FREE) {
  ------------------
  |  |   28|  47.1M|#define PNI_ENTRY_FREE (0)
  ------------------
  |  Branch (346:9): [True: 226k, False: 46.9M]
  ------------------
  347|   226k|      return (pn_handle_t)(i + 1);
  348|   226k|    }
  349|  47.1M|  }
  350|       |
  351|  2.92M|  return 0;
  352|  3.14M|}
pn_map_next:
  355|   251k|{
  356|  3.46M|  for (size_t i = (size_t)entry; i < map->capacity; i++) {
  ------------------
  |  Branch (356:34): [True: 3.23M, False: 226k]
  ------------------
  357|  3.23M|    if (map->entries[i].state != PNI_ENTRY_FREE) {
  ------------------
  |  |   28|  3.23M|#define PNI_ENTRY_FREE (0)
  ------------------
  |  Branch (357:9): [True: 24.6k, False: 3.20M]
  ------------------
  358|  24.6k|      return (pn_handle_t)(i + 1);
  359|  24.6k|    }
  360|  3.23M|  }
  361|       |
  362|   226k|  return 0;
  363|   251k|}
pn_map_key:
  366|   166k|{
  367|   166k|  assert(map);
  368|       |  assert(entry);
  369|   166k|  return map->entries[(size_t)entry - 1].key;
  370|   166k|}
pn_map_value:
  373|   249k|{
  374|   249k|  assert(map);
  375|       |  assert(entry);
  376|   249k|  return map->entries[(size_t)entry - 1].value;
  377|   249k|}
pn_hash:
  410|  5.26M|{
  411|  5.26M|  pn_hash_t *hash = (pn_hash_t *) pn_map(PN_UINTPTR, clazz, capacity, load_factor);
  412|  5.26M|  hash->map.hashcode = pni_identity_hashcode;
  413|  5.26M|  hash->map.equals = pni_identity_equals;
  414|  5.26M|  return hash;
  415|  5.26M|}
pn_hash_size:
  418|  34.2k|{
  419|  34.2k|  return pn_map_size(&hash->map);
  420|  34.2k|}
pn_hash_put:
  423|  2.82M|{
  424|  2.82M|  return pn_map_put(&hash->map, (void *) key, value);
  425|  2.82M|}
pn_hash_get:
  428|  2.43M|{
  429|  2.43M|  return pn_map_get(&hash->map, (void *) key);
  430|  2.43M|}
pn_hash_del:
  433|  3.27M|{
  434|  3.27M|  pn_map_del(&hash->map, (void *) key);
  435|  3.27M|}
pn_hash_head:
  438|  3.14M|{
  439|  3.14M|  return pn_map_head(&hash->map);
  440|  3.14M|}
pn_hash_next:
  443|   251k|{
  444|   251k|  return pn_map_next(&hash->map, entry);
  445|   251k|}
pn_hash_key:
  448|   166k|{
  449|   166k|  return (uintptr_t) pn_map_key(&hash->map, entry);
  450|   166k|}
pn_hash_value:
  453|   249k|{
  454|   249k|  return pn_map_value(&hash->map, entry);
  455|   249k|}
map.c:pn_map_finalize:
   52|  5.26M|{
   53|  5.26M|  pn_map_t *map = (pn_map_t *) object;
   54|       |
   55|  89.5M|  for (size_t i = 0; i < map->capacity; i++) {
  ------------------
  |  Branch (55:22): [True: 84.2M, False: 5.26M]
  ------------------
   56|  84.2M|    if (map->entries[i].state != PNI_ENTRY_FREE) {
  ------------------
  |  |   28|  84.2M|#define PNI_ENTRY_FREE (0)
  ------------------
  |  Branch (56:9): [True: 892, False: 84.2M]
  ------------------
   57|    892|      pn_class_decref(map->key, map->entries[i].key);
   58|    892|      pn_class_decref(map->value, map->entries[i].value);
   59|    892|    }
   60|  84.2M|  }
   61|       |
   62|  5.26M|  pni_mem_subdeallocate(pn_class(map), map, map->entries);
   63|  5.26M|}
map.c:pni_map_allocate:
   83|  5.26M|{
   84|  5.26M|  map->entries = (pni_entry_t *) pni_mem_suballocate(pn_class(map), map, map->capacity * sizeof (pni_entry_t));
   85|  5.26M|  if (map->entries != NULL) {
  ------------------
  |  Branch (85:7): [True: 5.26M, False: 0]
  ------------------
   86|  89.5M|    for (size_t i = 0; i < map->capacity; i++) {
  ------------------
  |  Branch (86:24): [True: 84.3M, False: 5.26M]
  ------------------
   87|  84.3M|      map->entries[i].key = NULL;
   88|  84.3M|      map->entries[i].value = NULL;
   89|  84.3M|      map->entries[i].next = 0;
   90|  84.3M|      map->entries[i].state = PNI_ENTRY_FREE;
  ------------------
  |  |   28|  84.3M|#define PNI_ENTRY_FREE (0)
  ------------------
   91|  84.3M|    }
   92|  5.26M|  }
   93|  5.26M|  map->size = 0;
   94|  5.26M|}
map.c:pni_map_entry:
  189|  8.53M|{
  190|  8.53M|  uintptr_t hashcode = map->hashcode(key);
  191|       |
  192|  8.53M|  pni_entry_t *entry = &map->entries[hashcode % map->addressable];
  193|  8.53M|  pni_entry_t *prev = NULL;
  194|       |
  195|  8.53M|  if (entry->state == PNI_ENTRY_FREE) {
  ------------------
  |  |   28|  8.53M|#define PNI_ENTRY_FREE (0)
  ------------------
  |  Branch (195:7): [True: 3.42M, False: 5.11M]
  ------------------
  196|  3.42M|    if (create) {
  ------------------
  |  Branch (196:9): [True: 1.42M, False: 2.00M]
  ------------------
  197|  1.42M|      entry->state = PNI_ENTRY_TAIL;
  ------------------
  |  |   30|  1.42M|#define PNI_ENTRY_TAIL (2)
  ------------------
  198|  1.42M|      entry->key = key;
  199|  1.42M|      pn_class_incref(map->key, key);
  200|  1.42M|      map->size++;
  201|  1.42M|      return entry;
  202|  2.00M|    } else {
  203|  2.00M|      return NULL;
  204|  2.00M|    }
  205|  3.42M|  }
  206|       |
  207|  5.17M|  while (true) {
  ------------------
  |  Branch (207:10): [True: 5.17M, Folded]
  ------------------
  208|  5.17M|    if (map->equals(entry->key, key)) {
  ------------------
  |  Branch (208:9): [True: 5.10M, False: 69.7k]
  ------------------
  209|  5.10M|      if (pprev) *pprev = prev;
  ------------------
  |  Branch (209:11): [True: 1.42M, False: 3.67M]
  ------------------
  210|  5.10M|      return entry;
  211|  5.10M|    }
  212|       |
  213|  69.7k|    if (entry->state == PNI_ENTRY_TAIL) {
  ------------------
  |  |   30|  69.7k|#define PNI_ENTRY_TAIL (2)
  ------------------
  |  Branch (213:9): [True: 11.0k, False: 58.6k]
  ------------------
  214|  11.0k|      break;
  215|  58.6k|    } else {
  216|  58.6k|      prev = entry;
  217|  58.6k|      entry = &map->entries[entry->next];
  218|  58.6k|    }
  219|  69.7k|  }
  220|       |
  221|  11.0k|  if (create) {
  ------------------
  |  Branch (221:7): [True: 4.43k, False: 6.66k]
  ------------------
  222|  4.43k|    if (pni_map_ensure(map, map->size + 1)) {
  ------------------
  |  Branch (222:9): [True: 218, False: 4.21k]
  ------------------
  223|       |      // if we had to grow the table we need to start over
  224|    218|      return pni_map_entry(map, key, pprev, create);
  225|    218|    }
  226|       |
  227|  4.21k|    size_t empty = 0;
  228|  13.7k|    for (size_t i = 0; i < map->capacity; i++) {
  ------------------
  |  Branch (228:24): [True: 13.7k, False: 0]
  ------------------
  229|  13.7k|      size_t idx = map->capacity - i - 1;
  230|  13.7k|      if (map->entries[idx].state == PNI_ENTRY_FREE) {
  ------------------
  |  |   28|  13.7k|#define PNI_ENTRY_FREE (0)
  ------------------
  |  Branch (230:11): [True: 4.21k, False: 9.51k]
  ------------------
  231|  4.21k|        empty = idx;
  232|  4.21k|        break;
  233|  4.21k|      }
  234|  13.7k|    }
  235|  4.21k|    entry->next = empty;
  236|  4.21k|    entry->state = PNI_ENTRY_LINK;
  ------------------
  |  |   29|  4.21k|#define PNI_ENTRY_LINK (1)
  ------------------
  237|  4.21k|    map->entries[empty].state = PNI_ENTRY_TAIL;
  ------------------
  |  |   30|  4.21k|#define PNI_ENTRY_TAIL (2)
  ------------------
  238|  4.21k|    map->entries[empty].key = key;
  239|  4.21k|    pn_class_incref(map->key, key);
  240|  4.21k|    if (pprev) *pprev = entry;
  ------------------
  |  Branch (240:9): [True: 0, False: 4.21k]
  ------------------
  241|  4.21k|    map->size++;
  242|  4.21k|    return &map->entries[empty];
  243|  6.66k|  } else {
  244|       |    return NULL;
  245|  6.66k|  }
  246|  11.0k|}
map.c:pni_map_ensure:
  151|  4.43k|{
  152|  4.43k|  float load = pni_map_load(map);
  153|  4.43k|  if (capacity <= map->capacity && load <= map->load_factor) {
  ------------------
  |  Branch (153:7): [True: 4.43k, False: 3]
  |  Branch (153:36): [True: 4.21k, False: 215]
  ------------------
  154|  4.21k|    return false;
  155|  4.21k|  }
  156|       |
  157|    218|  size_t oldcap = map->capacity;
  158|       |
  159|    436|  while (map->capacity < capacity || pni_map_load(map) > map->load_factor) {
  ------------------
  |  Branch (159:10): [True: 3, False: 433]
  |  Branch (159:38): [True: 215, False: 218]
  ------------------
  160|    218|    map->capacity *= 2;
  161|    218|    map->addressable = (size_t) (0.86 * map->capacity);
  162|    218|  }
  163|       |
  164|    218|  pni_entry_t *entries = map->entries;
  165|    218|  pni_map_allocate(map);
  166|       |
  167|  5.75k|  for (size_t i = 0; i < oldcap; i++) {
  ------------------
  |  Branch (167:22): [True: 5.53k, False: 218]
  ------------------
  168|  5.53k|    if (entries[i].state != PNI_ENTRY_FREE) {
  ------------------
  |  |   28|  5.53k|#define PNI_ENTRY_FREE (0)
  ------------------
  |  Branch (168:9): [True: 3.73k, False: 1.80k]
  ------------------
  169|  3.73k|      void *key = entries[i].key;
  170|  3.73k|      void *value = entries[i].value;
  171|  3.73k|      pn_map_put(map, key, value);
  172|  3.73k|    }
  173|  5.53k|  }
  174|       |
  175|  5.75k|  for (size_t i = 0; i < oldcap; i++) {
  ------------------
  |  Branch (175:22): [True: 5.53k, False: 218]
  ------------------
  176|  5.53k|    if (entries[i].state != PNI_ENTRY_FREE) {
  ------------------
  |  |   28|  5.53k|#define PNI_ENTRY_FREE (0)
  ------------------
  |  Branch (176:9): [True: 3.73k, False: 1.80k]
  ------------------
  177|  3.73k|      void *key = entries[i].key;
  178|  3.73k|      void *value = entries[i].value;
  179|  3.73k|      pn_class_decref(map->key, key);
  180|  3.73k|      pn_class_decref(map->value, value);
  181|  3.73k|    }
  182|  5.53k|  }
  183|       |
  184|    218|  pni_mem_subdeallocate(pn_class(map), map, entries);
  185|       |  return true;
  186|  4.43k|}
map.c:pni_map_load:
  146|  4.86k|{
  147|  4.86k|  return ((float) map->size) / ((float) map->addressable);
  148|  4.86k|}
map.c:pni_map_rehash:
  267|  1.81k|{
  268|       |  //reinsert entries in chain starting at index
  269|  1.81k|  assert(map);
  270|  1.81k|  size_t i = index;
  271|  1.81k|  bool complete = false;
  272|  4.37k|  while (!complete) {
  ------------------
  |  Branch (272:10): [True: 2.55k, False: 1.81k]
  ------------------
  273|  2.55k|    pni_entry_t *entry = &map->entries[i];
  274|  2.55k|    assert(entry);
  275|  2.55k|    assert(entry->state != PNI_ENTRY_FREE);
  276|  2.55k|    size_t current = i;
  277|  2.55k|    if (entry->state == PNI_ENTRY_TAIL) {
  ------------------
  |  |   30|  2.55k|#define PNI_ENTRY_TAIL (2)
  ------------------
  |  Branch (277:9): [True: 1.81k, False: 733]
  ------------------
  278|  1.81k|      complete = true;
  279|  1.81k|    } else {
  280|    733|      assert(entry->state == PNI_ENTRY_LINK);
  281|    733|      i = entry->next;
  282|    733|    }
  283|  2.55k|    uintptr_t hashcode = map->hashcode(entry->key);
  284|  2.55k|    pni_entry_t *reloc = &map->entries[hashcode % map->addressable];
  285|  2.55k|    if (reloc->state == PNI_ENTRY_FREE) {
  ------------------
  |  |   28|  2.55k|#define PNI_ENTRY_FREE (0)
  ------------------
  |  Branch (285:9): [True: 1.02k, False: 1.52k]
  ------------------
  286|       |      //correct addressable slot is available, copy into that...
  287|  1.02k|      reloc->state = PNI_ENTRY_TAIL;
  ------------------
  |  |   30|  1.02k|#define PNI_ENTRY_TAIL (2)
  ------------------
  288|  1.02k|      reloc->key = entry->key;
  289|  1.02k|      reloc->value = entry->value;
  290|       |      //...then free the current entry
  291|  1.02k|      entry->key = NULL;
  292|  1.02k|      entry->value = NULL;
  293|  1.02k|      entry->state = PNI_ENTRY_FREE;
  ------------------
  |  |   28|  1.02k|#define PNI_ENTRY_FREE (0)
  ------------------
  294|  1.02k|      entry->next = 0;
  295|  1.52k|    } else {
  296|       |      //iterate to end of chain...
  297|  3.10k|      while (reloc->state == PNI_ENTRY_LINK) {
  ------------------
  |  |   29|  3.10k|#define PNI_ENTRY_LINK (1)
  ------------------
  |  Branch (297:14): [True: 1.58k, False: 1.52k]
  ------------------
  298|  1.58k|        reloc = &map->entries[reloc->next];
  299|  1.58k|      }
  300|  1.52k|      assert(reloc->state == PNI_ENTRY_TAIL);
  301|       |      //... and append current entry
  302|  1.52k|      reloc->state = PNI_ENTRY_LINK;
  ------------------
  |  |   29|  1.52k|#define PNI_ENTRY_LINK (1)
  ------------------
  303|  1.52k|      reloc->next = current;
  304|  1.52k|      entry->state = PNI_ENTRY_TAIL;
  ------------------
  |  |   30|  1.52k|#define PNI_ENTRY_TAIL (2)
  ------------------
  305|  1.52k|      entry->next = 0;
  306|  1.52k|    }
  307|  2.55k|  }
  308|  1.81k|}
map.c:pni_identity_hashcode:
  384|  8.53M|{
  385|  8.53M|  return (uintptr_t ) obj;
  386|  8.53M|}
map.c:pni_identity_equals:
  389|  5.17M|{
  390|  5.17M|  return a == b;
  391|  5.17M|}

pn_void_incref:
   46|  8.30M|void pn_void_incref(void* p) {}
pn_void_decref:
   47|  8.30M|void pn_void_decref(void* p) {}
pn_void_refcount:
   48|  8.30M|int pn_void_refcount(void *object) { return -1; }
pn_class_id:
   91|   993k|{
   92|   993k|  return clazz->cid;
   93|   993k|}
pn_object_incref:
  132|  12.1M|void pn_object_incref(void *object) {
  133|  12.1M|  pni_default_incref(object);
  134|  12.1M|}
pn_class_new:
  177|  25.6M|{
  178|  25.6M|  assert(clazz);
  179|  25.6M|  void *object = pni_class_new(clazz, size);
  180|  25.6M|  if (object && clazz->initialize) {
  ------------------
  |  Branch (180:7): [True: 25.6M, False: 0]
  |  Branch (180:17): [True: 6.53M, False: 19.1M]
  ------------------
  181|  6.53M|    clazz->initialize(object);
  182|  6.53M|  }
  183|  25.6M|  return object;
  184|  25.6M|}
pn_class_incref:
  187|  22.0M|{
  188|  22.0M|  if (object) {
  ------------------
  |  Branch (188:7): [True: 20.7M, False: 1.37M]
  ------------------
  189|  20.7M|    pni_class_incref(clazz, object);
  190|  20.7M|  }
  191|  22.0M|  return object;
  192|  22.0M|}
pn_class_decref:
  200|  30.1M|{
  201|  30.1M|  if (object) {
  ------------------
  |  Branch (201:7): [True: 16.3M, False: 13.7M]
  ------------------
  202|  16.3M|    pni_class_decref(clazz, object);
  203|  16.3M|    int rc = pni_class_refcount(clazz, object);
  204|  16.3M|    if (rc == 0) {
  ------------------
  |  Branch (204:9): [True: 3.61M, False: 12.7M]
  ------------------
  205|  3.61M|      if (clazz->finalize) {
  ------------------
  |  Branch (205:11): [True: 3.61M, False: 0]
  ------------------
  206|  3.61M|        clazz->finalize(object);
  207|       |        // check the refcount again in case the finalizer created a
  208|       |        // new reference
  209|  3.61M|        rc = pni_class_refcount(clazz, object);
  210|  3.61M|      }
  211|  3.61M|      if (rc == 0) {
  ------------------
  |  Branch (211:11): [True: 1.92M, False: 1.68M]
  ------------------
  212|  1.92M|        pni_class_free(clazz, object);
  213|  1.92M|        return 0;
  214|  1.92M|      }
  215|  12.7M|    } else {
  216|  12.7M|      return rc;
  217|  12.7M|    }
  218|  16.3M|  }
  219|       |
  220|  15.4M|  return 0;
  221|  30.1M|}
pn_class_compare:
  241|  1.49G|{
  242|  1.49G|  if (a == b) return 0;
  ------------------
  |  Branch (242:7): [True: 5.42M, False: 1.48G]
  ------------------
  243|       |
  244|  1.48G|  if (a && b) {
  ------------------
  |  Branch (244:7): [True: 1.48G, False: 0]
  |  Branch (244:12): [True: 1.48G, False: 0]
  ------------------
  245|  1.48G|    if (clazz->compare) {
  ------------------
  |  Branch (245:9): [True: 1.48G, False: 0]
  ------------------
  246|  1.48G|      return clazz->compare(a, b);
  247|  1.48G|    }
  248|  1.48G|  }
  249|      0|  return (intptr_t) a - (intptr_t) b;
  250|  1.48G|}
pn_class_equals:
  253|  1.49G|{
  254|  1.49G|  return pn_class_compare(clazz, a, b) == 0;
  255|  1.49G|}
pn_incref:
  271|  16.4M|{
  272|  16.4M|  if (object) {
  ------------------
  |  Branch (272:7): [True: 16.4M, False: 34.6k]
  ------------------
  273|  16.4M|    const pn_class_t *clazz = pni_head(object)->clazz;
  ------------------
  |  |   62|  16.4M|#define pni_head(PTR) \
  |  |   63|  16.4M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  274|  16.4M|    pni_class_incref(clazz, object);
  275|  16.4M|  }
  276|  16.4M|  return object;
  277|  16.4M|}
pn_decref:
  280|  29.3M|{
  281|  29.3M|  if (object) {
  ------------------
  |  Branch (281:7): [True: 27.3M, False: 1.92M]
  ------------------
  282|  27.3M|    const pn_class_t *clazz = pni_head(object)->clazz;
  ------------------
  |  |   62|  27.3M|#define pni_head(PTR) \
  |  |   63|  27.3M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  283|  27.3M|    pni_class_decref(clazz, object);
  284|  27.3M|    int rc = pni_class_refcount(clazz, object);
  285|  27.3M|    if (rc == 0) {
  ------------------
  |  Branch (285:9): [True: 13.6M, False: 13.7M]
  ------------------
  286|  13.6M|      if (clazz->finalize) {
  ------------------
  |  Branch (286:11): [True: 13.6M, False: 0]
  ------------------
  287|  13.6M|        clazz->finalize(object);
  288|       |        // check the refcount again in case the finalizer created a
  289|       |        // new reference
  290|  13.6M|        rc = pni_class_refcount(clazz, object);
  291|  13.6M|      }
  292|  13.6M|      if (rc == 0) {
  ------------------
  |  Branch (292:11): [True: 4.61M, False: 9.05M]
  ------------------
  293|  4.61M|        pni_class_free(clazz, object);
  294|  4.61M|        return 0;
  295|  4.61M|      }
  296|  13.7M|    } else {
  297|  13.7M|      return rc;
  298|  13.7M|    }
  299|  27.3M|  }
  300|  10.9M|  return 0;
  301|  29.3M|}
pn_refcount:
  304|  13.7M|{
  305|  13.7M|  assert(object);
  306|  13.7M|  const pn_class_t *clazz = pni_head(object)->clazz;
  ------------------
  |  |   62|  13.7M|#define pni_head(PTR) \
  |  |   63|  13.7M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  307|  13.7M|  return pni_class_refcount(clazz, object);
  308|  13.7M|}
pn_free:
  311|  61.5M|{
  312|  61.5M|  if (object) {
  ------------------
  |  Branch (312:7): [True: 19.1M, False: 42.4M]
  ------------------
  313|  19.1M|    const pn_class_t *clazz = pni_head(object)->clazz;
  ------------------
  |  |   62|  19.1M|#define pni_head(PTR) \
  |  |   63|  19.1M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  314|  19.1M|    int rc = pni_class_refcount(clazz, object);
  315|  19.1M|    assert(rc == 1 || rc == -1);
  316|  19.1M|    if (rc == 1) {
  ------------------
  |  Branch (316:9): [True: 19.1M, False: 0]
  ------------------
  317|  19.1M|      pni_class_decref(clazz, object);
  318|  19.1M|      assert(pni_class_refcount(clazz, object) == 0);
  319|  19.1M|      if (clazz->finalize) {
  ------------------
  |  Branch (319:11): [True: 19.1M, False: 0]
  ------------------
  320|  19.1M|        clazz->finalize(object);
  321|  19.1M|      }
  322|  19.1M|      if (pni_class_refcount(clazz, object) == 0) {
  ------------------
  |  Branch (322:11): [True: 19.1M, False: 11.4k]
  ------------------
  323|  19.1M|        pni_class_free(clazz, object);
  324|  19.1M|      }
  325|  19.1M|    } else {
  326|      0|      if (clazz->finalize) {
  ------------------
  |  Branch (326:11): [True: 0, False: 0]
  ------------------
  327|      0|        clazz->finalize(object);
  328|      0|      }
  329|      0|      pni_class_free(clazz, object);
  330|      0|    }
  331|  19.1M|  }
  332|  61.5M|}
pn_class:
  335|  51.5M|{
  336|  51.5M|  if (object) {
  ------------------
  |  Branch (336:7): [True: 51.5M, False: 0]
  ------------------
  337|  51.5M|    return pni_head(object)->clazz;
  ------------------
  |  |   62|  51.5M|#define pni_head(PTR) \
  |  |   63|  51.5M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  338|  51.5M|  } else {
  339|      0|    return PN_DEFAULT;
  340|      0|  }
  341|  51.5M|}
pn_compare:
  357|  1.48G|{
  358|  1.48G|  if (a == b) return 0;
  ------------------
  |  Branch (358:7): [True: 0, False: 1.48G]
  ------------------
  359|       |
  360|  1.48G|  if (a && b) {
  ------------------
  |  Branch (360:7): [True: 1.48G, False: 0]
  |  Branch (360:12): [True: 1.48G, False: 0]
  ------------------
  361|  1.48G|    const pn_class_t *clazz = pni_head(a)->clazz;
  ------------------
  |  |   62|  1.48G|#define pni_head(PTR) \
  |  |   63|  1.48G|(((pni_head_t *) (PTR)) - 1)
  ------------------
  362|  1.48G|    if (clazz->compare) {
  ------------------
  |  Branch (362:9): [True: 0, False: 1.48G]
  ------------------
  363|      0|      return clazz->compare(a, b);
  364|      0|    }
  365|  1.48G|  }
  366|  1.48G|  return (intptr_t) a - (intptr_t) b;
  367|  1.48G|}
pn_finspect:
  398|  73.1k|{
  399|  73.1k|  if (!object) {
  ------------------
  |  Branch (399:7): [True: 0, False: 73.1k]
  ------------------
  400|      0|    pn_fixed_string_addf(dst, "pn_object<%p>", object);
  401|      0|    return;
  402|      0|  }
  403|       |
  404|  73.1k|  const pn_class_t *clazz = pni_head(object)->clazz;
  ------------------
  |  |   62|  73.1k|#define pni_head(PTR) \
  |  |   63|  73.1k|(((pni_head_t *) (PTR)) - 1)
  ------------------
  405|       |
  406|  73.1k|  if (clazz->inspect) {
  ------------------
  |  Branch (406:7): [True: 73.1k, False: 0]
  ------------------
  407|  73.1k|    clazz->inspect(object, dst);
  408|  73.1k|    return;
  409|  73.1k|  }
  410|       |
  411|      0|  const char *name = clazz->name ? clazz->name : "<anon>";
  ------------------
  |  Branch (411:22): [True: 0, False: 0]
  ------------------
  412|      0|  pn_fixed_string_addf(dst, "%s<%p>", name, object);
  413|      0|  return;
  414|  73.1k|}
pn_tostring:
  417|  73.1k|{
  418|  73.1k|  char buf[1024];
  419|  73.1k|  pn_fixed_string_t s = pn_fixed_string(buf, sizeof(buf));
  420|  73.1k|  pn_finspect(object, &s);
  421|  73.1k|  pn_fixed_string_terminate(&s);
  422|       |
  423|  73.1k|  int l = s.position+1; // include final null
  424|  73.1k|  char *r = malloc(l);
  425|  73.1k|  strncpy(r, buf, l);
  426|  73.1k|  return r;
  427|  73.1k|}
object.c:pni_default_incref:
  107|  28.8M|static inline void pni_default_incref(void *object) {
  108|  28.8M|  if (object) {
  ------------------
  |  Branch (108:7): [True: 28.8M, False: 0]
  ------------------
  109|  28.8M|    pni_head(object)->refcount++;
  ------------------
  |  |   62|  28.8M|#define pni_head(PTR) \
  |  |   63|  28.8M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  110|  28.8M|  }
  111|  28.8M|}
object.c:pni_class_new:
  136|  25.6M|static inline void *pni_class_new(const pn_class_t *clazz, size_t size) {
  137|  25.6M|  if (clazz->newinst) {
  ------------------
  |  Branch (137:7): [True: 0, False: 25.6M]
  ------------------
  138|      0|    return clazz->newinst(clazz, size);
  139|  25.6M|  } else {
  140|  25.6M|    return pni_default_new(clazz, size);
  141|  25.6M|  }
  142|  25.6M|}
object.c:pni_default_new:
   96|  25.6M|{
   97|  25.6M|  void *object = NULL;
   98|  25.6M|  pni_head_t *head = (pni_head_t *) pni_mem_zallocate(clazz, sizeof(pni_head_t) + size);
   99|  25.6M|  if (head != NULL) {
  ------------------
  |  Branch (99:7): [True: 25.6M, False: 0]
  ------------------
  100|  25.6M|    object = head + 1;
  101|  25.6M|    head->clazz = clazz;
  102|  25.6M|    head->refcount = 1;
  103|  25.6M|  }
  104|  25.6M|  return object;
  105|  25.6M|}
object.c:pni_class_incref:
  144|  37.1M|static inline void pni_class_incref(const pn_class_t *clazz, void *object) {
  145|  37.1M|  if (clazz->incref) {
  ------------------
  |  Branch (145:7): [True: 20.4M, False: 16.6M]
  ------------------
  146|  20.4M|    clazz->incref(object);
  147|  20.4M|  } else {
  148|  16.6M|    pni_default_incref(object);
  149|  16.6M|  }
  150|  37.1M|}
object.c:pni_class_refcount:
  160|   112M|static inline int pni_class_refcount(const pn_class_t *clazz, void *object) {
  161|   112M|  if (clazz->refcount) {
  ------------------
  |  Branch (161:7): [True: 8.30M, False: 104M]
  ------------------
  162|  8.30M|    return clazz->refcount(object);
  163|   104M|  } else {
  164|   104M|    return pni_default_refcount(object);
  165|   104M|  }
  166|   112M|}
object.c:pni_default_refcount:
  114|   104M|{
  115|   104M|  assert(object);
  116|   104M|  return pni_head(object)->refcount;
  ------------------
  |  |   62|   104M|#define pni_head(PTR) \
  |  |   63|   104M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  117|   104M|}
object.c:pni_class_decref:
  152|  62.8M|static inline void pni_class_decref(const pn_class_t *clazz, void *object) {
  153|  62.8M|  if (clazz->decref) {
  ------------------
  |  Branch (153:7): [True: 8.30M, False: 54.5M]
  ------------------
  154|  8.30M|    clazz->decref(object);
  155|  54.5M|  } else {
  156|  54.5M|    pni_default_decref(object);
  157|  54.5M|  }
  158|  62.8M|}
object.c:pni_default_decref:
  120|  54.5M|{
  121|  54.5M|  pni_head_t *head = pni_head(object);
  ------------------
  |  |   62|  54.5M|#define pni_head(PTR) \
  |  |   63|  54.5M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  122|       |  assert(head->refcount > 0);
  123|  54.5M|  head->refcount--;
  124|  54.5M|}
object.c:pni_class_free:
  168|  25.6M|static inline void pni_class_free(const pn_class_t *clazz, void *object) {
  169|  25.6M|  if (clazz->free) {
  ------------------
  |  Branch (169:7): [True: 0, False: 25.6M]
  ------------------
  170|      0|    clazz->free(object);
  171|  25.6M|  } else {
  172|  25.6M|    pni_default_free(object);
  173|  25.6M|  }
  174|  25.6M|}
object.c:pni_default_free:
  127|  25.6M|{
  128|  25.6M|  pni_head_t *head = pni_head(object);
  ------------------
  |  |   62|  25.6M|#define pni_head(PTR) \
  |  |   63|  25.6M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  129|  25.6M|  pni_mem_deallocate(head->clazz, head);
  130|  25.6M|}

pn_record:
   64|  4.64M|{
   65|  4.64M|  static const pn_class_t clazz = PN_CLASS(pn_record);
  ------------------
  |  |   67|  4.64M|#define PN_CLASS(PREFIX) {                      \
  |  |   68|  4.64M|    #PREFIX,                                    \
  |  |   69|  4.64M|    CID_ ## PREFIX,                             \
  |  |   70|  4.64M|    NULL,                                       \
  |  |   71|  4.64M|    PREFIX ## _initialize,                      \
  |  |   72|  4.64M|    NULL,                                       \
  |  |   73|  4.64M|    NULL,                                       \
  |  |   74|  4.64M|    NULL,                                       \
  |  |   75|  4.64M|    PREFIX ## _finalize,                        \
  |  |   76|  4.64M|    NULL,                                       \
  |  |   77|  4.64M|    PREFIX ## _hashcode,                        \
  |  |  ------------------
  |  |  |  |   59|  4.64M|#define pn_record_hashcode NULL
  |  |  ------------------
  |  |   78|  4.64M|    PREFIX ## _compare,                         \
  |  |  ------------------
  |  |  |  |   60|  4.64M|#define pn_record_compare NULL
  |  |  ------------------
  |  |   79|  4.64M|    PREFIX ## _inspect                          \
  |  |  ------------------
  |  |  |  |   61|  4.64M|#define pn_record_inspect NULL
  |  |  ------------------
  |  |   80|  4.64M|}
  ------------------
   66|  4.64M|  pn_record_t *record = (pn_record_t *) pn_class_new(&clazz, sizeof(pn_record_t));
   67|  4.64M|  pn_record_def(record, PN_LEGCTX, PN_VOID);
  ------------------
  |  |   54|  4.64M|#define PN_LEGCTX ((pn_handle_t) 0)
  ------------------
   68|  4.64M|  return record;
   69|  4.64M|}
pn_record_def:
   95|  10.9M|{
   96|  10.9M|  assert(record);
   97|  10.9M|  assert(clazz);
   98|       |
   99|  10.9M|  pni_field_t *field = pni_record_find(record, key);
  100|  10.9M|  if (field) {
  ------------------
  |  Branch (100:7): [True: 0, False: 10.9M]
  ------------------
  101|      0|    assert(field->clazz == clazz);
  102|  10.9M|  } else {
  103|  10.9M|    field = pni_record_create(record);
  104|  10.9M|    field->key = key;
  105|  10.9M|    field->clazz = clazz;
  106|  10.9M|  }
  107|  10.9M|}
pn_record_clear:
  145|  6.33M|{
  146|  6.33M|  assert(record);
  147|  12.6M|  for (size_t i = 0; i < record->size; i++) {
  ------------------
  |  Branch (147:22): [True: 6.33M, False: 6.33M]
  ------------------
  148|  6.33M|    pni_field_t *field = &record->fields[i];
  149|  6.33M|    pn_class_decref(field->clazz, field->value);
  150|  6.33M|    field->key = 0;
  151|  6.33M|    field->clazz = NULL;
  152|  6.33M|    field->value = NULL;
  153|  6.33M|  }
  154|  6.33M|  record->size = 0;
  155|  6.33M|  pn_record_def(record, PN_LEGCTX, PN_VOID);
  ------------------
  |  |   54|  6.33M|#define PN_LEGCTX ((pn_handle_t) 0)
  ------------------
  156|  6.33M|}
record.c:pn_record_initialize:
   42|  4.64M|{
   43|  4.64M|  pn_record_t *record = (pn_record_t *) object;
   44|  4.64M|  record->size = 0;
   45|  4.64M|  record->capacity = 0;
   46|       |  record->fields = NULL;
   47|  4.64M|}
record.c:pn_record_finalize:
   50|  4.64M|{
   51|  4.64M|  pn_record_t *record = (pn_record_t *) object;
   52|  9.28M|  for (size_t i = 0; i < record->size; i++) {
  ------------------
  |  Branch (52:22): [True: 4.64M, False: 4.64M]
  ------------------
   53|  4.64M|    pni_field_t *v = &record->fields[i];
   54|  4.64M|    pn_class_decref(v->clazz, v->value);
   55|  4.64M|  }
   56|  4.64M|  pni_mem_subdeallocate(pn_class(record), record, record->fields);
   57|  4.64M|}
record.c:pni_record_find:
   71|  10.9M|static pni_field_t *pni_record_find(pn_record_t *record, pn_handle_t key) {
   72|  10.9M|  for (size_t i = 0; i < record->size; i++) {
  ------------------
  |  Branch (72:22): [True: 0, False: 10.9M]
  ------------------
   73|      0|    pni_field_t *field = &record->fields[i];
   74|      0|    if (field->key == key) {
  ------------------
  |  Branch (74:9): [True: 0, False: 0]
  ------------------
   75|      0|      return field;
   76|      0|    }
   77|      0|  }
   78|  10.9M|  return NULL;
   79|  10.9M|}
record.c:pni_record_create:
   81|  10.9M|static pni_field_t *pni_record_create(pn_record_t *record) {
   82|  10.9M|  record->size++;
   83|  10.9M|  if (record->size > record->capacity) {
  ------------------
  |  Branch (83:7): [True: 4.64M, False: 6.33M]
  ------------------
   84|  4.64M|    record->fields = (pni_field_t *) pni_mem_subreallocate(pn_class(record), record, record->fields, record->size * sizeof(pni_field_t));
   85|  4.64M|    record->capacity = record->size;
   86|  4.64M|  }
   87|  10.9M|  pni_field_t *field = &record->fields[record->size - 1];
   88|  10.9M|  field->key = 0;
   89|  10.9M|  field->clazz = NULL;
   90|       |  field->value = NULL;
   91|  10.9M|  return field;
   92|  10.9M|}

pn_string:
  104|  6.79M|{
  105|  6.79M|  return pn_stringn(bytes, bytes ? strlen(bytes) : 0);
  ------------------
  |  Branch (105:28): [True: 81.5k, False: 6.71M]
  ------------------
  106|  6.79M|}
pn_stringn:
  112|  8.17M|{
  113|  8.17M|  static const pn_class_t clazz = PN_CLASS(pn_string);
  ------------------
  |  |   67|  8.17M|#define PN_CLASS(PREFIX) {                      \
  |  |   68|  8.17M|    #PREFIX,                                    \
  |  |   69|  8.17M|    CID_ ## PREFIX,                             \
  |  |   70|  8.17M|    NULL,                                       \
  |  |   71|  8.17M|    PREFIX ## _initialize,                      \
  |  |  ------------------
  |  |  |  |  108|  8.17M|#define pn_string_initialize NULL
  |  |  ------------------
  |  |   72|  8.17M|    NULL,                                       \
  |  |   73|  8.17M|    NULL,                                       \
  |  |   74|  8.17M|    NULL,                                       \
  |  |   75|  8.17M|    PREFIX ## _finalize,                        \
  |  |   76|  8.17M|    NULL,                                       \
  |  |   77|  8.17M|    PREFIX ## _hashcode,                        \
  |  |   78|  8.17M|    PREFIX ## _compare,                         \
  |  |   79|  8.17M|    PREFIX ## _inspect                          \
  |  |   80|  8.17M|}
  ------------------
  114|  8.17M|  pn_string_t *string = (pn_string_t *) pn_class_new(&clazz, sizeof(pn_string_t));
  115|  8.17M|  if (!string) return NULL;
  ------------------
  |  Branch (115:7): [True: 0, False: 8.17M]
  ------------------
  116|       |
  117|       |  /* Make the object safe to finalize before anything can fail */
  118|  8.17M|  string->bytes = NULL;
  119|  8.17M|  string->capacity = 0;
  120|  8.17M|  string->size = PNI_NULL_SIZE;
  ------------------
  |  |   37|  8.17M|#define PNI_NULL_SIZE (-1)
  ------------------
  121|       |
  122|  8.17M|  if (pn_string_setn(string, bytes, n)) {
  ------------------
  |  Branch (122:7): [True: 0, False: 8.17M]
  ------------------
  123|      0|    pn_free(string);
  124|      0|    return NULL;
  125|      0|  }
  126|  8.17M|  return string;
  127|  8.17M|}
pn_string_get:
  130|   259k|{
  131|   259k|  if (!string || string->size == PNI_NULL_SIZE) {
  ------------------
  |  |   37|   259k|#define PNI_NULL_SIZE (-1)
  ------------------
  |  Branch (131:7): [True: 0, False: 259k]
  |  Branch (131:18): [True: 226k, False: 32.2k]
  ------------------
  132|   226k|    return NULL;
  133|   226k|  } else {
  134|  32.2k|    return string->bytes;
  135|  32.2k|  }
  136|   259k|}
pn_string_size:
  139|   103k|{
  140|   103k|  if (!string || string->size == PNI_NULL_SIZE) {
  ------------------
  |  |   37|   103k|#define PNI_NULL_SIZE (-1)
  ------------------
  |  Branch (140:7): [True: 0, False: 103k]
  |  Branch (140:18): [True: 103k, False: 0]
  ------------------
  141|   103k|    return 0;
  142|   103k|  } else {
  143|      0|    return string->size;
  144|      0|  }
  145|   103k|}
pn_string_bytes:
  148|   432k|{
  149|   432k|  if (!string || string->size == PNI_NULL_SIZE) {
  ------------------
  |  |   37|   432k|#define PNI_NULL_SIZE (-1)
  ------------------
  |  Branch (149:7): [True: 0, False: 432k]
  |  Branch (149:18): [True: 128k, False: 303k]
  ------------------
  150|   128k|    return (pn_bytes_t){0, NULL};
  151|   303k|  } else {
  152|   303k|    return (pn_bytes_t){string->size, string->bytes};
  153|   303k|  }
  154|   432k|}
pn_string_set:
  157|   350k|{
  158|   350k|  return pn_string_setn(string, bytes, bytes ? strlen(bytes) : 0);
  ------------------
  |  Branch (158:40): [True: 34.6k, False: 315k]
  ------------------
  159|   350k|}
pn_string_grow:
  162|  9.13M|{
  163|  9.13M|  if (!string) return PN_ARG_ERR;
  ------------------
  |  |   53|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (163:7): [True: 0, False: 9.13M]
  ------------------
  164|       |
  165|       |  /* Reject the request before doing any arithmetic on it. Capping the string
  166|       |   * at INT32_MAX bytes leaves room for the trailing null within uint32_t and
  167|       |   * keeps the (signed) size field from overflowing. */
  168|  9.13M|  if (capacity > INT32_MAX) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      0|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (168:7): [True: 0, False: 9.13M]
  ------------------
  169|       |
  170|       |  // Never allocate less than 16 bytes, to avoid work for small strings.
  171|  9.13M|  uint32_t needed = (uint32_t) pn_max(16, capacity + 1);
  ------------------
  |  |  273|  9.13M|#define pn_max(X,Y) ((X) < (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (273:22): [True: 90.9k, False: 9.04M]
  |  |  ------------------
  ------------------
  172|  9.13M|  if (needed <= string->capacity) return 0;
  ------------------
  |  Branch (172:7): [True: 921k, False: 8.21M]
  ------------------
  173|       |
  174|  8.21M|  uint32_t new_capacity = pni_round_up_pow2(needed);
  175|       |
  176|  8.21M|  char *growed = (char *) pni_mem_subreallocate(pn_class(string), string, string->bytes, new_capacity);
  177|  8.21M|  if (!growed) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   57|      0|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (177:7): [True: 0, False: 8.21M]
  ------------------
  178|       |
  179|  8.21M|  string->bytes = growed;
  180|  8.21M|  string->capacity = new_capacity;
  181|       |
  182|  8.21M|  return 0;
  183|  8.21M|}
pn_string_setn:
  186|  9.13M|{
  187|  9.13M|  int err = pn_string_grow(string, n);
  188|  9.13M|  if (err) return err;
  ------------------
  |  Branch (188:7): [True: 0, False: 9.13M]
  ------------------
  189|       |
  190|  9.13M|  if (bytes) {
  ------------------
  |  Branch (190:7): [True: 435k, False: 8.69M]
  ------------------
  191|   435k|    memcpy(string->bytes, bytes, n*sizeof(char));
  192|   435k|    string->bytes[n] = '\0';
  193|   435k|    string->size = n;
  194|  8.69M|  } else {
  195|  8.69M|    string->size = PNI_NULL_SIZE;
  ------------------
  |  |   37|  8.69M|#define PNI_NULL_SIZE (-1)
  ------------------
  196|  8.69M|  }
  197|       |
  198|  9.13M|  return 0;
  199|  9.13M|}
pn_string_clear:
  215|   281k|{
  216|       |  pn_string_set(string, NULL);
  217|   281k|}
string.c:pn_string_finalize:
   46|  8.17M|{
   47|  8.17M|  pn_string_t *string = (pn_string_t *) object;
   48|  8.17M|  pni_mem_subdeallocate(pn_class(string), string, string->bytes);
   49|  8.17M|}

pn_delivery_map_init:
   81|  2.59M|{
   82|  2.59M|  db->deliveries = pn_hash(PN_WEAKREF, 0, 0.75);
   83|  2.59M|  db->next = next;
   84|  2.59M|}
pn_delivery_map_free:
   87|  2.59M|{
   88|  2.59M|  pn_free(db->deliveries);
   89|  2.59M|}
pn_delivery_map_del:
  119|   239k|{
  120|   239k|  if (delivery->state.init) {
  ------------------
  |  Branch (120:7): [True: 90.5k, False: 148k]
  ------------------
  121|  90.5k|    delivery->state.init = false;
  122|  90.5k|    delivery->state.sending = false;
  123|       |    delivery->state.sent = false;
  124|  90.5k|    pn_hash_del(db->deliveries, pni_sequence_make_hash(delivery->state.id) );
  125|  90.5k|  }
  126|   239k|}
pn_transport:
  550|  34.6k|{
  551|  34.6k|#define pn_transport_free NULL
  552|  34.6k|  static const pn_class_t clazz = PN_METACLASS(pn_transport);
  ------------------
  |  |   82|  34.6k|#define PN_METACLASS(PREFIX) {                  \
  |  |   83|  34.6k|    #PREFIX,                                    \
  |  |   84|  34.6k|    CID_ ## PREFIX,                             \
  |  |   85|  34.6k|    PREFIX ## _new,                             \
  |  |  ------------------
  |  |  |  |  542|  34.6k|#define pn_transport_new NULL
  |  |  ------------------
  |  |   86|  34.6k|    PREFIX ## _initialize,                      \
  |  |   87|  34.6k|    PREFIX ## _incref,                          \
  |  |   88|  34.6k|    PREFIX ## _decref,                          \
  |  |  ------------------
  |  |  |  |  544|  34.6k|#define pn_transport_decref NULL
  |  |  ------------------
  |  |   89|  34.6k|    PREFIX ## _refcount,                        \
  |  |  ------------------
  |  |  |  |  543|  34.6k|#define pn_transport_refcount NULL
  |  |  ------------------
  |  |   90|  34.6k|    PREFIX ## _finalize,                        \
  |  |   91|  34.6k|    PREFIX ## _free,                            \
  |  |  ------------------
  |  |  |  |  551|  34.6k|#define pn_transport_free NULL
  |  |  ------------------
  |  |   92|  34.6k|    PREFIX ## _hashcode,                        \
  |  |  ------------------
  |  |  |  |  545|  34.6k|#define pn_transport_hashcode NULL
  |  |  ------------------
  |  |   93|  34.6k|    PREFIX ## _compare,                         \
  |  |  ------------------
  |  |  |  |  546|  34.6k|#define pn_transport_compare NULL
  |  |  ------------------
  |  |   94|  34.6k|    PREFIX ## _inspect                          \
  |  |  ------------------
  |  |  |  |  547|  34.6k|#define pn_transport_inspect NULL
  |  |  ------------------
  |  |   95|  34.6k|}
  ------------------
  553|  34.6k|#undef pn_transport_free
  554|  34.6k|  pn_transport_t *transport =
  555|  34.6k|    (pn_transport_t *) pn_class_new(&clazz, sizeof(pn_transport_t));
  556|  34.6k|  if (!transport) return NULL;
  ------------------
  |  Branch (556:7): [True: 0, False: 34.6k]
  ------------------
  557|       |
  558|  34.6k|  transport->output_buf = (char *) pni_mem_suballocate(&clazz, transport, transport->output_size);
  559|  34.6k|  if (!transport->output_buf) {
  ------------------
  |  Branch (559:7): [True: 0, False: 34.6k]
  ------------------
  560|      0|    pn_transport_free(transport);
  561|      0|    return NULL;
  562|      0|  }
  563|       |
  564|  34.6k|  transport->input_buf = (char *) pni_mem_suballocate(&clazz, transport, transport->input_size);
  565|  34.6k|  if (!transport->input_buf) {
  ------------------
  |  Branch (565:7): [True: 0, False: 34.6k]
  ------------------
  566|      0|    pn_transport_free(transport);
  567|      0|    return NULL;
  568|      0|  }
  569|       |
  570|  34.6k|  transport->output_buffer = pn_buffer(4*1024);
  571|  34.6k|  if (!transport->output_buffer) {
  ------------------
  |  Branch (571:7): [True: 0, False: 34.6k]
  ------------------
  572|      0|    pn_transport_free(transport);
  573|      0|    return NULL;
  574|      0|  }
  575|       |
  576|  34.6k|  return transport;
  577|  34.6k|}
pn_transport_free:
  628|  34.6k|{
  629|  34.6k|  if (!transport) return;
  ------------------
  |  Branch (629:7): [True: 0, False: 34.6k]
  ------------------
  630|  34.6k|  assert(!transport->freed);
  631|       |  transport->freed = true;
  632|  34.6k|  pn_decref(transport);
  633|  34.6k|}
pn_transport_bind:
  680|  34.6k|{
  681|  34.6k|  assert(transport);
  682|  34.6k|  assert(connection);
  683|       |
  684|  34.6k|  if (transport->connection) return PN_STATE_ERR;
  ------------------
  |  |   52|      0|#define PN_STATE_ERR (-5)      /**< State error */
  ------------------
  |  Branch (684:7): [True: 0, False: 34.6k]
  ------------------
  685|  34.6k|  if (connection->transport) return PN_STATE_ERR;
  ------------------
  |  |   52|      0|#define PN_STATE_ERR (-5)      /**< State error */
  ------------------
  |  Branch (685:7): [True: 0, False: 34.6k]
  ------------------
  686|       |
  687|  34.6k|  transport->connection = connection;
  688|  34.6k|  connection->transport = transport;
  689|       |
  690|  34.6k|  pn_incref(connection);
  691|       |
  692|  34.6k|  pn_connection_bound(connection);
  693|       |
  694|       |  // set the hostname/user/password
  695|  34.6k|  if (pn_string_size(connection->auth_user) || pn_string_size(connection->authzid)) {
  ------------------
  |  Branch (695:7): [True: 0, False: 34.6k]
  |  Branch (695:48): [True: 0, False: 34.6k]
  ------------------
  696|      0|    pn_sasl(transport);
  697|      0|    pni_sasl_set_user_password(transport,
  698|      0|                               pn_string_get(connection->auth_user),
  699|      0|                               pn_string_get(connection->authzid),
  700|      0|                               pn_string_get(connection->auth_password));
  701|      0|  }
  702|       |
  703|  34.6k|  if (pn_string_size(connection->hostname)) {
  ------------------
  |  Branch (703:7): [True: 0, False: 34.6k]
  ------------------
  704|      0|      if (transport->sasl) {
  ------------------
  |  Branch (704:11): [True: 0, False: 0]
  ------------------
  705|      0|          pni_sasl_set_remote_hostname(transport, pn_string_get(connection->hostname));
  706|      0|      }
  707|       |
  708|       |      // be sure not to overwrite a hostname already set by the user via
  709|       |      // pn_ssl_set_peer_hostname() called before the bind
  710|      0|      if (transport->ssl) {
  ------------------
  |  Branch (710:11): [True: 0, False: 0]
  ------------------
  711|      0|          size_t name_len = 0;
  712|      0|          pn_ssl_get_peer_hostname((pn_ssl_t*) transport, NULL, &name_len);
  713|      0|          if (name_len == 0) {
  ------------------
  |  Branch (713:15): [True: 0, False: 0]
  ------------------
  714|      0|              pn_ssl_set_peer_hostname((pn_ssl_t*) transport, pn_string_get(connection->hostname));
  715|      0|          }
  716|      0|      }
  717|      0|  }
  718|       |
  719|  34.6k|  if (transport->open_rcvd) {
  ------------------
  |  Branch (719:7): [True: 0, False: 34.6k]
  ------------------
  720|      0|    PN_SET_REMOTE(connection->endpoint.state, PN_REMOTE_ACTIVE);
  ------------------
  |  |  427|      0|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|      0|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|      0|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|      0|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  721|      0|    pni_post_remote_open_events(transport, connection);
  722|      0|    transport->halt = false;
  723|      0|    transport_consume(transport);        // blech - testBindAfterOpen
  724|      0|  }
  725|       |
  726|  34.6k|  return 0;
  727|  34.6k|}
pni_transport_unbind_handles:
  730|   224k|{
  731|   286k|  for (pn_handle_t h = pn_hash_head(handles); h; h = pn_hash_next(handles, h)) {
  ------------------
  |  Branch (731:47): [True: 62.2k, False: 224k]
  ------------------
  732|  62.2k|    uintptr_t key = pn_hash_key(handles, h);
  733|  62.2k|    pn_link_t *link = (pn_link_t *) pn_hash_value(handles, h);
  734|  62.2k|    if (reset_state) {
  ------------------
  |  Branch (734:9): [True: 58.7k, False: 3.49k]
  ------------------
  735|  58.7k|      pn_link_unbound(link);
  736|  58.7k|    }
  737|  62.2k|    pn_ep_decref(&link->endpoint);
  738|  62.2k|    pn_hash_del(handles, key);
  739|  62.2k|  }
  740|   224k|}
pni_transport_unbind_channels:
  743|  69.2k|{
  744|   136k|  for (pn_handle_t h = pn_hash_head(channels); h; h = pn_hash_next(channels, h)) {
  ------------------
  |  Branch (744:48): [True: 67.2k, False: 69.2k]
  ------------------
  745|  67.2k|    uintptr_t key = pn_hash_key(channels, h);
  746|  67.2k|    pn_session_t *ssn = (pn_session_t *) pn_hash_value(channels, h);
  747|  67.2k|    pni_delivery_map_clear(&ssn->state.incoming);
  748|  67.2k|    pni_delivery_map_clear(&ssn->state.outgoing);
  749|  67.2k|    pni_transport_unbind_handles(ssn->state.local_handles, true);
  750|       |    pni_transport_unbind_handles(ssn->state.remote_handles, true);
  751|  67.2k|    pn_session_unbound(ssn);
  752|  67.2k|    pn_ep_decref(&ssn->endpoint);
  753|  67.2k|    pn_hash_del(channels, key);
  754|  67.2k|  }
  755|  69.2k|}
pn_transport_unbind:
  758|  69.2k|{
  759|  69.2k|  assert(transport);
  760|  69.2k|  if (!transport->connection) return 0;
  ------------------
  |  Branch (760:7): [True: 34.6k, False: 34.6k]
  ------------------
  761|       |
  762|       |
  763|  34.6k|  pn_connection_t *conn = transport->connection;
  764|  34.6k|  transport->connection = NULL;
  765|  34.6k|  bool was_referenced = transport->referenced;
  766|       |
  767|  34.6k|  pn_collector_put_object(conn->collector, conn, PN_CONNECTION_UNBOUND);
  768|       |
  769|       |  // XXX: what happens if the endpoints are freed before we get here?
  770|  34.6k|  pn_session_t *ssn = pn_session_head(conn, 0);
  771|  1.33M|  while (ssn) {
  ------------------
  |  Branch (771:10): [True: 1.29M, False: 34.6k]
  ------------------
  772|  1.29M|    pni_delivery_map_clear(&ssn->state.incoming);
  773|  1.29M|    pni_delivery_map_clear(&ssn->state.outgoing);
  774|  1.29M|    ssn = pn_session_next(ssn, 0);
  775|  1.29M|  }
  776|       |
  777|  34.6k|  pn_endpoint_t *endpoint = conn->endpoint_head;
  778|  2.78M|  while (endpoint) {
  ------------------
  |  Branch (778:10): [True: 2.74M, False: 34.6k]
  ------------------
  779|  2.74M|    pn_condition_clear(&endpoint->remote_condition);
  780|  2.74M|    pn_modified(conn, endpoint, true);
  781|  2.74M|    endpoint = endpoint->endpoint_next;
  782|  2.74M|  }
  783|       |
  784|  34.6k|  pni_transport_unbind_channels(transport->local_channels);
  785|  34.6k|  pni_transport_unbind_channels(transport->remote_channels);
  786|       |
  787|  34.6k|  pn_connection_unbound(conn);
  788|  34.6k|  if (was_referenced) {
  ------------------
  |  Branch (788:7): [True: 34.6k, False: 0]
  ------------------
  789|  34.6k|    pn_decref(conn);
  790|  34.6k|  }
  791|  34.6k|  return 0;
  792|  69.2k|}
pn_transport_condition:
  808|  8.60k|{
  809|       |  assert(transport);
  810|  8.60k|  return &transport->condition;
  811|  8.60k|}
pni_disposition_batchable:
  843|  5.54k|{
  844|  5.54k|  switch (disposition->type) {
  845|  5.54k|  case PN_ACCEPTED:
  ------------------
  |  |   66|  5.54k|#define PN_ACCEPTED (0x0000000000000024)
  ------------------
  |  Branch (845:3): [True: 5.54k, False: 0]
  ------------------
  846|  5.54k|    return true;
  847|      0|  case PN_RELEASED:
  ------------------
  |  |   82|      0|#define PN_RELEASED (0x0000000000000026)
  ------------------
  |  Branch (847:3): [True: 0, False: 5.54k]
  ------------------
  848|      0|    return true;
  849|      0|  default:
  ------------------
  |  Branch (849:3): [True: 0, False: 5.54k]
  ------------------
  850|       |    return false;
  851|  5.54k|  }
  852|  5.54k|}
pn_do_error:
  981|  23.4k|{
  982|  23.4k|  va_list ap;
  983|  23.4k|  va_start(ap, fmt);
  984|  23.4k|  char buf[1024];
  985|  23.4k|  if (fmt) {
  ------------------
  |  Branch (985:7): [True: 23.4k, False: 0]
  ------------------
  986|       |    // XXX: result
  987|  23.4k|    vsnprintf(buf, 1024, fmt, ap);
  988|  23.4k|  } else {
  989|      0|    buf[0] = '\0';
  990|      0|  }
  991|  23.4k|  va_end(ap);
  992|  23.4k|  pn_condition_t *cond = &transport->condition;
  993|  23.4k|  if (!pn_condition_is_set(cond)) {
  ------------------
  |  Branch (993:7): [True: 23.4k, False: 0]
  ------------------
  994|  23.4k|    pn_condition_set_name(cond, condition);
  995|  23.4k|    if (fmt) {
  ------------------
  |  Branch (995:9): [True: 23.4k, False: 0]
  ------------------
  996|  23.4k|      pn_condition_set_description(cond, buf);
  997|  23.4k|    }
  998|  23.4k|  } else {
  999|      0|    const char *first = pn_condition_get_description(cond);
 1000|      0|    if (first && fmt) {
  ------------------
  |  Branch (1000:9): [True: 0, False: 0]
  |  Branch (1000:18): [True: 0, False: 0]
  ------------------
 1001|      0|      char extended[2048];
 1002|      0|      snprintf(extended, 2048, "%s (%s)", first, buf);
 1003|      0|      pn_condition_set_description(cond, extended);
 1004|      0|    } else if (fmt) {
  ------------------
  |  Branch (1004:16): [True: 0, False: 0]
  ------------------
 1005|      0|      pn_condition_set_description(cond, buf);
 1006|      0|    }
 1007|      0|  }
 1008|  23.4k|  pn_collector_t *collector = pni_transport_collector(transport);
 1009|  23.4k|  pn_collector_put_object(collector, transport, PN_TRANSPORT_ERROR);
 1010|       |  // Special case being called with no condition and no fmt to log the existing error condition
 1011|  23.4k|  if (fmt && condition) {
  ------------------
  |  Branch (1011:7): [True: 23.4k, False: 0]
  |  Branch (1011:14): [True: 23.4k, False: 0]
  ------------------
 1012|  23.4k|    PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "%s %s", condition, buf);
  ------------------
  |  |   57|  23.4k|    do { \
  |  |   58|  23.4k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   54|  23.4k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:6): [Folded, False: 23.4k]
  |  |  |  |  |  Branch (54:38): [True: 23.4k, False: 0]
  |  |  |  |  |  Branch (54:73): [True: 0, False: 23.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|  23.4k|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   60|  23.4k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (60:13): [Folded, False: 23.4k]
  |  |  ------------------
  ------------------
 1013|  23.4k|  } else {
 1014|      0|    PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "%s %s",
  ------------------
  |  |   57|      0|    do { \
  |  |   58|      0|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   54|      0|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:6): [Folded, False: 0]
  |  |  |  |  |  Branch (54:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (54:73): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|      0|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   60|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (60:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1015|      0|           pn_condition_get_name(cond), pn_condition_get_description(cond));
 1016|      0|  }
 1017|       |
 1018|  93.8k|  for (int i = 0; i<PN_IO_LAYER_CT; ++i) {
  ------------------
  |  |  156|  93.8k|#define PN_IO_LAYER_CT 3
  ------------------
  |  Branch (1018:19): [True: 70.3k, False: 23.4k]
  ------------------
 1019|  70.3k|    if (transport->io_layers[i] && transport->io_layers[i]->handle_error)
  ------------------
  |  Branch (1019:9): [True: 23.4k, False: 46.9k]
  |  Branch (1019:36): [True: 23.4k, False: 0]
  ------------------
 1020|  23.4k|        transport->io_layers[i]->handle_error(transport, i);
 1021|  70.3k|  }
 1022|       |
 1023|  23.4k|  pni_close_tail(transport);
 1024|  23.4k|  return PN_ERR;
  ------------------
  |  |   49|  23.4k|#define PN_ERR (-2)            /**< General error */
  ------------------
 1025|  23.4k|}
pn_do_open:
 1033|   272k|{
 1034|   272k|  bool container_q, hostname_q, remote_channel_max_q, remote_max_frame_q;
 1035|   272k|  uint16_t remote_channel_max;
 1036|   272k|  uint32_t remote_max_frame;
 1037|   272k|  pn_bytes_t remote_container, remote_hostname;
 1038|   272k|  pn_bytes_t remote_offered_capabilities;
 1039|   272k|  pn_bytes_t remote_desired_capabilities;
 1040|   272k|  pn_bytes_t remote_properties;
 1041|       |
 1042|   272k|  pn_amqp_decode_open(payload,
 1043|   272k|                                    &container_q, &remote_container,
 1044|   272k|                                    &hostname_q, &remote_hostname,
 1045|   272k|                                    &remote_max_frame_q, &remote_max_frame,
 1046|   272k|                                    &remote_channel_max_q, &remote_channel_max,
 1047|   272k|                                    &transport->remote_idle_timeout,
 1048|   272k|                                    &remote_offered_capabilities,
 1049|   272k|                                    &remote_desired_capabilities,
 1050|   272k|                                    &remote_properties);
 1051|       |  /*
 1052|       |   * The default value is already stored in the variable.
 1053|       |   * But the scanner zeroes out values if it does not
 1054|       |   * find them in the args, so don't give the variable
 1055|       |   * directly to the scanner.
 1056|       |   */
 1057|   272k|  transport->remote_channel_max = remote_channel_max_q ? remote_channel_max : AMQP_OPEN_CHANNEL_MAX_DEFAULT;
  ------------------
  |  |   13|   542k|#define AMQP_OPEN_CHANNEL_MAX_DEFAULT (65535) /* ushort */
  ------------------
  |  Branch (1057:35): [True: 1.97k, False: 270k]
  ------------------
 1058|   272k|  transport->remote_max_frame = remote_max_frame_q ? remote_max_frame : AMQP_OPEN_MAX_FRAME_SIZE_DEFAULT;
  ------------------
  |  |   11|   537k|#define AMQP_OPEN_MAX_FRAME_SIZE_DEFAULT (4294967295) /* uint */
  ------------------
  |  Branch (1058:33): [True: 6.59k, False: 265k]
  ------------------
 1059|       |
 1060|   272k|  if (transport->remote_max_frame > 0) {
  ------------------
  |  Branch (1060:7): [True: 268k, False: 4.01k]
  ------------------
 1061|   268k|    if (transport->remote_max_frame < AMQP_MIN_MAX_FRAME_SIZE) {
  ------------------
  |  |   34|   268k|#define AMQP_MIN_MAX_FRAME_SIZE ((uint32_t)512) // minimum allowable max-frame
  ------------------
  |  Branch (1061:9): [True: 2.41k, False: 265k]
  ------------------
 1062|  2.41k|      pn_logger_logf(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_WARNING,
 1063|  2.41k|                     "Peer advertised bad max-frame (%u), forcing to %u",
 1064|  2.41k|                     transport->remote_max_frame, AMQP_MIN_MAX_FRAME_SIZE);
  ------------------
  |  |   34|  2.41k|#define AMQP_MIN_MAX_FRAME_SIZE ((uint32_t)512) // minimum allowable max-frame
  ------------------
 1065|  2.41k|      transport->remote_max_frame = AMQP_MIN_MAX_FRAME_SIZE;
  ------------------
  |  |   34|  2.41k|#define AMQP_MIN_MAX_FRAME_SIZE ((uint32_t)512) // minimum allowable max-frame
  ------------------
 1066|  2.41k|    }
 1067|   268k|  }
 1068|   272k|  pni_mem_deallocate(PN_CLASSCLASS(pn_strdup), transport->remote_container);
  ------------------
  |  |  102|   272k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
 1069|   272k|  transport->remote_container = container_q ? pn_bytes_strdup(remote_container) : NULL;
  ------------------
  |  Branch (1069:33): [True: 2.05k, False: 270k]
  ------------------
 1070|   272k|  pni_mem_deallocate(PN_CLASSCLASS(pn_strdup), transport->remote_hostname);
  ------------------
  |  |  102|   272k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
 1071|   272k|  transport->remote_hostname = hostname_q ? pn_bytes_strdup(remote_hostname) : NULL;
  ------------------
  |  Branch (1071:32): [True: 3.92k, False: 268k]
  ------------------
 1072|       |
 1073|   272k|  pn_bytes_free(transport->remote_offered_capabilities_raw);
 1074|   272k|  transport->remote_offered_capabilities_raw = pn_bytes_dup(remote_offered_capabilities);
 1075|   272k|  pn_bytes_free(transport->remote_desired_capabilities_raw);
 1076|   272k|  transport->remote_desired_capabilities_raw = pn_bytes_dup(remote_desired_capabilities);
 1077|   272k|  pn_bytes_free(transport->remote_properties_raw);
 1078|   272k|  transport->remote_properties_raw = pn_bytes_dup(remote_properties);
 1079|       |
 1080|   272k|  pn_connection_t *conn = transport->connection;
 1081|   272k|  if (conn) {
  ------------------
  |  Branch (1081:7): [True: 272k, False: 0]
  ------------------
 1082|   272k|    PN_SET_REMOTE(conn->endpoint.state, PN_REMOTE_ACTIVE);
  ------------------
  |  |  427|   272k|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|   272k|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   272k|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   272k|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|   272k|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1083|   272k|    pni_post_remote_open_events(transport, conn);
 1084|   272k|  } else {
 1085|      0|    transport->halt = true;
 1086|      0|  }
 1087|       |  transport->open_rcvd = true;
 1088|   272k|  pni_calculate_channel_max(transport);
 1089|   272k|  return 0;
 1090|   272k|}
pn_do_begin:
 1093|  1.28M|{
 1094|  1.28M|  bool reply;
 1095|  1.28M|  uint16_t remote_channel;
 1096|  1.28M|  pn_sequence_t next;
 1097|  1.28M|  uint32_t incoming_window;
 1098|  1.28M|  uint32_t outgoing_window;
 1099|  1.28M|  bool handle_max_q;
 1100|  1.28M|  uint32_t handle_max;
 1101|       |
 1102|  1.28M|  pn_amqp_decode_begin(payload, &reply, &remote_channel, &next, &incoming_window, &outgoing_window, &handle_max_q, &handle_max);
 1103|       |
 1104|       |  // AMQP 1.0 section 2.7.1 - if the peer doesn't honor our channel_max --
 1105|       |  // express our displeasure by closing the connection with a framing error.
 1106|  1.28M|  if (channel > transport->channel_max) {
  ------------------
  |  Branch (1106:7): [True: 32, False: 1.28M]
  ------------------
 1107|     32|    pn_do_error(transport,
 1108|     32|                "amqp:connection:framing-error",
 1109|     32|                "remote channel %u is above negotiated channel_max %u.",
 1110|     32|                channel,
 1111|     32|                transport->channel_max
 1112|     32|               );
 1113|     32|    return PN_ARG_ERR;
  ------------------
  |  |   53|     32|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
 1114|     32|  }
 1115|       |
 1116|  1.28M|  pn_session_t *ssn;
 1117|  1.28M|  if (reply) {
  ------------------
  |  Branch (1117:7): [True: 17.0k, False: 1.26M]
  ------------------
 1118|  17.0k|    ssn = (pn_session_t *) pn_hash_get(transport->local_channels, remote_channel);
 1119|  17.0k|    if (ssn == 0) {
  ------------------
  |  Branch (1119:9): [True: 4, False: 17.0k]
  ------------------
 1120|      4|      pn_do_error(transport,
 1121|      4|                "amqp:invalid-field",
 1122|      4|                "begin reply to unknown channel %u.",
 1123|      4|                remote_channel
 1124|      4|               );
 1125|      4|      return PN_ARG_ERR;
  ------------------
  |  |   53|      4|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
 1126|      4|    }
 1127|  1.26M|  } else {
 1128|  1.26M|    ssn = pn_session(transport->connection);
 1129|  1.26M|  }
 1130|  1.28M|  ssn->state.remote_incoming_window = incoming_window;
 1131|  1.28M|  ssn->state.incoming_transfer_count = next;
 1132|  1.28M|  if (handle_max_q) {
  ------------------
  |  Branch (1132:7): [True: 1.29k, False: 1.28M]
  ------------------
 1133|  1.29k|    ssn->state.remote_handle_max = handle_max;
 1134|  1.29k|  }
 1135|  1.28M|  pni_map_remote_channel(ssn, channel);
 1136|  1.28M|  PN_SET_REMOTE(ssn->endpoint.state, PN_REMOTE_ACTIVE);
  ------------------
  |  |  427|  1.28M|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|  1.28M|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  1.28M|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.28M|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.28M|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1137|  1.28M|  pn_collector_put_object(transport->connection->collector, ssn, PN_SESSION_REMOTE_OPEN);
 1138|  1.28M|  return 0;
 1139|  1.28M|}
pn_terminus_set_address_bytes:
 1203|  57.3k|{
 1204|       |  assert(terminus);
 1205|  57.3k|  return pn_string_setn(terminus->address, address.start, address.size);
 1206|  57.3k|}
pn_do_attach:
 1209|  1.38M|{
 1210|  1.38M|  pn_bytes_t name;
 1211|  1.38M|  uint32_t handle;
 1212|  1.38M|  bool is_sender;
 1213|  1.38M|  pn_bytes_t source, target;
 1214|  1.38M|  pn_durability_t src_dr, tgt_dr;
 1215|  1.38M|  pn_bytes_t src_exp, tgt_exp;
 1216|  1.38M|  pn_seconds_t src_timeout, tgt_timeout;
 1217|  1.38M|  bool src_dynamic, tgt_dynamic;
 1218|  1.38M|  pn_sequence_t idc;
 1219|  1.38M|  pn_bytes_t dist_mode;
 1220|  1.38M|  bool snd_settle, rcv_settle;
 1221|  1.38M|  uint8_t snd_settle_mode, rcv_settle_mode;
 1222|  1.38M|  uint64_t max_msgsz;
 1223|  1.38M|  bool has_props;
 1224|  1.38M|  pn_bytes_t rem_props = (pn_bytes_t){0, NULL};
 1225|  1.38M|  pn_amqp_decode_attach(payload,
 1226|  1.38M|                                                         &name, &handle,
 1227|  1.38M|                                                         &is_sender,
 1228|  1.38M|                                                         &snd_settle, &snd_settle_mode,
 1229|  1.38M|                                                         &rcv_settle, &rcv_settle_mode,
 1230|  1.38M|                                                         &source, &src_dr, &src_exp, &src_timeout, &src_dynamic, &dist_mode,
 1231|  1.38M|                                                         &target, &tgt_dr, &tgt_exp, &tgt_timeout, &tgt_dynamic,
 1232|  1.38M|                                                         &idc, &max_msgsz, &has_props, &rem_props);
 1233|  1.38M|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1234|  1.38M|  if (!ssn) {
  ------------------
  |  Branch (1234:7): [True: 1.28k, False: 1.38M]
  ------------------
 1235|  1.28k|    pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1236|  1.28k|    return PN_EOS;
  ------------------
  |  |   48|  1.28k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 1237|  1.28k|  }
 1238|  1.38M|  if (handle > ssn->local_handle_max) {
  ------------------
  |  Branch (1238:7): [True: 45, False: 1.38M]
  ------------------
 1239|     45|    pn_do_error(transport, "amqp:connection:framing-error",
 1240|     45|                "remote handle %u is above handle_max %u", handle, ssn->local_handle_max);
 1241|     45|    return PN_EOS;
  ------------------
  |  |   48|     45|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 1242|     45|  }
 1243|  1.38M|  pn_link_t *link = pni_find_link(ssn, name, is_sender);
 1244|  1.38M|  if (link && (int32_t)link->state.remote_handle >= 0) {
  ------------------
  |  Branch (1244:7): [True: 580, False: 1.38M]
  |  Branch (1244:15): [True: 541, False: 39]
  ------------------
 1245|    541|    pn_do_error(transport, "amqp:invalid-field", "link name already attached: %.*s", (int)name.size, name.start);
 1246|    541|    return PN_EOS;
  ------------------
  |  |   48|    541|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 1247|    541|  }
 1248|  1.38M|  if (!link) {                  /* Make a new link for the attach */
  ------------------
  |  Branch (1248:7): [True: 1.38M, False: 39]
  ------------------
 1249|  1.38M|    if (is_sender) {
  ------------------
  |  Branch (1249:9): [True: 259k, False: 1.12M]
  ------------------
 1250|   259k|      link = (pn_link_t *) pn_link_new(SENDER, ssn, pn_stringn(name.start, name.size));
 1251|  1.12M|    } else {
 1252|  1.12M|      link = (pn_link_t *) pn_link_new(RECEIVER, ssn, pn_stringn(name.start, name.size));
 1253|  1.12M|    }
 1254|  1.38M|  }
 1255|       |
 1256|  1.38M|  if (has_props) {
  ------------------
  |  Branch (1256:7): [True: 10.7k, False: 1.36M]
  ------------------
 1257|  10.7k|    pn_bytes_free(link->remote_properties_raw);
 1258|  10.7k|    link->remote_properties_raw = pn_bytes_dup(rem_props);
 1259|  10.7k|  }
 1260|       |
 1261|  1.38M|  pni_map_remote_handle(link, handle);
 1262|  1.38M|  PN_SET_REMOTE(link->endpoint.state, PN_REMOTE_ACTIVE);
  ------------------
  |  |  427|  1.38M|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|  1.38M|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  1.38M|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.38M|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.38M|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1263|  1.38M|  pn_terminus_t *rsrc = &link->remote_source;
 1264|  1.38M|  if (source.start || src_dynamic) {
  ------------------
  |  Branch (1264:7): [True: 6.75k, False: 1.37M]
  |  Branch (1264:23): [True: 46.0k, False: 1.32M]
  ------------------
 1265|  52.7k|    pn_terminus_set_type(rsrc, PN_SOURCE);
 1266|  52.7k|    pn_terminus_set_address_bytes(rsrc, source);
 1267|  52.7k|    pn_terminus_set_durability(rsrc, src_dr);
 1268|  52.7k|    set_expiry_policy_from_symbol(rsrc, src_exp);
 1269|  52.7k|    pn_terminus_set_timeout(rsrc, src_timeout);
 1270|  52.7k|    pn_terminus_set_dynamic(rsrc, src_dynamic);
 1271|  52.7k|    pn_terminus_set_distribution_mode(rsrc, symbol2dist_mode(dist_mode));
 1272|  1.32M|  } else {
 1273|  1.32M|    pn_terminus_set_type(rsrc, PN_UNSPECIFIED);
 1274|  1.32M|  }
 1275|  1.38M|  pn_terminus_t *rtgt = &link->remote_target;
 1276|  1.38M|  if (target.start || tgt_dynamic) {
  ------------------
  |  Branch (1276:7): [True: 1.00k, False: 1.37M]
  |  Branch (1276:23): [True: 3.53k, False: 1.37M]
  ------------------
 1277|  4.53k|    pn_terminus_set_type(rtgt, PN_TARGET);
 1278|  4.53k|    pn_terminus_set_address_bytes(rtgt, target);
 1279|  4.53k|    pn_terminus_set_durability(rtgt, tgt_dr);
 1280|  4.53k|    set_expiry_policy_from_symbol(rtgt, tgt_exp);
 1281|  4.53k|    pn_terminus_set_timeout(rtgt, tgt_timeout);
 1282|  4.53k|    pn_terminus_set_dynamic(rtgt, tgt_dynamic);
 1283|  1.37M|  } else {
 1284|  1.37M|    uint64_t code = 0;
 1285|  1.37M|    pn_amqp_decode_attach_target_type(payload, &code);
 1286|  1.37M|    if (code == AMQP_DESC_COORDINATOR) {
  ------------------
  |  |  191|  1.37M|#define AMQP_DESC_COORDINATOR ((uint64_t) 48)
  ------------------
  |  Branch (1286:9): [True: 156k, False: 1.21M]
  ------------------
 1287|   156k|      pn_terminus_set_type(rtgt, PN_COORDINATOR);
 1288|  1.21M|    } else if (code == AMQP_DESC_TARGET) {
  ------------------
  |  |  181|  1.21M|#define AMQP_DESC_TARGET ((uint64_t) 41)
  ------------------
  |  Branch (1288:16): [True: 682, False: 1.21M]
  ------------------
 1289|    682|      pn_terminus_set_type(rtgt, PN_TARGET);
 1290|  1.21M|    } else {
 1291|  1.21M|      pn_terminus_set_type(rtgt, PN_UNSPECIFIED);
 1292|  1.21M|    }
 1293|  1.37M|  }
 1294|       |
 1295|  1.38M|  if (snd_settle)
  ------------------
  |  Branch (1295:7): [True: 18.6k, False: 1.36M]
  ------------------
 1296|  18.6k|    link->remote_snd_settle_mode = snd_settle_mode;
 1297|  1.38M|  if (rcv_settle)
  ------------------
  |  Branch (1297:7): [True: 16.1k, False: 1.36M]
  ------------------
 1298|  16.1k|    link->remote_rcv_settle_mode = rcv_settle_mode;
 1299|       |
 1300|  1.38M|  pn_bytes_t rem_src_properties = (pn_bytes_t) {0, NULL};
 1301|  1.38M|  pn_bytes_t rem_src_filter = (pn_bytes_t) {0, NULL};
 1302|  1.38M|  pn_bytes_t rem_src_outcomes = (pn_bytes_t) {0, NULL};
 1303|  1.38M|  pn_bytes_t rem_src_capabilities = (pn_bytes_t) {0, NULL};
 1304|  1.38M|  pn_amqp_decode_attach_source_props(payload,
 1305|  1.38M|                                          &rem_src_properties,
 1306|  1.38M|                                          &rem_src_filter,
 1307|  1.38M|                                          &rem_src_outcomes,
 1308|  1.38M|                                          &rem_src_capabilities);
 1309|       |
 1310|  1.38M|  pn_bytes_free(rsrc->properties_raw);
 1311|  1.38M|  rsrc->properties_raw = pn_bytes_dup(rem_src_properties);
 1312|  1.38M|  pn_bytes_free(rsrc->filter_raw);
 1313|  1.38M|  rsrc->filter_raw = pn_bytes_dup(rem_src_filter);
 1314|  1.38M|  pn_bytes_free(rsrc->outcomes_raw);
 1315|  1.38M|  rsrc->outcomes_raw = pn_bytes_dup(rem_src_outcomes);
 1316|  1.38M|  pn_bytes_free(rsrc->capabilities_raw);
 1317|  1.38M|  rsrc->capabilities_raw = pn_bytes_dup(rem_src_capabilities);
 1318|       |
 1319|  1.38M|  pn_bytes_t rem_tgt_properties = (pn_bytes_t) {0, NULL};
 1320|  1.38M|  pn_bytes_t rem_tgt_capabilities = (pn_bytes_t) {0, NULL};
 1321|  1.38M|  if (pn_terminus_get_type(&link->remote_target) == PN_COORDINATOR) {
  ------------------
  |  Branch (1321:7): [True: 156k, False: 1.22M]
  ------------------
 1322|       |    // coordinator target only has a capabilities field
 1323|   156k|    pn_amqp_decode_attach_coordinator_caps(payload,
 1324|   156k|                                        &rem_tgt_capabilities);
 1325|  1.22M|  } else {
 1326|  1.22M|    pn_amqp_decode_attach_target_props(payload,
 1327|  1.22M|                                           &rem_tgt_properties,
 1328|  1.22M|                                           &rem_tgt_capabilities);
 1329|  1.22M|  }
 1330|       |
 1331|  1.38M|  pn_bytes_free(rtgt->properties_raw);
 1332|  1.38M|  rtgt->properties_raw = pn_bytes_dup(rem_tgt_properties);
 1333|  1.38M|  pn_bytes_free(rtgt->capabilities_raw);
 1334|  1.38M|  rtgt->capabilities_raw = pn_bytes_dup(rem_tgt_capabilities);
 1335|       |
 1336|  1.38M|  if (!is_sender) {
  ------------------
  |  Branch (1336:7): [True: 1.12M, False: 259k]
  ------------------
 1337|  1.12M|    link->state.delivery_count = idc;
 1338|  1.12M|  }
 1339|       |
 1340|  1.38M|  if (max_msgsz) {
  ------------------
  |  Branch (1340:7): [True: 5.17k, False: 1.37M]
  ------------------
 1341|  5.17k|    link->remote_max_message_size = max_msgsz;
 1342|  5.17k|  }
 1343|       |
 1344|  1.38M|  pn_collector_put_object(transport->connection->collector, link, PN_LINK_REMOTE_OPEN);
 1345|  1.38M|  return 0;
 1346|  1.38M|}
pn_do_transfer:
 1384|   153k|{
 1385|       |  // XXX: multi transfer
 1386|   153k|  uint32_t handle;
 1387|   153k|  bool tag_present;
 1388|   153k|  pn_bytes_t tag;
 1389|   153k|  bool id_present;
 1390|   153k|  pn_sequence_t id;
 1391|   153k|  bool format_present;
 1392|   153k|  uint32_t format;
 1393|   153k|  bool settled;
 1394|   153k|  bool more;
 1395|   153k|  bool has_type, settled_set;
 1396|   153k|  bool resume, aborted, batchable;
 1397|   153k|  uint64_t type;
 1398|       |
 1399|   153k|  pn_bytes_t disp_data;
 1400|   153k|  size_t dsize =
 1401|   153k|    pn_amqp_decode_transfer(payload, &handle, &id_present, &id, &tag_present, &tag,
 1402|   153k|                                        &format_present, &format,
 1403|   153k|                                        &settled_set, &settled, &more, &has_type, &type, &disp_data,
 1404|   153k|                                        &resume, &aborted, &batchable);
 1405|   153k|  payload.size -= dsize;
 1406|   153k|  payload.start += dsize;
 1407|       |
 1408|   153k|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1409|   153k|  if (!ssn) {
  ------------------
  |  Branch (1409:7): [True: 575, False: 152k]
  ------------------
 1410|    575|    return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1411|    575|  }
 1412|       |
 1413|   152k|  if (!ssn->state.incoming_window) {
  ------------------
  |  Branch (1413:7): [True: 30, False: 152k]
  ------------------
 1414|     30|    return pn_do_error(transport, "amqp:session:window-violation", "incoming session window exceeded");
 1415|     30|  }
 1416|       |
 1417|   152k|  pn_link_t *link = pni_handle_state(ssn, handle);
 1418|   152k|  if (!link) {
  ------------------
  |  Branch (1418:7): [True: 4, False: 152k]
  ------------------
 1419|      4|    return pn_do_error(transport, "amqp:invalid-field", "no such handle: %u", handle);
 1420|      4|  }
 1421|   152k|  pn_delivery_t *delivery = NULL;
 1422|       |  // link->more_pending is true exactly while a multiframe delivery is still
 1423|       |  // assembling on this link, so any transfer arriving now must continue it.
 1424|   152k|  if (link->more_pending) {
  ------------------
  |  Branch (1424:7): [True: 61.8k, False: 90.5k]
  ------------------
 1425|       |    // A continuation transfer may omit delivery-id, delivery-tag and
 1426|       |    // message-format, but any it carries must match the first transfer.
 1427|  61.8k|    if (id_present && id != link->more_id)
  ------------------
  |  Branch (1427:9): [True: 59.1k, False: 2.66k]
  |  Branch (1427:23): [True: 12, False: 59.1k]
  ------------------
 1428|     12|      return pn_do_error(transport, "amqp:invalid-field", "invalid delivery-id for a continuation transfer");
 1429|  61.8k|    if (tag_present && !pn_bytes_equal(tag, link->more_tag))
  ------------------
  |  Branch (1429:9): [True: 57.6k, False: 4.13k]
  |  Branch (1429:24): [True: 36, False: 57.6k]
  ------------------
 1430|     36|      return pn_do_error(transport, "amqp:invalid-field", "invalid delivery-tag for a continuation transfer");
 1431|  61.7k|    if (format_present && format != link->more_format)
  ------------------
  |  Branch (1431:9): [True: 33.6k, False: 28.1k]
  |  Branch (1431:27): [True: 45, False: 33.6k]
  ------------------
 1432|     45|      return pn_do_error(transport, "amqp:invalid-field", "invalid message-format for a continuation transfer");
 1433|  61.7k|    if (link->unsettled_tail && !link->unsettled_tail->done) {
  ------------------
  |  Branch (1433:9): [True: 61.7k, False: 0]
  |  Branch (1433:33): [True: 61.7k, False: 0]
  ------------------
 1434|  61.7k|      delivery = link->unsettled_tail;
 1435|  61.7k|      if (settled_set && !settled && delivery->remote.settled)
  ------------------
  |  Branch (1435:11): [True: 14.4k, False: 47.3k]
  |  Branch (1435:26): [True: 634, False: 13.7k]
  |  Branch (1435:38): [True: 4, False: 630]
  ------------------
 1436|      4|        return pn_do_error(transport, "amqp:invalid-field", "invalid transition from settled to unsettled");
 1437|  61.7k|    } else {
 1438|       |      // Application has already settled the partial delivery.  Delivery is no
 1439|       |      // more: discard the remaining frames, clearing more_pending on the last.
 1440|      0|      if (!more || aborted)
  ------------------
  |  Branch (1440:11): [True: 0, False: 0]
  |  Branch (1440:20): [True: 0, False: 0]
  ------------------
 1441|      0|        pni_link_more_end(link);
 1442|      0|    }
 1443|  90.5k|  } else {
 1444|       |    // First transfer of a new delivery.
 1445|  90.5k|    if (!id_present) {
  ------------------
  |  Branch (1445:9): [True: 26, False: 90.5k]
  ------------------
 1446|     26|      return pn_do_error(transport, "amqp:invalid-field", "delivery-id required on initial delivery transfer");
 1447|     26|    }
 1448|  90.5k|    if (!tag_present) {
  ------------------
  |  Branch (1448:9): [True: 22, False: 90.5k]
  ------------------
 1449|     22|      return pn_do_error(transport, "amqp:invalid-field", "delivery-tag required on initial delivery transfer");
 1450|     22|    }
 1451|  90.5k|    if (!format_present) {
  ------------------
  |  Branch (1451:9): [True: 5, False: 90.5k]
  ------------------
 1452|      5|      return pn_do_error(transport, "amqp:invalid-field", "message-format required on initial delivery transfer");
 1453|      5|    }
 1454|       |
 1455|  90.5k|    pn_delivery_map_t *incoming = &ssn->state.incoming;
 1456|       |
 1457|  90.5k|    if (!ssn->state.incoming_init) {
  ------------------
  |  Branch (1457:9): [True: 5.69k, False: 84.8k]
  ------------------
 1458|  5.69k|      incoming->next = id;
 1459|  5.69k|      ssn->state.incoming_init = true;
 1460|  5.69k|      ssn->incoming_deliveries++;
 1461|  5.69k|    }
 1462|       |
 1463|  90.5k|    delivery = pn_delivery(link, pn_dtag(tag.start, tag.size));
 1464|  90.5k|    pn_delivery_state_t *state = pni_delivery_map_push(incoming, delivery);
 1465|  90.5k|    if (id_present && id != state->id) {
  ------------------
  |  Branch (1465:9): [True: 90.5k, False: 0]
  |  Branch (1465:23): [True: 97, False: 90.4k]
  ------------------
 1466|     97|      return pn_do_error(transport, "amqp:session:invalid-field",
 1467|     97|                         "sequencing error, expected delivery-id %u, got %u",
 1468|     97|                         state->id, id);
 1469|     97|    }
 1470|  90.4k|    if (has_type) {
  ------------------
  |  Branch (1470:9): [True: 631, False: 89.8k]
  ------------------
 1471|    631|      pni_amqp_decode_disposition(type, disp_data, &delivery->remote);
 1472|    631|    }
 1473|  90.4k|    link->state.delivery_count++;
 1474|  90.4k|    link->state.link_credit--;
 1475|  90.4k|    link->queued++;
 1476|  90.4k|  }
 1477|       |
 1478|   152k|  if (delivery) {
  ------------------
  |  Branch (1478:7): [True: 152k, False: 0]
  ------------------
 1479|   152k|    if (transport->max_buffered_delivery_bytes > 0 &&
  ------------------
  |  Branch (1479:9): [True: 152k, False: 0]
  ------------------
 1480|   152k|        transport->buffered_delivery_bytes + payload.size > transport->max_buffered_delivery_bytes) {
  ------------------
  |  Branch (1480:9): [True: 0, False: 152k]
  ------------------
 1481|      0|      return pn_do_error(transport, "amqp:resource-limit-exceeded",
 1482|      0|                         "connection delivery buffer limit exceeded: %zu bytes buffered, limit %zu",
 1483|      0|                         transport->buffered_delivery_bytes, transport->max_buffered_delivery_bytes);
 1484|      0|    }
 1485|   152k|    int err = pn_buffer_append(delivery->bytes, payload.start, payload.size);
 1486|   152k|    if (err) {
  ------------------
  |  Branch (1486:9): [True: 0, False: 152k]
  ------------------
 1487|      0|      return pn_do_error(transport, "amqp:resource-limit-exceeded", "out of memory buffering incoming delivery");
 1488|      0|    }
 1489|   152k|    transport->buffered_delivery_bytes += payload.size;
 1490|   152k|    if (more) {
  ------------------
  |  Branch (1490:9): [True: 76.2k, False: 75.9k]
  ------------------
 1491|  76.2k|      if (!link->more_pending) {
  ------------------
  |  Branch (1491:11): [True: 14.7k, False: 61.5k]
  ------------------
 1492|       |        // First frame of a multi-frame transfer. Remember at link level.
 1493|       |        // Only reachable via the new delivery path, so both fields are present.
 1494|  14.7k|        assert(id_present && tag_present);
 1495|  14.7k|        pni_link_more_begin(link, id, tag, format);
 1496|  14.7k|      }
 1497|  76.2k|    } else {
 1498|       |      // Last frame of the delivery: the link is no longer mid-assembly.
 1499|  75.9k|      pni_link_more_end(link);
 1500|  75.9k|    }
 1501|   152k|    delivery->done = !more;
 1502|       |
 1503|       |    // XXX: need to fill in remote state: delivery->remote.state = ...;
 1504|   152k|    if (settled && !delivery->remote.settled) {
  ------------------
  |  Branch (1504:9): [True: 14.4k, False: 137k]
  |  Branch (1504:20): [True: 1.07k, False: 13.3k]
  ------------------
 1505|  1.07k|      delivery->remote.settled = settled;
 1506|  1.07k|      delivery->updated = true;
 1507|  1.07k|      pn_work_update(transport->connection, delivery);
 1508|  1.07k|    }
 1509|       |
 1510|   152k|    if ((delivery->aborted = aborted)) {
  ------------------
  |  Branch (1510:9): [True: 51, False: 152k]
  ------------------
 1511|     51|      delivery->remote.settled = true;
 1512|     51|      delivery->done = true;
 1513|     51|      delivery->updated = true;
 1514|     51|      pni_link_more_end(link);
 1515|     51|      pn_work_update(transport->connection, delivery);
 1516|     51|    }
 1517|   152k|    pn_collector_put_object(transport->connection->collector, delivery, PN_DELIVERY);
 1518|   152k|  }
 1519|       |
 1520|   152k|  ssn->incoming_bytes += payload.size;
 1521|   152k|  ssn->state.incoming_transfer_count++;
 1522|   152k|  ssn->state.incoming_window--;
 1523|       |
 1524|   152k|  if ((int32_t) link->state.local_handle >= 0 && ssn->state.incoming_window < ssn->incoming_window_lwm) {
  ------------------
  |  Branch (1524:7): [True: 705, False: 151k]
  |  Branch (1524:50): [True: 0, False: 705]
  ------------------
 1525|      0|    if (!ssn->check_flow) {
  ------------------
  |  Branch (1525:9): [True: 0, False: 0]
  ------------------
 1526|      0|      ssn->check_flow = true;
 1527|      0|      pn_modified(ssn->connection, &link->endpoint, false);
 1528|      0|    }
 1529|      0|  }
 1530|       |
 1531|   152k|  return 0;
 1532|   152k|}
pn_do_flow:
 1535|  28.1k|{
 1536|  28.1k|  pn_sequence_t onext, inext, delivery_count;
 1537|  28.1k|  uint32_t iwin, owin, link_credit;
 1538|  28.1k|  uint32_t handle;
 1539|  28.1k|  bool inext_init, handle_init, dcount_init, drain;
 1540|       |
 1541|  28.1k|  pn_amqp_decode_flow(payload, &inext_init, &inext, &iwin,
 1542|  28.1k|                                  &onext, &owin, &handle_init, &handle, &dcount_init,
 1543|  28.1k|                                  &delivery_count, &link_credit, &drain);
 1544|       |
 1545|  28.1k|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1546|  28.1k|  if (!ssn) {
  ------------------
  |  Branch (1546:7): [True: 263, False: 27.8k]
  ------------------
 1547|    263|    return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1548|    263|  }
 1549|       |
 1550|  27.8k|  if (inext_init) {
  ------------------
  |  Branch (1550:7): [True: 9.07k, False: 18.8k]
  ------------------
 1551|  9.07k|    ssn->state.remote_incoming_window = inext + iwin - ssn->state.outgoing_transfer_count;
 1552|  18.8k|  } else {
 1553|  18.8k|    ssn->state.remote_incoming_window = iwin;
 1554|  18.8k|  }
 1555|       |
 1556|  27.8k|  if (handle_init) {
  ------------------
  |  Branch (1556:7): [True: 4.44k, False: 23.4k]
  ------------------
 1557|  4.44k|    pn_link_t *link = pni_handle_state(ssn, handle);
 1558|  4.44k|    if (!link) {
  ------------------
  |  Branch (1558:9): [True: 4, False: 4.44k]
  ------------------
 1559|      4|      return pn_do_error(transport, "amqp:invalid-field", "no such handle: %u", handle);
 1560|      4|    }
 1561|  4.44k|    if (link->endpoint.type == SENDER) {
  ------------------
  |  Branch (1561:9): [True: 2.07k, False: 2.37k]
  ------------------
 1562|  2.07k|      pn_sequence_t receiver_count;
 1563|  2.07k|      if (dcount_init) {
  ------------------
  |  Branch (1563:11): [True: 1.03k, False: 1.04k]
  ------------------
 1564|  1.03k|        receiver_count = delivery_count;
 1565|  1.04k|      } else {
 1566|       |        // our initial delivery count
 1567|  1.04k|        receiver_count = 0;
 1568|  1.04k|      }
 1569|  2.07k|      pn_sequence_t old = link->state.link_credit;
 1570|  2.07k|      link->state.link_credit = receiver_count + link_credit - link->state.delivery_count;
 1571|  2.07k|      link->credit += link->state.link_credit - old;
 1572|  2.07k|      link->drain = drain;
 1573|  2.07k|      pn_delivery_t *delivery = pn_link_current(link);
 1574|  2.07k|      if (delivery) pn_work_update(transport->connection, delivery);
  ------------------
  |  Branch (1574:11): [True: 1.62k, False: 444]
  ------------------
 1575|  2.37k|    } else {
 1576|  2.37k|      pn_sequence_t delta = delivery_count - link->state.delivery_count;
 1577|  2.37k|      if (delta > 0) {
  ------------------
  |  Branch (1577:11): [True: 1.92k, False: 442]
  ------------------
 1578|  1.92k|        link->state.delivery_count += delta;
 1579|  1.92k|        link->state.link_credit -= delta;
 1580|  1.92k|        link->credit -= delta;
 1581|  1.92k|        link->drained += delta;
 1582|  1.92k|      }
 1583|  2.37k|    }
 1584|       |
 1585|  4.44k|    pn_collector_put_object(transport->connection->collector, link, PN_LINK_FLOW);
 1586|  4.44k|  }
 1587|       |
 1588|  27.8k|  return 0;
 1589|  27.8k|}
pn_do_disposition:
 1719|  34.3k|{
 1720|  34.3k|  bool role;
 1721|  34.3k|  pn_sequence_t first, last;
 1722|  34.3k|  bool last_init, settled;
 1723|  34.3k|  pn_bytes_t disp_data;
 1724|  34.3k|  bool type_init;
 1725|  34.3k|  uint64_t type;
 1726|  34.3k|  pn_amqp_decode_disposition(payload, &role, &first, &last_init,
 1727|  34.3k|                            &last, &settled, &type_init, &type, &disp_data);
 1728|  34.3k|  if (!last_init) last = first;
  ------------------
  |  Branch (1728:7): [True: 21.3k, False: 13.0k]
  ------------------
 1729|       |
 1730|  34.3k|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1731|  34.3k|  if (!ssn) {
  ------------------
  |  Branch (1731:7): [True: 128, False: 34.2k]
  ------------------
 1732|    128|    return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1733|    128|  }
 1734|       |
 1735|  34.2k|  if (!sequence_lte(first, last)) {
  ------------------
  |  Branch (1735:7): [True: 33, False: 34.2k]
  ------------------
 1736|     33|    return pn_do_error(transport, "amqp:not allowed", "illegal delivery range: %x-%x", first, last);
 1737|     33|  }
 1738|       |
 1739|  34.2k|  pn_delivery_map_t *deliveries;
 1740|  34.2k|  if (role) {
  ------------------
  |  Branch (1740:7): [True: 792, False: 33.4k]
  ------------------
 1741|    792|    deliveries = &ssn->state.outgoing;
 1742|  33.4k|  } else {
 1743|  33.4k|    deliveries = &ssn->state.incoming;
 1744|  33.4k|  }
 1745|       |
 1746|       |  // Do some validation of received first and last values
 1747|       |  // TODO: We should really also clamp the first value here, but we're not keeping track of the earliest
 1748|       |  // unsettled delivery sequence no
 1749|  34.2k|  last = sequence_lte(last, deliveries->next) ? last : deliveries->next;
  ------------------
  |  Branch (1749:10): [True: 24.2k, False: 10.0k]
  ------------------
 1750|       |
 1751|       |  // If there are fewer deliveries in the session than the range then look at every delivery in the session
 1752|       |  // otherwise look at every delivery_id in the disposition performative
 1753|  34.2k|  pn_hash_t *dh = deliveries->deliveries;
 1754|  34.2k|  if (last-first+1 >= pn_hash_size(dh)) {
  ------------------
  |  Branch (1754:7): [True: 32.0k, False: 2.18k]
  ------------------
 1755|  68.9k|    for (pn_handle_t entry = pn_hash_head(dh); entry!=0 ; entry = pn_hash_next(dh, entry)) {
  ------------------
  |  Branch (1755:48): [True: 36.9k, False: 32.0k]
  ------------------
 1756|  36.9k|      pn_sequence_t key = pn_hash_key(dh, entry);
 1757|  36.9k|      if (sequence_lte(first, key) && sequence_lte(key, last)) {
  ------------------
  |  Branch (1757:11): [True: 36.0k, False: 900]
  |  Branch (1757:39): [True: 35.5k, False: 467]
  ------------------
 1758|  35.5k|        pn_delivery_t *delivery = (pn_delivery_t*) pn_hash_value(dh, entry);
 1759|  35.5k|        pni_do_delivery_disposition(transport, delivery, settled, type_init, type, disp_data);
 1760|  35.5k|      }
 1761|  36.9k|    }
 1762|  32.0k|  } else {
 1763|  4.37k|    for (pn_sequence_t id = first; sequence_lte(id, last); ++id) {
  ------------------
  |  Branch (1763:36): [True: 2.19k, False: 2.18k]
  ------------------
 1764|  2.19k|      pn_delivery_t *delivery = pni_delivery_map_get(deliveries, id);
 1765|  2.19k|      if (delivery) {
  ------------------
  |  Branch (1765:11): [True: 1.79k, False: 396]
  ------------------
 1766|  1.79k|        pni_do_delivery_disposition(transport, delivery, settled, type_init, type, disp_data);
 1767|  1.79k|      }
 1768|  2.19k|    }
 1769|  2.18k|  }
 1770|  34.2k|  return 0;
 1771|  34.2k|}
pn_do_detach:
 1774|   137k|{
 1775|   137k|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1776|   137k|  if (!ssn) {
  ------------------
  |  Branch (1776:7): [True: 3, False: 137k]
  ------------------
 1777|      3|    return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1778|      3|  }
 1779|       |
 1780|   137k|  uint32_t handle;
 1781|   137k|  bool closed;
 1782|       |
 1783|   137k|  pn_bytes_t error_condition;
 1784|   137k|  pn_amqp_decode_detach(payload, &handle, &closed, &error_condition);
 1785|       |
 1786|   137k|  pn_link_t *link = pni_handle_state(ssn, handle);
 1787|   137k|  if (!link) {
  ------------------
  |  Branch (1787:7): [True: 398, False: 137k]
  ------------------
 1788|    398|    return pn_do_error(transport, "amqp:invalid-field", "no such handle: %u", handle);
 1789|    398|  }
 1790|       |
 1791|   137k|  pn_bytes_t cond;
 1792|   137k|  pn_bytes_t desc;
 1793|   137k|  pn_bytes_t info;
 1794|   137k|  pn_amqp_decode_error_condition(error_condition, &cond, &desc, &info);
 1795|   137k|  pn_condition_t* condition = &link->endpoint.remote_condition;
 1796|   137k|  pn_condition_set(condition, cond, desc, info);
 1797|       |
 1798|   137k|  if (closed)
  ------------------
  |  Branch (1798:7): [True: 111k, False: 25.8k]
  ------------------
 1799|   111k|  {
 1800|   111k|    PN_SET_REMOTE(link->endpoint.state, PN_REMOTE_CLOSED);
  ------------------
  |  |  427|   111k|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|   111k|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   111k|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   111k|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|   111k|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1801|   111k|    pn_collector_put_object(transport->connection->collector, link, PN_LINK_REMOTE_CLOSE);
 1802|   111k|  } else {
 1803|  25.8k|    pn_collector_put_object(transport->connection->collector, link, PN_LINK_REMOTE_DETACH);
 1804|  25.8k|  }
 1805|       |
 1806|   137k|  pni_unmap_remote_handle(link);
 1807|   137k|  return 0;
 1808|   137k|}
pn_do_end:
 1811|  89.7k|{
 1812|  89.7k|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1813|  89.7k|  if (!ssn) {
  ------------------
  |  Branch (1813:7): [True: 6, False: 89.7k]
  ------------------
 1814|      6|    return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1815|      6|  }
 1816|       |
 1817|  89.7k|  pn_bytes_t cond;
 1818|  89.7k|  pn_bytes_t desc;
 1819|  89.7k|  pn_bytes_t info;
 1820|  89.7k|  pn_amqp_decode_close(payload, &cond, &desc, &info);
 1821|  89.7k|  pn_condition_t* condition = &ssn->endpoint.remote_condition;
 1822|  89.7k|  pn_condition_set(condition, cond, desc, info);
 1823|  89.7k|  PN_SET_REMOTE(ssn->endpoint.state, PN_REMOTE_CLOSED);
  ------------------
  |  |  427|  89.7k|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|  89.7k|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  89.7k|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  89.7k|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  89.7k|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1824|  89.7k|  pn_collector_put_object(transport->connection->collector, ssn, PN_SESSION_REMOTE_CLOSE);
 1825|  89.7k|  pni_unmap_remote_channel(ssn);
 1826|  89.7k|  return 0;
 1827|  89.7k|}
pn_do_close:
 1830|  9.28k|{
 1831|  9.28k|  pn_connection_t *conn = transport->connection;
 1832|       |
 1833|  9.28k|  pn_bytes_t cond;
 1834|  9.28k|  pn_bytes_t desc;
 1835|  9.28k|  pn_bytes_t info;
 1836|  9.28k|  pn_amqp_decode_close(payload, &cond, &desc, &info);
 1837|  9.28k|  pn_condition_t* condition = &transport->remote_condition;
 1838|  9.28k|  pn_condition_set(condition, cond, desc, info);
 1839|  9.28k|  transport->close_rcvd = true;
 1840|  9.28k|  PN_SET_REMOTE(conn->endpoint.state, PN_REMOTE_CLOSED);
  ------------------
  |  |  427|  9.28k|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|  9.28k|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  9.28k|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  9.28k|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  9.28k|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1841|  9.28k|  pn_collector_put_object(transport->connection->collector, conn, PN_CONNECTION_REMOTE_CLOSE);
 1842|  9.28k|  return 0;
 1843|  9.28k|}
pni_transport_grow_capacity:
 3026|    411|ssize_t pni_transport_grow_capacity(pn_transport_t *transport, size_t n) {
 3027|       |  // can we expand the size of the input buffer?
 3028|    411|  size_t size = pn_max(n, transport->input_size);
  ------------------
  |  |  273|    411|#define pn_max(X,Y) ((X) < (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (273:22): [True: 0, False: 411]
  |  |  ------------------
  ------------------
 3029|    411|  if (transport->local_max_frame) {  // there is a limit to buffer size
  ------------------
  |  Branch (3029:7): [True: 411, False: 0]
  ------------------
 3030|    411|    size = pn_min(size, transport->local_max_frame);
  ------------------
  |  |  272|    411|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (272:22): [True: 0, False: 411]
  |  |  ------------------
  ------------------
 3031|    411|  }
 3032|    411|  if (size > transport->input_size) {
  ------------------
  |  Branch (3032:7): [True: 411, False: 0]
  ------------------
 3033|    411|    char *newbuf = (char *) pni_mem_subreallocate(pn_class(transport), transport, transport->input_buf, size );
 3034|    411|    if (newbuf) {
  ------------------
  |  Branch (3034:9): [True: 411, False: 0]
  ------------------
 3035|    411|      transport->input_buf = newbuf;
 3036|    411|      transport->input_size = size;
 3037|    411|    }
 3038|    411|  }
 3039|    411|  return transport->input_size-transport->input_pending;
 3040|    411|}
pn_transport_capacity:
 3044|  49.9k|{
 3045|  49.9k|  if (transport->tail_closed) return PN_EOS;
  ------------------
  |  |   48|    273|#define PN_EOS (-1)            /**< End of stream */
  ------------------
  |  Branch (3045:7): [True: 273, False: 49.7k]
  ------------------
 3046|       |  //if (pn_error_code(transport->error)) return pn_error_code(transport->error);
 3047|       |
 3048|  49.7k|  ssize_t capacity = transport->input_size - transport->input_pending;
 3049|  49.7k|  if ( capacity<=0 ) {
  ------------------
  |  Branch (3049:8): [True: 411, False: 49.3k]
  ------------------
 3050|    411|    capacity = pni_transport_grow_capacity(transport, 2*transport->input_size);
 3051|    411|  }
 3052|  49.7k|  return capacity;
 3053|  49.9k|}
pn_transport_tail:
 3057|  49.7k|{
 3058|  49.7k|  if (transport && transport->input_pending < transport->input_size) {
  ------------------
  |  Branch (3058:7): [True: 49.7k, False: 0]
  |  Branch (3058:20): [True: 49.7k, False: 0]
  ------------------
 3059|  49.7k|    return &transport->input_buf[transport->input_pending];
 3060|  49.7k|  }
 3061|      0|  return NULL;
 3062|  49.7k|}
pn_transport_process:
 3088|  49.7k|{
 3089|  49.7k|  assert(transport);
 3090|  49.7k|  size = pn_min( size, (transport->input_size - transport->input_pending) );
  ------------------
  |  |  272|  49.7k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (272:22): [True: 0, False: 49.7k]
  |  |  ------------------
  ------------------
 3091|  49.7k|  transport->input_pending += size;
 3092|  49.7k|  transport->bytes_input += size;
 3093|       |
 3094|  49.7k|  ssize_t n = transport_consume( transport );
 3095|  49.7k|  if (n == PN_EOS) {
  ------------------
  |  |   48|  49.7k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
  |  Branch (3095:7): [True: 10.9k, False: 38.7k]
  ------------------
 3096|  10.9k|    pni_close_tail(transport);
 3097|  10.9k|  }
 3098|       |
 3099|  49.7k|  if (n < 0 && n != PN_EOS) return n;
  ------------------
  |  |   48|  10.9k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
  |  Branch (3099:7): [True: 10.9k, False: 38.7k]
  |  Branch (3099:16): [True: 0, False: 10.9k]
  ------------------
 3100|  49.7k|  return 0;
 3101|  49.7k|}
pn_transport_close_tail:
 3105|  23.6k|{
 3106|  23.6k|  pni_close_tail(transport);
 3107|  23.6k|  transport_consume( transport );
 3108|  23.6k|  return 0;
 3109|       |  // XXX: what if not all input processed at this point?  do we care???
 3110|  23.6k|}
pn_transport_pending:
 3114|   297k|{
 3115|       |  assert(transport);
 3116|   297k|  return transport_produce( transport );
 3117|   297k|}
pn_transport_head:
 3120|  73.2k|{
 3121|  73.2k|  if (transport && transport->output_pending) {
  ------------------
  |  Branch (3121:7): [True: 73.2k, False: 0]
  |  Branch (3121:20): [True: 73.2k, False: 0]
  ------------------
 3122|  73.2k|    return transport->output_buf;
 3123|  73.2k|  }
 3124|      0|  return NULL;
 3125|  73.2k|}
pn_transport_pop:
 3148|   144k|{
 3149|   144k|  if (transport) {
  ------------------
  |  Branch (3149:7): [True: 144k, False: 0]
  ------------------
 3150|   144k|    assert( transport->output_pending >= size );
 3151|   144k|    transport->output_pending -= size;
 3152|   144k|    transport->bytes_output += size;
 3153|   144k|    if (transport->output_pending) {
  ------------------
  |  Branch (3153:9): [True: 0, False: 144k]
  ------------------
 3154|       |      // TODO: This could be potentially inefficient if we often pop the output without emptying it
 3155|       |      // TODO: as we rotate the buffer here if we have any bytes left to write.
 3156|      0|      memmove( transport->output_buf,  &transport->output_buf[size],
 3157|      0|               transport->output_pending );
 3158|   144k|    } else {
 3159|       |      // If we emptied the output buffer then see if there's more output pending
 3160|   144k|      pn_transport_pending(transport);
 3161|   144k|    }
 3162|   144k|  }
 3163|   144k|}
pn_transport_close_head:
 3166|  34.2k|{
 3167|  34.2k|  ssize_t pending = pn_transport_pending(transport);
 3168|  34.2k|  pni_close_head(transport);
 3169|  34.2k|  if (pending > 0)
  ------------------
  |  Branch (3169:7): [True: 25.0k, False: 9.24k]
  ------------------
 3170|  25.0k|    pn_transport_pop(transport, pending);
 3171|  34.2k|  return 0;
 3172|  34.2k|}
pn_transport_head_closed:
 3191|  69.2k|bool pn_transport_head_closed(pn_transport_t *transport) { return transport->head_closed; }
pn_transport_tail_closed:
 3193|  69.2k|bool pn_transport_tail_closed(pn_transport_t *transport) { return transport->tail_closed; }
transport.c:pni_sequence_make_hash:
   92|   183k|{
   93|   183k|  return i & 0x00000000FFFFFFFFUL;
   94|   183k|}
transport.c:pn_io_layer_setup:
  234|  34.6k|{
  235|  34.6k|  assert(layer == 0);
  236|       |  // Figure out if we are server or not
  237|  34.6k|  if (transport->server) {
  ------------------
  |  Branch (237:7): [True: 0, False: 34.6k]
  ------------------
  238|      0|      transport->io_layers[layer++] = &pni_autodetect_layer;
  239|      0|      return;
  240|      0|  }
  241|  34.6k|  if (transport->ssl) {
  ------------------
  |  Branch (241:7): [True: 0, False: 34.6k]
  ------------------
  242|      0|    transport->io_layers[layer++] = &ssl_layer;
  243|      0|  }
  244|  34.6k|  if (transport->sasl) {
  ------------------
  |  Branch (244:7): [True: 0, False: 34.6k]
  ------------------
  245|      0|    transport->io_layers[layer++] = &sasl_header_layer;
  246|      0|  }
  247|  34.6k|  transport->io_layers[layer++] = &amqp_header_layer;
  248|  34.6k|}
transport.c:pn_io_layer_output_setup:
  257|  34.6k|{
  258|  34.6k|  pn_io_layer_setup(transport, layer);
  259|  34.6k|  return transport->io_layers[layer]->process_output(transport, layer, bytes, available);
  260|  34.6k|}
transport.c:pn_transport_initialize:
  403|  34.6k|{
  404|  34.6k|  pn_transport_t *transport = (pn_transport_t *)object;
  405|  34.6k|  transport->freed = false;
  406|  34.6k|  transport->output_buf = NULL;
  407|  34.6k|  transport->output_size = PN_TRANSPORT_INITIAL_BUFFER_SIZE;
  ------------------
  |  |  186|  34.6k|  #define PN_TRANSPORT_INITIAL_BUFFER_SIZE (8*1024)
  ------------------
  408|  34.6k|  transport->input_buf = NULL;
  409|  34.6k|  transport->input_size =  PN_TRANSPORT_INITIAL_BUFFER_SIZE;
  ------------------
  |  |  186|  34.6k|  #define PN_TRANSPORT_INITIAL_BUFFER_SIZE (8*1024)
  ------------------
  410|  34.6k|  pni_logger_default_init(&transport->logger);
  411|  34.6k|  transport->tracer = NULL;
  412|  34.6k|  transport->sasl = NULL;
  413|  34.6k|  transport->ssl = NULL;
  414|  34.6k|  transport->scratch_space = pn_rwbytes_alloc(PN_TRANSPORT_INITIAL_FRAME_SIZE);
  ------------------
  |  |   25|  34.6k|# define PN_TRANSPORT_INITIAL_FRAME_SIZE (512) /* bytes */
  ------------------
  415|  34.6k|  transport->input_frames_ct = 0;
  416|  34.6k|  transport->output_frames_ct = 0;
  417|       |
  418|  34.6k|  transport->connection = NULL;
  419|  34.6k|  transport->context = pn_record();
  420|       |
  421|   138k|  for (int layer=0; layer<PN_IO_LAYER_CT; ++layer) {
  ------------------
  |  |  156|   138k|#define PN_IO_LAYER_CT 3
  ------------------
  |  Branch (421:21): [True: 103k, False: 34.6k]
  ------------------
  422|   103k|    transport->io_layers[layer] = NULL;
  423|   103k|  }
  424|       |
  425|  34.6k|  transport->allowed_layers = LAYER_AMQP1 | LAYER_AMQPSASL | LAYER_AMQPSSL | LAYER_SSL;
  ------------------
  |  |  124|  34.6k|#define LAYER_AMQP1    1
  ------------------
                transport->allowed_layers = LAYER_AMQP1 | LAYER_AMQPSASL | LAYER_AMQPSSL | LAYER_SSL;
  ------------------
  |  |  125|  34.6k|#define LAYER_AMQPSASL 2
  ------------------
                transport->allowed_layers = LAYER_AMQP1 | LAYER_AMQPSASL | LAYER_AMQPSSL | LAYER_SSL;
  ------------------
  |  |  126|  34.6k|#define LAYER_AMQPSSL  4
  ------------------
                transport->allowed_layers = LAYER_AMQP1 | LAYER_AMQPSASL | LAYER_AMQPSSL | LAYER_SSL;
  ------------------
  |  |  127|  34.6k|#define LAYER_SSL      8
  ------------------
  426|  34.6k|  transport->present_layers = LAYER_NONE;
  ------------------
  |  |  123|  34.6k|#define LAYER_NONE     0
  ------------------
  427|       |
  428|       |  // Defer setting up the layers until the first data arrives or is sent
  429|  34.6k|  transport->io_layers[0] = &pni_setup_layer;
  430|       |
  431|  34.6k|  transport->open_sent = false;
  432|  34.6k|  transport->open_rcvd = false;
  433|  34.6k|  transport->close_sent = false;
  434|  34.6k|  transport->close_rcvd = false;
  435|  34.6k|  transport->tail_closed = false;
  436|  34.6k|  transport->head_closed = false;
  437|  34.6k|  transport->remote_container = NULL;
  438|  34.6k|  transport->remote_hostname = NULL;
  439|  34.6k|  transport->local_max_frame = PN_DEFAULT_MAX_FRAME_SIZE;
  ------------------
  |  |  144|  34.6k|#define PN_DEFAULT_MAX_FRAME_SIZE (32*1024)
  ------------------
  440|  34.6k|  transport->remote_max_frame = AMQP_OPEN_MAX_FRAME_SIZE_DEFAULT;
  ------------------
  |  |   11|  34.6k|#define AMQP_OPEN_MAX_FRAME_SIZE_DEFAULT (4294967295) /* uint */
  ------------------
  441|       |
  442|       |  /*
  443|       |   * We set the local limit on channels to 2^15, because
  444|       |   * parts of the code use the topmost bit (of a short)
  445|       |   * as a flag.
  446|       |   * The peer that this transport connects to may also
  447|       |   * place its own limit on max channel number, and the
  448|       |   * application may also set a limit.
  449|       |   * The maximum that we use will be the minimum of all
  450|       |   * these constraints.
  451|       |   */
  452|       |  // There is no constraint yet from remote peer,
  453|       |  // so set to max possible.
  454|  34.6k|  transport->remote_channel_max = AMQP_OPEN_CHANNEL_MAX_DEFAULT;
  ------------------
  |  |   13|  34.6k|#define AMQP_OPEN_CHANNEL_MAX_DEFAULT (65535) /* ushort */
  ------------------
  455|  34.6k|  transport->local_channel_max  = PN_IMPL_CHANNEL_MAX;
  ------------------
  |  |  207|  34.6k|  #define PN_IMPL_CHANNEL_MAX  32767
  ------------------
  456|  34.6k|  transport->channel_max        = transport->local_channel_max;
  457|       |
  458|  34.6k|  transport->local_idle_timeout = 0;
  459|  34.6k|  transport->dead_remote_deadline = 0;
  460|  34.6k|  transport->last_bytes_input = 0;
  461|  34.6k|  transport->remote_idle_timeout = 0;
  462|  34.6k|  transport->keepalive_deadline = 0;
  463|  34.6k|  transport->last_bytes_output = 0;
  464|  34.6k|  transport->remote_offered_capabilities_raw = (pn_bytes_t){0, NULL};
  465|  34.6k|  transport->remote_desired_capabilities_raw = (pn_bytes_t){0, NULL};
  466|  34.6k|  transport->remote_properties_raw = (pn_bytes_t){0, NULL};
  467|  34.6k|  pn_condition_init(&transport->remote_condition);
  468|  34.6k|  pn_condition_init(&transport->condition);
  469|  34.6k|  transport->error = pn_error();
  470|       |
  471|  34.6k|  transport->local_channels = pn_hash(PN_WEAKREF, 0, 0.75);
  472|  34.6k|  transport->remote_channels = pn_hash(PN_WEAKREF, 0, 0.75);
  473|       |
  474|  34.6k|  transport->bytes_input = 0;
  475|  34.6k|  transport->bytes_output = 0;
  476|  34.6k|  transport->max_buffered_delivery_bytes = PN_DEFAULT_MAX_BUFFERED_DELIVERY_BYTES;
  ------------------
  |  |  149|  34.6k|#define PN_DEFAULT_MAX_BUFFERED_DELIVERY_BYTES (4*1024*1024)
  ------------------
  477|  34.6k|  transport->buffered_delivery_bytes = 0;
  478|       |
  479|  34.6k|  transport->input_pending = 0;
  480|  34.6k|  transport->output_pending = 0;
  481|       |
  482|  34.6k|  transport->done_processing = false;
  483|       |
  484|  34.6k|  transport->posted_idle_timeout = false;
  485|       |
  486|  34.6k|  transport->server = false;
  487|  34.6k|  transport->halt = false;
  488|  34.6k|  transport->auth_required = false;
  489|  34.6k|  transport->authenticated = false;
  490|  34.6k|  transport->encryption_required = false;
  491|       |
  492|       |  transport->referenced = true;
  493|  34.6k|}
transport.c:pn_transport_incref:
  527|   184k|{
  528|   184k|  pn_transport_t *transport = (pn_transport_t *) object;
  529|   184k|  if (!transport->referenced) {
  ------------------
  |  Branch (529:7): [True: 0, False: 184k]
  ------------------
  530|      0|    transport->referenced = true;
  531|      0|    if (transport->connection) {
  ------------------
  |  Branch (531:9): [True: 0, False: 0]
  ------------------
  532|      0|      pn_incref(transport->connection);
  533|      0|    } else {
  534|      0|      pn_object_incref(object);
  535|      0|    }
  536|   184k|  } else {
  537|   184k|    pn_object_incref(object);
  538|   184k|  }
  539|   184k|}
transport.c:pn_transport_finalize:
  636|  34.6k|{
  637|  34.6k|  pn_transport_t *transport = (pn_transport_t *) object;
  638|       |
  639|  34.6k|  if (transport->referenced && transport->connection && pn_refcount(transport->connection) > 1) {
  ------------------
  |  Branch (639:7): [True: 34.6k, False: 0]
  |  Branch (639:32): [True: 0, False: 34.6k]
  |  Branch (639:57): [True: 0, False: 0]
  ------------------
  640|      0|    pn_object_incref(transport);
  641|      0|    transport->referenced = false;
  642|      0|    pn_decref(transport->connection);
  643|      0|    return;
  644|      0|  }
  645|       |
  646|       |  // once the application frees the transport, no further I/O
  647|       |  // processing can be done to the connection:
  648|  34.6k|  pn_transport_unbind(transport);
  649|       |  // we may have posted events, so stay alive until they are processed
  650|  34.6k|  if (pn_refcount(transport) > 0) return;
  ------------------
  |  Branch (650:7): [True: 0, False: 34.6k]
  ------------------
  651|       |
  652|  34.6k|  pn_ssl_free(transport);
  653|  34.6k|  pn_sasl_free(transport);
  654|  34.6k|  pni_mem_deallocate(PN_CLASSCLASS(pn_strdup), transport->remote_container);
  ------------------
  |  |  102|  34.6k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  655|  34.6k|  pni_mem_deallocate(PN_CLASSCLASS(pn_strdup), transport->remote_hostname);
  ------------------
  |  |  102|  34.6k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  656|  34.6k|  pn_bytes_free(transport->remote_offered_capabilities_raw);
  657|  34.6k|  pn_bytes_free(transport->remote_desired_capabilities_raw);
  658|  34.6k|  pn_bytes_free(transport->remote_properties_raw);
  659|  34.6k|  pn_condition_tini(&transport->remote_condition);
  660|  34.6k|  pn_condition_tini(&transport->condition);
  661|  34.6k|  pn_error_free(transport->error);
  662|  34.6k|  pn_free(transport->local_channels);
  663|  34.6k|  pn_free(transport->remote_channels);
  664|  34.6k|  pni_mem_subdeallocate(pn_class(transport), transport, transport->input_buf);
  665|  34.6k|  pni_mem_subdeallocate(pn_class(transport), transport, transport->output_buf);
  666|  34.6k|  pn_rwbytes_free(transport->scratch_space);
  667|  34.6k|  pn_free(transport->context);
  668|  34.6k|  pn_buffer_free(transport->output_buffer);
  669|  34.6k|  pni_logger_fini(&transport->logger);
  670|  34.6k|}
transport.c:pni_post_remote_open_events:
  672|   272k|static void pni_post_remote_open_events(pn_transport_t *transport, pn_connection_t *connection) {
  673|   272k|    pn_collector_put_object(connection->collector, connection, PN_CONNECTION_REMOTE_OPEN);
  674|   272k|    if (transport->remote_idle_timeout) {
  ------------------
  |  Branch (674:9): [True: 3.50k, False: 268k]
  ------------------
  675|  3.50k|      pn_collector_put_object(connection->collector, transport, PN_TRANSPORT);
  676|  3.50k|    }
  677|   272k|}
transport.c:pni_delivery_map_clear:
  129|  2.82M|{
  130|  2.82M|  pn_hash_t *hash = dm->deliveries;
  131|  2.82M|  for (pn_handle_t entry = pn_hash_head(hash);
  132|  2.90M|       entry;
  ------------------
  |  Branch (132:8): [True: 84.9k, False: 2.82M]
  ------------------
  133|  2.82M|       entry = pn_hash_next(hash, entry))
  134|  84.9k|  {
  135|  84.9k|    pn_delivery_t *dlv = (pn_delivery_t *) pn_hash_value(hash, entry);
  136|  84.9k|    pn_delivery_map_del(dm, dlv);
  137|  84.9k|  }
  138|  2.82M|  dm->next = 0;
  139|  2.82M|}
transport.c:pni_transport_collector:
  954|   161k|{
  955|   161k|  if (transport->connection && transport->connection->collector) {
  ------------------
  |  Branch (955:7): [True: 161k, False: 0]
  |  Branch (955:32): [True: 161k, False: 0]
  ------------------
  956|   161k|    return transport->connection->collector;
  957|   161k|  } else {
  958|       |    return NULL;
  959|      0|  }
  960|   161k|}
transport.c:pni_close_tail:
  971|  58.0k|{
  972|  58.0k|  if (!transport->tail_closed) {
  ------------------
  |  Branch (972:7): [True: 34.6k, False: 23.4k]
  ------------------
  973|       |    transport->tail_closed = true;
  974|  34.6k|    pn_collector_t *collector = pni_transport_collector(transport);
  975|  34.6k|    pn_collector_put_object(collector, transport, PN_TRANSPORT_TAIL_CLOSED);
  976|  34.6k|    pni_maybe_post_closed(transport);
  977|  34.6k|  }
  978|  58.0k|}
transport.c:pni_maybe_post_closed:
  963|  69.2k|{
  964|  69.2k|  pn_collector_t *collector = pni_transport_collector(transport);
  965|  69.2k|  if (transport->head_closed && transport->tail_closed) {
  ------------------
  |  Branch (965:7): [True: 34.7k, False: 34.4k]
  |  Branch (965:33): [True: 34.6k, False: 160]
  ------------------
  966|  34.6k|    pn_collector_put_object(collector, transport, PN_TRANSPORT_CLOSED);
  967|  34.6k|  }
  968|  69.2k|}
transport.c:pn_bytes_strdup:
 1028|  5.97k|{
 1029|  5.97k|  return pn_strndup(str.start, str.size);
 1030|  5.97k|}
transport.c:pni_calculate_channel_max:
   60|   306k|static void pni_calculate_channel_max(pn_transport_t *transport) {
   61|       |  /*
   62|       |   * The application cannot make the limit larger than
   63|       |   * what this library will allow.
   64|       |   */
   65|   306k|  transport->channel_max = (PN_IMPL_CHANNEL_MAX < transport->local_channel_max)
  ------------------
  |  |  207|   306k|  #define PN_IMPL_CHANNEL_MAX  32767
  ------------------
  |  Branch (65:28): [True: 0, False: 306k]
  ------------------
   66|   306k|                           ? PN_IMPL_CHANNEL_MAX
  ------------------
  |  |  207|      0|  #define PN_IMPL_CHANNEL_MAX  32767
  ------------------
   67|   306k|                           : transport->local_channel_max;
   68|       |
   69|       |  /*
   70|       |   * The remote peer's constraint is not valid until the
   71|       |   * peer's open frame has been received.
   72|       |   */
   73|   306k|  if(transport->open_rcvd) {
  ------------------
  |  Branch (73:6): [True: 272k, False: 34.6k]
  ------------------
   74|   272k|    transport->channel_max = (transport->channel_max < transport->remote_channel_max)
  ------------------
  |  Branch (74:30): [True: 270k, False: 1.94k]
  ------------------
   75|   272k|                             ? transport->channel_max
   76|   272k|                             : transport->remote_channel_max;
   77|   272k|  }
   78|   306k|}
transport.c:pni_map_remote_channel:
  502|  1.28M|{
  503|  1.28M|  pn_transport_t *transport = session->connection->transport;
  504|  1.28M|  pn_hash_put(transport->remote_channels, channel, session);
  505|  1.28M|  session->state.remote_channel = channel;
  506|  1.28M|  pn_ep_incref(&session->endpoint);
  507|  1.28M|}
transport.c:pni_channel_state:
  497|  1.82M|{
  498|  1.82M|  return (pn_session_t *) pn_hash_get(transport->remote_channels, channel);
  499|  1.82M|}
transport.c:pni_find_link:
 1142|  1.38M|{
 1143|  1.38M|  pn_endpoint_type_t type = is_sender ? SENDER : RECEIVER;
  ------------------
  |  Branch (1143:29): [True: 260k, False: 1.12M]
  ------------------
 1144|       |
 1145|  69.6M|  for (size_t i = 0; i < pn_list_size(ssn->links); i++)
  ------------------
  |  Branch (1145:22): [True: 68.2M, False: 1.38M]
  ------------------
 1146|  68.2M|  {
 1147|  68.2M|    pn_link_t *link = (pn_link_t *) pn_list_get(ssn->links, i);
 1148|  68.2M|    if (link->endpoint.type == type &&
  ------------------
  |  Branch (1148:9): [True: 63.5M, False: 4.73M]
  ------------------
 1149|       |        // This function is used to locate the link object for an
 1150|       |        // incoming attach. If a link object of the same name is found
 1151|       |        // which is remotely closed or detached, assume that is
 1152|       |        // no longer in use and a new link is intended.
 1153|  63.5M|        (!(link->endpoint.state & PN_REMOTE_CLOSED) && ((int32_t) link->state.remote_handle != -2)) &&
  ------------------
  |  |   75|  63.5M|#define PN_REMOTE_CLOSED (32)
  ------------------
  |  Branch (1153:10): [True: 2.76M, False: 60.7M]
  |  Branch (1153:56): [True: 211k, False: 2.55M]
  ------------------
 1154|   211k|        pn_bytes_equal(name, pn_string_bytes(link->name)))
  ------------------
  |  Branch (1154:9): [True: 580, False: 210k]
  ------------------
 1155|    580|    {
 1156|    580|      return link;
 1157|    580|    }
 1158|  68.2M|  }
 1159|  1.38M|  return NULL;
 1160|  1.38M|}
transport.c:pni_map_remote_handle:
  820|  1.38M|{
  821|  1.38M|  link->state.remote_handle = handle;
  822|  1.38M|  pn_hash_put(link->session->state.remote_handles, handle, link);
  823|  1.38M|  pn_ep_incref(&link->endpoint);
  824|  1.38M|}
transport.c:set_expiry_policy_from_symbol:
 1163|  57.3k|{
 1164|  57.3k|  if (symbol.start) {
  ------------------
  |  Branch (1164:7): [True: 6.33k, False: 51.0k]
  ------------------
 1165|  6.33k|    if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(link-detach)))
  ------------------
  |  |  211|  6.33k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1165:9): [True: 10, False: 6.32k]
  ------------------
 1166|     10|      pn_terminus_set_expiry_policy(terminus, PN_EXPIRE_WITH_LINK);
 1167|  6.33k|    if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(session-end)))
  ------------------
  |  |  211|  6.33k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1167:9): [True: 433, False: 5.89k]
  ------------------
 1168|    433|      pn_terminus_set_expiry_policy(terminus, PN_EXPIRE_WITH_SESSION);
 1169|  6.33k|    if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(connection-close)))
  ------------------
  |  |  211|  6.33k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1169:9): [True: 118, False: 6.21k]
  ------------------
 1170|    118|      pn_terminus_set_expiry_policy(terminus, PN_EXPIRE_WITH_CONNECTION);
 1171|  6.33k|    if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(never)))
  ------------------
  |  |  211|  6.33k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1171:9): [True: 1.67k, False: 4.66k]
  ------------------
 1172|  1.67k|      pn_terminus_set_expiry_policy(terminus, PN_EXPIRE_NEVER);
 1173|  6.33k|  }
 1174|  57.3k|}
transport.c:symbol2dist_mode:
 1177|  52.7k|{
 1178|  52.7k|  if (!symbol.start)
  ------------------
  |  Branch (1178:7): [True: 44.1k, False: 8.67k]
  ------------------
 1179|  44.1k|    return PN_DIST_MODE_UNSPECIFIED;
 1180|       |
 1181|  8.67k|  if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(move)))
  ------------------
  |  |  211|  8.67k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1181:7): [True: 18, False: 8.65k]
  ------------------
 1182|     18|    return PN_DIST_MODE_MOVE;
 1183|  8.65k|  if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(copy)))
  ------------------
  |  |  211|  8.65k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1183:7): [True: 2.92k, False: 5.73k]
  ------------------
 1184|  2.92k|    return PN_DIST_MODE_COPY;
 1185|       |
 1186|  5.73k|  return PN_DIST_MODE_UNSPECIFIED;
 1187|  8.65k|}
transport.c:pni_handle_state:
  838|   294k|{
  839|   294k|  return (pn_link_t *) pn_hash_get(ssn->state.remote_handles, handle);
  840|   294k|}
transport.c:pni_link_more_end:
 1376|  75.9k|{
 1377|       |  link->more_pending = false;
 1378|  75.9k|  pn_bytes_free(link->more_tag);
 1379|  75.9k|  link->more_tag = pn_bytes_null;
 1380|  75.9k|  link->more_format = 0;
 1381|  75.9k|}
transport.c:pni_delivery_map_push:
  111|  90.5k|{
  112|  90.5k|  pn_delivery_state_t *ds = &delivery->state;
  113|  90.5k|  pn_delivery_state_init(ds, delivery, db->next++);
  114|  90.5k|  pn_hash_put(db->deliveries, pni_sequence_make_hash(ds->id), delivery);
  115|  90.5k|  return ds;
  116|  90.5k|}
transport.c:pn_delivery_state_init:
  103|  90.5k|{
  104|  90.5k|  ds->id = id;
  105|  90.5k|  ds->sending = false;
  106|  90.5k|  ds->sent = false;
  107|       |  ds->init = true;
  108|  90.5k|}
transport.c:pni_link_more_begin:
 1367|  14.7k|{
 1368|  14.7k|  assert(!link->more_pending);
 1369|       |  link->more_pending = true;
 1370|  14.7k|  link->more_id = id;
 1371|  14.7k|  link->more_tag = pn_bytes_dup(tag);
 1372|  14.7k|  link->more_format = format;
 1373|  14.7k|}
transport.c:pni_amqp_decode_disposition:
 1610|  26.0k|static void pni_amqp_decode_disposition (uint64_t type, pn_bytes_t disp_data, pn_disposition_t *disp) {
 1611|  26.0k|  if (disp->type != PN_DISP_EMPTY) {
  ------------------
  |  Branch (1611:7): [True: 21.7k, False: 4.28k]
  ------------------
 1612|  21.7k|    pn_disposition_clear(disp);
 1613|  21.7k|  }
 1614|  26.0k|  switch (type) {
 1615|    103|    case AMQP_DESC_RECEIVED: {
  ------------------
  |  |  169|    103|#define AMQP_DESC_RECEIVED ((uint64_t) 35)
  ------------------
  |  Branch (1615:5): [True: 103, False: 25.9k]
  ------------------
 1616|    103|      bool qnumber;
 1617|    103|      uint32_t number;
 1618|    103|      bool qoffset;
 1619|    103|      uint64_t offset;
 1620|    103|      pn_amqp_decode_disposition_received(disp_data, &qnumber, &number, &qoffset, &offset);
 1621|       |
 1622|    103|      disp->type = PN_DISP_RECEIVED;
 1623|       |
 1624|    103|      if (qnumber) {
  ------------------
  |  Branch (1624:11): [True: 18, False: 85]
  ------------------
 1625|     18|          disp->u.s_received.section_number = number;
 1626|     18|      }
 1627|    103|      if (qoffset) {
  ------------------
  |  Branch (1627:11): [True: 66, False: 37]
  ------------------
 1628|     66|          disp->u.s_received.section_offset = offset;
 1629|     66|      }
 1630|    103|      break;
 1631|      0|    }
 1632|  1.06k|    case AMQP_DESC_ACCEPTED:
  ------------------
  |  |  171|  1.06k|#define AMQP_DESC_ACCEPTED ((uint64_t) 36)
  ------------------
  |  Branch (1632:5): [True: 1.06k, False: 24.9k]
  ------------------
 1633|  1.06k|      disp->type = PN_DISP_ACCEPTED;
 1634|  1.06k|      break;
 1635|       |
 1636|  7.63k|    case AMQP_DESC_REJECTED: {
  ------------------
  |  |  173|  7.63k|#define AMQP_DESC_REJECTED ((uint64_t) 37)
  ------------------
  |  Branch (1636:5): [True: 7.63k, False: 18.3k]
  ------------------
 1637|  7.63k|      pn_bytes_t cond;
 1638|  7.63k|      pn_bytes_t desc;
 1639|  7.63k|      pn_bytes_t info;
 1640|  7.63k|      pn_amqp_decode_disposition_rejected(disp_data, &cond, &desc, &info);
 1641|  7.63k|      disp->type = PN_DISP_REJECTED;
 1642|  7.63k|      pn_condition_set(&disp->u.s_rejected.condition, cond, desc, info);
 1643|       |
 1644|  7.63k|      break;
 1645|      0|    }
 1646|    285|    case AMQP_DESC_RELEASED:
  ------------------
  |  |  175|    285|#define AMQP_DESC_RELEASED ((uint64_t) 38)
  ------------------
  |  Branch (1646:5): [True: 285, False: 25.7k]
  ------------------
 1647|    285|      disp->type = PN_DISP_RELEASED;
 1648|    285|      break;
 1649|       |
 1650|  11.0k|    case AMQP_DESC_MODIFIED: {
  ------------------
  |  |  177|  11.0k|#define AMQP_DESC_MODIFIED ((uint64_t) 39)
  ------------------
  |  Branch (1650:5): [True: 11.0k, False: 14.9k]
  ------------------
 1651|  11.0k|      bool qfailed;
 1652|  11.0k|      bool failed;
 1653|  11.0k|      bool qundeliverable;
 1654|  11.0k|      bool undeliverable;
 1655|  11.0k|      pn_bytes_t annotations_raw = (pn_bytes_t){0, NULL};
 1656|  11.0k|      pn_amqp_decode_disposition_modified(disp_data, &qfailed, &failed, &qundeliverable, &undeliverable, &annotations_raw);
 1657|  11.0k|      disp->type = PN_DISP_MODIFIED;
 1658|  11.0k|      pn_bytes_free(disp->u.s_modified.annotations_raw);
 1659|  11.0k|      disp->u.s_modified.annotations_raw = pn_bytes_dup(annotations_raw);
 1660|       |
 1661|  11.0k|      if (qfailed) {
  ------------------
  |  Branch (1661:11): [True: 1.75k, False: 9.32k]
  ------------------
 1662|  1.75k|          disp->u.s_modified.failed = failed;
 1663|  1.75k|      }
 1664|  11.0k|      if (qundeliverable) {
  ------------------
  |  Branch (1664:11): [True: 226, False: 10.8k]
  ------------------
 1665|    226|          disp->u.s_modified.undeliverable = undeliverable;
 1666|    226|      }
 1667|  11.0k|      break;
 1668|      0|    }
 1669|    221|    case AMQP_DESC_DECLARED: {
  ------------------
  |  |  197|    221|#define AMQP_DESC_DECLARED ((uint64_t) 51)
  ------------------
  |  Branch (1669:5): [True: 221, False: 25.7k]
  ------------------
 1670|    221|      pn_bytes_t id;
 1671|    221|      pn_amqp_decode_disposition_declared(disp_data, &id);
 1672|    221|      disp->type = PN_DISP_DECLARED;
 1673|    221|      pn_bytes_free(disp->u.s_declared.id);
 1674|    221|      disp->u.s_declared.id = pn_bytes_dup(id);
 1675|    221|      break;
 1676|      0|    }
 1677|  4.19k|    case AMQP_DESC_TRANSACTIONAL_STATE: {
  ------------------
  |  |  199|  4.19k|#define AMQP_DESC_TRANSACTIONAL_STATE ((uint64_t) 52)
  ------------------
  |  Branch (1677:5): [True: 4.19k, False: 21.8k]
  ------------------
 1678|  4.19k|      pn_bytes_t id;
 1679|  4.19k|      bool qoutcome;
 1680|  4.19k|      pn_bytes_t outcome_raw;
 1681|  4.19k|      pn_amqp_decode_disposition_transactional_state(disp_data, &id, &qoutcome, &outcome_raw);
 1682|  4.19k|      disp->type = PN_DISP_TRANSACTIONAL;
 1683|  4.19k|      pn_bytes_free(disp->u.s_transactional.id);
 1684|  4.19k|      disp->u.s_transactional.id = pn_bytes_dup(id);
 1685|  4.19k|      disp->u.s_transactional.outcome_raw = (pn_bytes_t){0, NULL};
 1686|  4.19k|      if (qoutcome) {
  ------------------
  |  Branch (1686:11): [True: 1.72k, False: 2.47k]
  ------------------
 1687|  1.72k|        disp->u.s_transactional.outcome_raw = pn_bytes_dup(outcome_raw);
 1688|  1.72k|      }
 1689|  4.19k|      break;
 1690|      0|    }
 1691|  1.42k|    default: {
  ------------------
  |  Branch (1691:5): [True: 1.42k, False: 24.5k]
  ------------------
 1692|       |      pn_bytes_t data_raw = (pn_bytes_t){0, NULL};
 1693|  1.42k|      pn_amqp_decode_raw(disp_data, &data_raw);
 1694|  1.42k|      disp->type = PN_DISP_CUSTOM;
 1695|  1.42k|      disp->u.s_custom.type = type;
 1696|  1.42k|      pn_bytes_free(disp->u.s_custom.data_raw);
 1697|  1.42k|      disp->u.s_custom.data_raw = pn_bytes_dup(data_raw);
 1698|  1.42k|      break;
 1699|      0|    }
 1700|  26.0k|  }
 1701|  26.0k|}
transport.c:sequence_lte:
 1606|   145k|static inline bool sequence_lte(pn_sequence_t a, pn_sequence_t b) {
 1607|       |  return b-a <= INT32_MAX;
 1608|   145k|}
transport.c:pni_do_delivery_disposition:
 1703|  37.3k|static int pni_do_delivery_disposition(pn_transport_t * transport, pn_delivery_t *delivery, bool settled, bool type_init, uint64_t type, pn_bytes_t disp_data) {
 1704|  37.3k|  pn_disposition_t *remote = &delivery->remote;
 1705|       |
 1706|  37.3k|  if (type_init) {
  ------------------
  |  Branch (1706:7): [True: 25.3k, False: 12.0k]
  ------------------
 1707|  25.3k|    pni_amqp_decode_disposition(type, disp_data, remote);
 1708|  25.3k|  }
 1709|       |
 1710|  37.3k|  remote->settled = settled;
 1711|  37.3k|  delivery->updated = true;
 1712|  37.3k|  pn_work_update(transport->connection, delivery);
 1713|       |
 1714|  37.3k|  pn_collector_put_object(transport->connection->collector, delivery, PN_DELIVERY);
 1715|  37.3k|  return 0;
 1716|  37.3k|}
transport.c:pni_delivery_map_get:
   98|  2.19k|{
   99|  2.19k|  return (pn_delivery_t *) pn_hash_get(db->deliveries, pni_sequence_make_hash(id) );
  100|  2.19k|}
transport.c:pn_condition_set:
 1592|   243k|{
 1593|   243k|  if (condition->name == NULL) {
  ------------------
  |  Branch (1593:7): [True: 149k, False: 94.5k]
  ------------------
 1594|   149k|    condition->name = pn_string(NULL);
 1595|   149k|  }
 1596|   243k|  pn_string_setn(condition->name, cond.start, cond.size);
 1597|   243k|  if (condition->description == NULL) {
  ------------------
  |  Branch (1597:7): [True: 149k, False: 94.5k]
  ------------------
 1598|       |    condition->description = pn_string(NULL);
 1599|   149k|  }
 1600|   243k|  pn_string_setn(condition->description, desc.start, desc.size);
 1601|   243k|  pn_data_clear(condition->info);
 1602|   243k|  pn_bytes_free(condition->info_raw);
 1603|   243k|  condition->info_raw = pn_bytes_dup(info);
 1604|   243k|}
transport.c:pni_unmap_remote_handle:
  827|   137k|{
  828|   137k|  uintptr_t handle = link->state.remote_handle;
  829|   137k|  link->state.remote_handle = -2;
  830|   137k|  if (pn_hash_get(link->session->state.remote_handles, handle)) {
  ------------------
  |  Branch (830:7): [True: 137k, False: 0]
  ------------------
  831|   137k|    pn_ep_decref(&link->endpoint);
  832|   137k|  }
  833|       |  // may delete link:
  834|   137k|  pn_hash_del(link->session->state.remote_handles, handle);
  835|   137k|}
transport.c:pni_unmap_remote_channel:
  512|  89.7k|{
  513|       |  // XXX: should really update link state also
  514|  89.7k|  pni_delivery_map_clear(&ssn->state.incoming);
  515|  89.7k|  pni_transport_unbind_handles(ssn->state.remote_handles, false);
  516|  89.7k|  pn_transport_t *transport = ssn->connection->transport;
  517|  89.7k|  uint16_t channel = ssn->state.remote_channel;
  518|  89.7k|  ssn->state.remote_channel = -2;
  519|  89.7k|  if (pn_hash_get(transport->remote_channels, channel)) {
  ------------------
  |  Branch (519:7): [True: 7.60k, False: 82.1k]
  ------------------
  520|  7.60k|    pn_ep_decref(&ssn->endpoint);
  521|  7.60k|  }
  522|       |  // note: may free the session:
  523|  89.7k|  pn_hash_del(transport->remote_channels, channel);
  524|  89.7k|}
transport.c:transport_consume:
 1873|  73.4k|{
 1874|       |  // This allows whatever is driving the I/O to set the error
 1875|       |  // condition on the transport before doing pn_transport_close_head()
 1876|       |  // or pn_transport_close_tail(). This allows all transport errors to
 1877|       |  // flow to the app the same way, but provides cleaner error messages
 1878|       |  // since we don't try to look for a protocol header when, e.g. the
 1879|       |  // connection was refused.
 1880|  73.4k|  if (!(transport->present_layers & LAYER_AMQP1) && transport->tail_closed &&
  ------------------
  |  |  124|  73.4k|#define LAYER_AMQP1    1
  ------------------
  |  Branch (1880:7): [True: 34.6k, False: 38.7k]
  |  Branch (1880:53): [True: 57, False: 34.6k]
  ------------------
 1881|     57|      pn_condition_is_set(&transport->condition)) {
  ------------------
  |  Branch (1881:7): [True: 0, False: 57]
  ------------------
 1882|      0|    pn_do_error(transport, NULL, NULL);
 1883|      0|    return PN_EOS;
  ------------------
  |  |   48|      0|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 1884|      0|  }
 1885|       |
 1886|  73.4k|  size_t consumed = 0;
 1887|       |
 1888|   145k|  while (transport->input_pending || transport->tail_closed) {
  ------------------
  |  Branch (1888:10): [True: 115k, False: 30.2k]
  |  Branch (1888:38): [True: 14.8k, False: 15.4k]
  ------------------
 1889|   130k|    ssize_t n;
 1890|   130k|    n = transport->io_layers[0]->
 1891|   130k|      process_input( transport, 0,
 1892|   130k|                     transport->input_buf + consumed,
 1893|   130k|                     transport->input_pending );
 1894|   130k|    if (n > 0) {
  ------------------
  |  Branch (1894:9): [True: 72.3k, False: 57.9k]
  ------------------
 1895|  72.3k|      consumed += n;
 1896|  72.3k|      transport->input_pending -= n;
 1897|  72.3k|    } else if (n == 0) {
  ------------------
  |  Branch (1897:16): [True: 32.1k, False: 25.7k]
  ------------------
 1898|  32.1k|      break;
 1899|  32.1k|    } else {
 1900|  25.7k|      assert(n == PN_EOS);
 1901|  25.7k|      PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP | PN_SUBSYSTEM_IO, PN_LEVEL_FRAME | PN_LEVEL_RAW, "  <- EOS");
  ------------------
  |  |   57|  25.7k|    do { \
  |  |   58|  25.7k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   54|  25.7k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:6): [Folded, False: 25.7k]
  |  |  |  |  |  Branch (54:38): [True: 25.7k, False: 0]
  |  |  |  |  |  Branch (54:73): [True: 0, False: 25.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|  25.7k|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   60|  25.7k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (60:13): [Folded, False: 25.7k]
  |  |  ------------------
  ------------------
 1902|  25.7k|      transport->input_pending = 0;  // XXX ???
 1903|  25.7k|      return n;
 1904|  25.7k|    }
 1905|   130k|  }
 1906|       |
 1907|  47.6k|  if (transport->input_pending && consumed) {
  ------------------
  |  Branch (1907:7): [True: 32.1k, False: 15.4k]
  |  Branch (1907:35): [True: 22.8k, False: 9.36k]
  ------------------
 1908|  22.8k|    memmove( transport->input_buf,  &transport->input_buf[consumed], transport->input_pending );
 1909|  22.8k|  }
 1910|       |
 1911|  47.6k|  return consumed;
 1912|  73.4k|}
transport.c:pn_error_amqp:
 2622|  23.4k|{
 2623|  23.4k|  if (!transport->close_sent) {
  ------------------
  |  Branch (2623:7): [True: 23.3k, False: 99]
  ------------------
 2624|  23.3k|    if (!transport->open_sent) {
  ------------------
  |  Branch (2624:9): [True: 0, False: 23.3k]
  ------------------
 2625|       |      /* "DL[S]" */
 2626|      0|      pn_bytes_t buf = pn_amqp_encode_open_minimal(&transport->scratch_space, AMQP_DESC_OPEN, (pn_bytes_t){.size=0, .start=""});
  ------------------
  |  |  145|      0|#define AMQP_DESC_OPEN ((uint64_t) 16)
  ------------------
 2627|      0|      pn_framing_send_amqp(transport, 0, buf);
 2628|      0|    }
 2629|       |
 2630|  23.3k|    pni_post_close(transport, &transport->condition);
 2631|  23.3k|    transport->close_sent = true;
 2632|  23.3k|  }
 2633|  23.4k|  transport->halt = true;
 2634|       |  transport->done_processing = true;
 2635|  23.4k|}
transport.c:pni_post_close:
  945|  24.3k|{
  946|  24.3k|  if (!cond && transport->connection) {
  ------------------
  |  Branch (946:7): [True: 981, False: 23.3k]
  |  Branch (946:16): [True: 981, False: 0]
  ------------------
  947|    981|    cond = pn_connection_condition(transport->connection);
  948|    981|  }
  949|  24.3k|  pn_bytes_t buf = pn_amqp_encode_close(&transport->scratch_space, AMQP_DESC_CLOSE, cond);
  ------------------
  |  |  161|  24.3k|#define AMQP_DESC_CLOSE ((uint64_t) 24)
  ------------------
  950|  24.3k|  return pn_framing_send_amqp(transport, 0, buf);
  951|  24.3k|}
transport.c:pn_input_read_amqp_header:
 2638|  34.6k|{
 2639|  34.6k|  bool eos = transport->tail_closed;
 2640|  34.6k|  if (eos && available==0) {
  ------------------
  |  Branch (2640:7): [True: 57, False: 34.6k]
  |  Branch (2640:14): [True: 0, False: 57]
  ------------------
 2641|      0|    pn_do_error(transport, "amqp:connection:framing-error",
 2642|      0|                "Expected AMQP protocol header: no protocol header found (connection aborted)");
 2643|      0|    return PN_EOS;
  ------------------
  |  |   48|      0|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2644|      0|  }
 2645|  34.6k|  pni_protocol_type_t protocol = pni_sniff_header(bytes, available);
 2646|  34.6k|  switch (protocol) {
 2647|  34.2k|  case PNI_PROTOCOL_AMQP1:
  ------------------
  |  Branch (2647:3): [True: 34.2k, False: 399]
  ------------------
 2648|  34.2k|    transport->present_layers |= LAYER_AMQP1;
  ------------------
  |  |  124|  34.2k|#define LAYER_AMQP1    1
  ------------------
 2649|  34.2k|    if (transport->io_layers[layer] == &amqp_read_header_layer) {
  ------------------
  |  Branch (2649:9): [True: 34.2k, False: 0]
  ------------------
 2650|  34.2k|      transport->io_layers[layer] = &amqp_layer;
 2651|  34.2k|    } else {
 2652|      0|      transport->io_layers[layer] = &amqp_write_header_layer;
 2653|      0|    }
 2654|  34.2k|    PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_FRAME, "  <- %s", "AMQP");
  ------------------
  |  |   57|  34.2k|    do { \
  |  |   58|  34.2k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   54|  34.2k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:6): [Folded, False: 34.2k]
  |  |  |  |  |  Branch (54:38): [True: 34.2k, False: 0]
  |  |  |  |  |  Branch (54:73): [True: 0, False: 34.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|  34.2k|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   60|  34.2k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (60:13): [Folded, False: 34.2k]
  |  |  ------------------
  ------------------
 2655|  34.2k|    return 8;
 2656|    114|  case PNI_PROTOCOL_INSUFFICIENT:
  ------------------
  |  Branch (2656:3): [True: 114, False: 34.5k]
  ------------------
 2657|    114|    if (!eos) return 0;
  ------------------
  |  Branch (2657:9): [True: 57, False: 57]
  ------------------
 2658|     57|    PN_FALLTHROUGH;
  ------------------
  |  |  105|     57|        #define PN_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 2659|    342|  default:
  ------------------
  |  Branch (2659:3): [True: 285, False: 34.3k]
  ------------------
 2660|    342|    break;
 2661|  34.6k|  }
 2662|    342|  char quoted[1024];
 2663|    342|  pn_quote_data(quoted, 1024, bytes, available);
 2664|    342|  pn_do_error(transport, "amqp:connection:framing-error",
 2665|    342|              "Expected AMQP protocol header got: %s ['%s']%s", pni_protocol_name(protocol), quoted,
 2666|    342|              !eos ? "" : " (connection aborted)");
  ------------------
  |  Branch (2666:15): [True: 285, False: 57]
  ------------------
 2667|    342|  return PN_EOS;
  ------------------
  |  |   48|    342|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2668|  34.6k|}
transport.c:pn_input_read_amqp:
 2671|  95.6k|{
 2672|  95.6k|  if (transport->close_rcvd) {
  ------------------
  |  Branch (2672:7): [True: 0, False: 95.6k]
  ------------------
 2673|      0|    if (available > 0) {
  ------------------
  |  Branch (2673:9): [True: 0, False: 0]
  ------------------
 2674|      0|      pn_do_error(transport, "amqp:connection:framing-error", "data after close");
 2675|      0|      return PN_EOS;
  ------------------
  |  |   48|      0|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2676|      0|    }
 2677|      0|  }
 2678|       |
 2679|  95.6k|  if (!transport->close_rcvd && !available) {
  ------------------
  |  Branch (2679:7): [True: 95.6k, False: 0]
  |  Branch (2679:33): [True: 14.8k, False: 80.8k]
  ------------------
 2680|  14.8k|    pn_do_error(transport, "amqp:connection:framing-error", "connection aborted");
 2681|  14.8k|    return PN_EOS;
  ------------------
  |  |   48|  14.8k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2682|  14.8k|  }
 2683|       |
 2684|       |
 2685|  80.8k|  ssize_t n = pn_dispatcher_amqp_input(transport, bytes, available, &transport->halt);
 2686|  80.8k|  if (n < 0 || transport->close_rcvd) {
  ------------------
  |  Branch (2686:7): [True: 9.94k, False: 70.9k]
  |  Branch (2686:16): [True: 709, False: 70.2k]
  ------------------
 2687|  10.6k|    return PN_EOS;
  ------------------
  |  |   48|  10.6k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2688|  70.2k|  } else {
 2689|  70.2k|    return n;
 2690|  70.2k|  }
 2691|  80.8k|}
transport.c:pn_output_write_amqp_header:
 2736|  34.6k|{
 2737|  34.6k|  PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_FRAME, "  -> %s", "AMQP");
  ------------------
  |  |   57|  34.6k|    do { \
  |  |   58|  34.6k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   54|  34.6k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:6): [Folded, False: 34.6k]
  |  |  |  |  |  Branch (54:38): [True: 34.6k, False: 0]
  |  |  |  |  |  Branch (54:73): [True: 0, False: 34.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|  34.6k|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   60|  34.6k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (60:13): [Folded, False: 34.6k]
  |  |  ------------------
  ------------------
 2738|  34.6k|  assert(available >= 8);
 2739|  34.6k|  memmove(bytes, AMQP_HEADER, 8);
  ------------------
  |  | 2619|  34.6k|#define AMQP_HEADER ("AMQP\x00\x01\x00\x00")
  ------------------
 2740|  34.6k|  if (pn_condition_is_set(&transport->condition)) {
  ------------------
  |  Branch (2740:7): [True: 0, False: 34.6k]
  ------------------
 2741|      0|      pn_error_amqp(transport, layer);
 2742|      0|    transport->io_layers[layer] = &pni_error_layer;
 2743|      0|    return pn_dispatcher_output(transport, bytes+8, available-8) + 8;
 2744|      0|  }
 2745|       |
 2746|  34.6k|  if (transport->io_layers[layer] == &amqp_write_header_layer) {
  ------------------
  |  Branch (2746:7): [True: 0, False: 34.6k]
  ------------------
 2747|      0|    transport->io_layers[layer] = &amqp_layer;
 2748|  34.6k|  } else {
 2749|  34.6k|    transport->io_layers[layer] = &amqp_read_header_layer;
 2750|  34.6k|  }
 2751|  34.6k|  return 8;
 2752|  34.6k|}
transport.c:pn_output_write_amqp:
 2755|   334k|{
 2756|   334k|  if (transport->connection && !transport->done_processing) {
  ------------------
  |  Branch (2756:7): [True: 264k, False: 69.2k]
  |  Branch (2756:32): [True: 218k, False: 46.9k]
  ------------------
 2757|   218k|    int err = pni_process(transport);
 2758|   218k|    if (err) {
  ------------------
  |  Branch (2758:9): [True: 0, False: 218k]
  ------------------
 2759|      0|      pn_logger_logf(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "process error %i", err);
 2760|      0|      transport->done_processing = true;
 2761|      0|    }
 2762|   218k|  }
 2763|       |
 2764|       |  // write out any buffered data _before_ returning PN_EOS, else we
 2765|       |  // could truncate an outgoing Close frame containing a useful error
 2766|       |  // status
 2767|   334k|  if (!pn_buffer_size(transport->output_buffer) && transport->close_sent) {
  ------------------
  |  Branch (2767:7): [True: 270k, False: 63.6k]
  |  Branch (2767:52): [True: 24.6k, False: 245k]
  ------------------
 2768|  24.6k|    return PN_EOS;
  ------------------
  |  |   48|  24.6k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2769|  24.6k|  }
 2770|       |
 2771|   309k|  return pn_dispatcher_output(transport, bytes, available);
 2772|   334k|}
transport.c:pni_process:
 2592|   218k|{
 2593|   218k|  int err;
 2594|   218k|  if ((err = pni_phase(transport, pni_process_conn_setup))) return err;
  ------------------
  |  Branch (2594:7): [True: 0, False: 218k]
  ------------------
 2595|   218k|  if ((err = pni_phase(transport, pni_process_ssn_setup))) return err;
  ------------------
  |  Branch (2595:7): [True: 0, False: 218k]
  ------------------
 2596|   218k|  if ((err = pni_phase(transport, pni_process_link_setup))) return err;
  ------------------
  |  Branch (2596:7): [True: 0, False: 218k]
  ------------------
 2597|   218k|  if ((err = pni_phase(transport, pni_process_flow_receiver))) return err;
  ------------------
  |  Branch (2597:7): [True: 0, False: 218k]
  ------------------
 2598|       |
 2599|       |  // XXX: this has to happen two times because we might settle stuff
 2600|       |  // on the first pass and create space for more work to be done on the
 2601|       |  // second pass
 2602|   218k|  if ((err = pni_phase(transport, pni_process_tpwork))) return err;
  ------------------
  |  Branch (2602:7): [True: 0, False: 218k]
  ------------------
 2603|   218k|  if ((err = pni_phase(transport, pni_process_tpwork))) return err;
  ------------------
  |  Branch (2603:7): [True: 0, False: 218k]
  ------------------
 2604|       |
 2605|   218k|  if ((err = pni_phase(transport, pni_process_flush_disp))) return err;
  ------------------
  |  Branch (2605:7): [True: 0, False: 218k]
  ------------------
 2606|       |
 2607|   218k|  if ((err = pni_phase(transport, pni_process_flow_sender))) return err;
  ------------------
  |  Branch (2607:7): [True: 0, False: 218k]
  ------------------
 2608|   218k|  if ((err = pni_phase(transport, pni_process_link_teardown))) return err;
  ------------------
  |  Branch (2608:7): [True: 0, False: 218k]
  ------------------
 2609|   218k|  if ((err = pni_phase(transport, pni_process_ssn_teardown))) return err;
  ------------------
  |  Branch (2609:7): [True: 0, False: 218k]
  ------------------
 2610|   218k|  if ((err = pni_phase(transport, pni_process_conn_teardown))) return err;
  ------------------
  |  Branch (2610:7): [True: 0, False: 218k]
  ------------------
 2611|       |
 2612|   218k|  if (transport->connection->tpwork_head) {
  ------------------
  |  Branch (2612:7): [True: 0, False: 218k]
  ------------------
 2613|      0|    pn_modified(transport->connection, &transport->connection->endpoint, false);
 2614|      0|  }
 2615|       |
 2616|   218k|  return 0;
 2617|   218k|}
transport.c:pni_phase:
 2578|  2.39M|{
 2579|  2.39M|  pn_connection_t *conn = transport->connection;
 2580|  2.39M|  pn_endpoint_t *endpoint = conn->transport_head;
 2581|  3.63M|  while (endpoint)
  ------------------
  |  Branch (2581:10): [True: 1.24M, False: 2.39M]
  ------------------
 2582|  1.24M|  {
 2583|  1.24M|    pn_endpoint_t *next = endpoint->transport_next;
 2584|  1.24M|    int err = phase(transport, endpoint);
 2585|  1.24M|    if (err) return err;
  ------------------
  |  Branch (2585:9): [True: 0, False: 1.24M]
  ------------------
 2586|  1.24M|    endpoint = next;
 2587|  1.24M|  }
 2588|  2.39M|  return 0;
 2589|  2.39M|}
transport.c:pni_process_conn_setup:
 1915|   120k|{
 1916|   120k|  if (endpoint->type == CONNECTION)
  ------------------
  |  Branch (1916:7): [True: 50.8k, False: 69.2k]
  ------------------
 1917|  50.8k|  {
 1918|  50.8k|    if (!(endpoint->state & PN_LOCAL_UNINIT) && !transport->open_sent)
  ------------------
  |  |   50|  50.8k|#define PN_LOCAL_UNINIT (1)
  ------------------
  |  Branch (1918:9): [True: 50.8k, False: 0]
  |  Branch (1918:49): [True: 34.6k, False: 16.2k]
  ------------------
 1919|  34.6k|    {
 1920|       |      // as per the recommendation in the spec, advertise half our
 1921|       |      // actual timeout to the remote
 1922|  34.6k|      const pn_millis_t idle_timeout = transport->local_idle_timeout
  ------------------
  |  Branch (1922:40): [True: 0, False: 34.6k]
  ------------------
 1923|  34.6k|          ? (transport->local_idle_timeout/2)
 1924|  34.6k|          : 0;
 1925|  34.6k|      pn_connection_t *connection = (pn_connection_t *) endpoint;
 1926|  34.6k|      pn_bytes_t cid = pn_string_bytes(connection->container);
 1927|  34.6k|      if (cid.start==NULL) cid = (pn_bytes_t){.size=0, .start=""};
  ------------------
  |  Branch (1927:11): [True: 0, False: 34.6k]
  ------------------
 1928|  34.6k|      pni_calculate_channel_max(transport);
 1929|  34.6k|      pni_switch_to_raw_multiple(&transport->scratch_space, &connection->offered_capabilities, &connection->offered_capabilities_raw);
 1930|  34.6k|      pni_switch_to_raw_multiple(&transport->scratch_space, &connection->desired_capabilities, &connection->desired_capabilities_raw);
 1931|  34.6k|      pni_switch_to_raw(&transport->scratch_space, &connection->properties, &connection->properties_raw);
 1932|  34.6k|      pn_bytes_t buf = pn_amqp_encode_open(&transport->scratch_space, AMQP_DESC_OPEN,
  ------------------
  |  |  145|  34.6k|#define AMQP_DESC_OPEN ((uint64_t) 16)
  ------------------
 1933|  34.6k|                              cid,
 1934|  34.6k|                              pn_string_bytes(connection->hostname),
 1935|       |                              // TODO: This is messy, because we also have to allow local_max_frame_ to be 0 to mean unlimited
 1936|       |                              // otherwise flow control goes wrong
 1937|  34.6k|                              transport->local_max_frame!=0 && transport->local_max_frame!=AMQP_OPEN_MAX_FRAME_SIZE_DEFAULT,
  ------------------
  |  |   11|  69.2k|#define AMQP_OPEN_MAX_FRAME_SIZE_DEFAULT (4294967295) /* uint */
  ------------------
  |  Branch (1937:31): [True: 34.6k, False: 0]
  |  Branch (1937:64): [True: 34.6k, False: 0]
  ------------------
 1938|  34.6k|                              transport->local_max_frame,
 1939|  34.6k|                              transport->channel_max!=AMQP_OPEN_CHANNEL_MAX_DEFAULT, transport->channel_max,
  ------------------
  |  |   13|  34.6k|#define AMQP_OPEN_CHANNEL_MAX_DEFAULT (65535) /* ushort */
  ------------------
 1940|  34.6k|                              (bool)idle_timeout, idle_timeout,
 1941|  34.6k|                              connection->offered_capabilities_raw,
 1942|  34.6k|                              connection->desired_capabilities_raw,
 1943|  34.6k|                              connection->properties_raw);
 1944|  34.6k|      int err = pn_framing_send_amqp(transport, 0, buf);
 1945|  34.6k|      if (err) return err;
  ------------------
  |  Branch (1945:11): [True: 0, False: 34.6k]
  ------------------
 1946|  34.6k|      transport->open_sent = true;
 1947|  34.6k|    }
 1948|  50.8k|  }
 1949|       |
 1950|   120k|  return 0;
 1951|   120k|}
transport.c:pni_process_ssn_setup:
 2019|   120k|{
 2020|   120k|  if (endpoint->type == SESSION && transport->open_sent)
  ------------------
  |  Branch (2020:7): [True: 34.6k, False: 85.4k]
  |  Branch (2020:36): [True: 34.6k, False: 0]
  ------------------
 2021|  34.6k|  {
 2022|  34.6k|    pn_session_t *ssn = (pn_session_t *) endpoint;
 2023|  34.6k|    pn_session_state_t *state = &ssn->state;
 2024|  34.6k|    if (!(endpoint->state & PN_LOCAL_UNINIT) && state->local_channel == (uint16_t) -1)
  ------------------
  |  |   50|  34.6k|#define PN_LOCAL_UNINIT (1)
  ------------------
  |  Branch (2024:9): [True: 34.6k, False: 0]
  |  Branch (2024:49): [True: 34.6k, False: 0]
  ------------------
 2025|  34.6k|    {
 2026|  34.6k|      if (! pni_map_local_channel(ssn)) {
  ------------------
  |  Branch (2026:11): [True: 0, False: 34.6k]
  ------------------
 2027|      0|        pn_logger_logf(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_WARNING, "unable to find an open available channel within limit of %u", transport->channel_max );
 2028|      0|        return PN_ERR;
  ------------------
  |  |   49|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
 2029|      0|      }
 2030|  34.6k|      if (ssn->incoming_capacity || ssn->max_incoming_window)
  ------------------
  |  Branch (2030:11): [True: 0, False: 34.6k]
  |  Branch (2030:37): [True: 0, False: 34.6k]
  ------------------
 2031|      0|        pni_session_update_incoming_lwm(ssn);
 2032|  34.6k|      state->incoming_window = pni_session_incoming_window(ssn);
 2033|  34.6k|      state->outgoing_window = pni_session_outgoing_window(ssn);
 2034|       |      /* "DL[?HIIII]" */
 2035|  34.6k|      pn_bytes_t buf = pn_amqp_encode_begin(&transport->scratch_space, AMQP_DESC_BEGIN,
  ------------------
  |  |  147|  34.6k|#define AMQP_DESC_BEGIN ((uint64_t) 17)
  ------------------
 2036|  34.6k|                    ((int16_t) state->remote_channel >= 0), state->remote_channel,
 2037|  34.6k|                    state->outgoing_transfer_count,
 2038|  34.6k|                    state->incoming_window,
 2039|  34.6k|                    state->outgoing_window,
 2040|  34.6k|                    ssn->local_handle_max);
 2041|  34.6k|      pn_framing_send_amqp(transport, state->local_channel, buf);
 2042|  34.6k|    }
 2043|  34.6k|  }
 2044|       |
 2045|   120k|  return 0;
 2046|   120k|}
transport.c:pni_map_local_channel:
 2004|  34.6k|{
 2005|  34.6k|  pn_transport_t *transport = ssn->connection->transport;
 2006|  34.6k|  pn_session_state_t *state = &ssn->state;
 2007|  34.6k|  int valid;
 2008|  34.6k|  uint16_t channel = allocate_alias(transport->local_channels, transport->channel_max, & valid);
 2009|  34.6k|  if (!valid) {
  ------------------
  |  Branch (2009:7): [True: 0, False: 34.6k]
  ------------------
 2010|      0|    return 0;
 2011|      0|  }
 2012|  34.6k|  state->local_channel = channel;
 2013|  34.6k|  pn_hash_put(transport->local_channels, channel, ssn);
 2014|  34.6k|  pn_ep_incref(&ssn->endpoint);
 2015|  34.6k|  return 1;
 2016|  34.6k|}
transport.c:allocate_alias:
 1954|  69.2k|{
 1955|  69.2k|  for (uint32_t i = 0; i <= max_index; i++) {
  ------------------
  |  Branch (1955:24): [True: 69.2k, False: 0]
  ------------------
 1956|  69.2k|    if (!pn_hash_get(aliases, i)) {
  ------------------
  |  Branch (1956:9): [True: 69.2k, False: 0]
  ------------------
 1957|  69.2k|      * valid = 1;
 1958|  69.2k|      return i;
 1959|  69.2k|    }
 1960|  69.2k|  }
 1961|       |
 1962|      0|  * valid = 0;
 1963|      0|  return 0;
 1964|  69.2k|}
transport.c:pni_session_incoming_window:
 1973|  69.2k|{
 1974|  69.2k|  pn_transport_t *t = ssn->connection->transport;
 1975|  69.2k|  uint32_t size = t->local_max_frame;
 1976|  69.2k|  size_t capacity = ssn->incoming_capacity;
 1977|  69.2k|  if (!size || (!capacity && !ssn->max_incoming_window)) {     /* session flow control is not enabled */
  ------------------
  |  Branch (1977:7): [True: 0, False: 69.2k]
  |  Branch (1977:17): [True: 69.2k, False: 0]
  |  Branch (1977:30): [True: 69.2k, False: 0]
  ------------------
 1978|  69.2k|    return AMQP_MAX_WINDOW_SIZE;
  ------------------
  |  |   35|  69.2k|#define AMQP_MAX_WINDOW_SIZE (2147483647)
  ------------------
 1979|  69.2k|  }
 1980|       |  // Calculate depending on whether application specified capacity or a frame count.
 1981|  69.2k|  assert(capacity || ssn->max_incoming_window);
 1982|      0|  if (capacity) {
  ------------------
  |  Branch (1982:7): [True: 0, False: 0]
  ------------------
 1983|       |    // Old API
 1984|      0|    if (capacity >= size) { /* precondition */
  ------------------
  |  Branch (1984:9): [True: 0, False: 0]
  ------------------
 1985|      0|      return capacity > ssn->incoming_bytes ? (pn_frame_count_t) (capacity - ssn->incoming_bytes) / size : 0;
  ------------------
  |  Branch (1985:14): [True: 0, False: 0]
  ------------------
 1986|      0|    } else {                     /* error: we will never have a non-zero window */
 1987|      0|      pn_condition_format(
 1988|      0|                          pn_transport_condition(t),
 1989|      0|                          "amqp:internal-error",
 1990|      0|                          "session capacity %zu is less than frame size %" PRIu32,
 1991|      0|                          capacity, size);
 1992|      0|      pn_transport_close_tail(t);
 1993|      0|      return 0;
 1994|      0|    }
 1995|      0|  } else {
 1996|       |    // New API
 1997|       |    // Find smallest number of frames that could have sent the buffered bytes.
 1998|      0|    pn_frame_count_t nominal_fc = (ssn->incoming_bytes + size - 1) / size;
 1999|      0|    return nominal_fc >= ssn->max_incoming_window ? 0 : ssn->max_incoming_window - nominal_fc;
  ------------------
  |  Branch (1999:12): [True: 0, False: 0]
  ------------------
 2000|      0|  }
 2001|      0|}
transport.c:pni_session_outgoing_window:
 1967|  69.2k|{
 1968|  69.2k|  return ssn->outgoing_window;
 1969|  69.2k|}
transport.c:pni_process_link_setup:
 2079|   120k|{
 2080|   120k|  if (transport->open_sent && (endpoint->type == SENDER ||
  ------------------
  |  Branch (2080:7): [True: 120k, False: 0]
  |  Branch (2080:32): [True: 0, False: 120k]
  ------------------
 2081|   120k|                               endpoint->type == RECEIVER))
  ------------------
  |  Branch (2081:32): [True: 34.6k, False: 85.4k]
  ------------------
 2082|  34.6k|  {
 2083|  34.6k|    pn_link_t *link = (pn_link_t *) endpoint;
 2084|  34.6k|    pn_session_state_t *ssn_state = &link->session->state;
 2085|  34.6k|    pn_link_state_t *state = &link->state;
 2086|  34.6k|    if (((int16_t) ssn_state->local_channel >= 0) &&
  ------------------
  |  Branch (2086:9): [True: 34.6k, False: 0]
  ------------------
 2087|  34.6k|        !(endpoint->state & PN_LOCAL_UNINIT) && state->local_handle == (uint32_t) -1)
  ------------------
  |  |   50|  34.6k|#define PN_LOCAL_UNINIT (1)
  ------------------
  |  Branch (2087:9): [True: 34.6k, False: 0]
  |  Branch (2087:49): [True: 34.6k, False: 0]
  ------------------
 2088|  34.6k|    {
 2089|  34.6k|      if (! pni_map_local_handle(link)) {
  ------------------
  |  Branch (2089:11): [True: 0, False: 34.6k]
  ------------------
 2090|      0|        pn_logger_logf(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_WARNING, "unable to find an open available handle within limit of %u", ssn_state->remote_handle_max );
 2091|      0|        return PN_ERR;
  ------------------
  |  |   49|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
 2092|      0|      }
 2093|  34.6k|      const pn_distribution_mode_t dist_mode = (pn_distribution_mode_t) link->source.distribution_mode;
 2094|       |      // Until we encode directly from the raw
 2095|  34.6k|      pni_switch_to_raw(&transport->scratch_space, &link->source.properties, &link->source.properties_raw);
 2096|  34.6k|      pni_switch_to_raw(&transport->scratch_space, &link->source.filter, &link->source.filter_raw);
 2097|  34.6k|      pni_switch_to_raw_multiple(&transport->scratch_space, &link->source.outcomes, &link->source.outcomes_raw);
 2098|  34.6k|      pni_switch_to_raw_multiple(&transport->scratch_space, &link->source.capabilities, &link->source.capabilities_raw);
 2099|  34.6k|      pni_switch_to_raw_multiple(&transport->scratch_space, &link->target.capabilities, &link->target.capabilities_raw);
 2100|  34.6k|      if (link->target.type == PN_COORDINATOR) {
  ------------------
  |  Branch (2100:11): [True: 0, False: 34.6k]
  ------------------
 2101|      0|        pn_bytes_t buf = pn_amqp_encode_attach_coordinator(&transport->scratch_space, AMQP_DESC_ATTACH,
  ------------------
  |  |  149|      0|#define AMQP_DESC_ATTACH ((uint64_t) 18)
  ------------------
 2102|      0|                                pn_string_bytes(link->name),
 2103|      0|                                state->local_handle,
 2104|      0|                                endpoint->type == RECEIVER,
 2105|      0|                                link->snd_settle_mode,
 2106|      0|                                link->rcv_settle_mode,
 2107|      0|                                (bool) link->source.type, AMQP_DESC_SOURCE,
  ------------------
  |  |  179|      0|#define AMQP_DESC_SOURCE ((uint64_t) 40)
  ------------------
 2108|      0|                                pn_string_bytes(link->source.address),
 2109|      0|                                link->source.durability,
 2110|      0|                                expiry_symbol(&link->source),
 2111|      0|                                link->source.timeout,
 2112|      0|                                link->source.dynamic,
 2113|      0|                                link->source.properties_raw,
 2114|      0|                                (dist_mode != PN_DIST_MODE_UNSPECIFIED), dist_mode2symbol(dist_mode),
 2115|      0|                                link->source.filter_raw,
 2116|      0|                                link->source.outcomes_raw,
 2117|      0|                                link->source.capabilities_raw,
 2118|      0|                                AMQP_DESC_COORDINATOR, link->target.capabilities_raw,
  ------------------
  |  |  191|      0|#define AMQP_DESC_COORDINATOR ((uint64_t) 48)
  ------------------
 2119|      0|                                0);
 2120|      0|        int err = pn_framing_send_amqp(transport, ssn_state->local_channel, buf);
 2121|      0|        if (err) return err;
  ------------------
  |  Branch (2121:13): [True: 0, False: 0]
  ------------------
 2122|  34.6k|      } else {
 2123|  34.6k|        pni_switch_to_raw(&transport->scratch_space, &link->properties, &link->properties_raw);
 2124|  34.6k|        pni_switch_to_raw(&transport->scratch_space, &link->target.properties, &link->target.properties_raw);
 2125|  34.6k|        pn_bytes_t buf = pn_amqp_encode_attach(&transport->scratch_space, AMQP_DESC_ATTACH,
  ------------------
  |  |  149|  34.6k|#define AMQP_DESC_ATTACH ((uint64_t) 18)
  ------------------
 2126|  34.6k|                                pn_string_bytes(link->name),
 2127|  34.6k|                                state->local_handle,
 2128|  34.6k|                                endpoint->type == RECEIVER,
 2129|  34.6k|                                link->snd_settle_mode,
 2130|  34.6k|                                link->rcv_settle_mode,
 2131|       |
 2132|  34.6k|                                (bool) link->source.type, AMQP_DESC_SOURCE,
  ------------------
  |  |  179|  34.6k|#define AMQP_DESC_SOURCE ((uint64_t) 40)
  ------------------
 2133|  34.6k|                                pn_string_bytes(link->source.address),
 2134|  34.6k|                                link->source.durability,
 2135|  34.6k|                                expiry_symbol(&link->source),
 2136|  34.6k|                                link->source.timeout,
 2137|  34.6k|                                link->source.dynamic,
 2138|  34.6k|                                link->source.properties_raw,
 2139|  34.6k|                                (dist_mode != PN_DIST_MODE_UNSPECIFIED), dist_mode2symbol(dist_mode),
 2140|  34.6k|                                link->source.filter_raw,
 2141|  34.6k|                                link->source.outcomes_raw,
 2142|  34.6k|                                link->source.capabilities_raw,
 2143|       |
 2144|  34.6k|                                (bool) link->target.type, AMQP_DESC_TARGET,
  ------------------
  |  |  181|  34.6k|#define AMQP_DESC_TARGET ((uint64_t) 41)
  ------------------
 2145|  34.6k|                                pn_string_bytes(link->target.address),
 2146|  34.6k|                                link->target.durability,
 2147|  34.6k|                                expiry_symbol(&link->target),
 2148|  34.6k|                                link->target.timeout,
 2149|  34.6k|                                link->target.dynamic,
 2150|  34.6k|                                link->target.properties_raw,
 2151|  34.6k|                                link->target.capabilities_raw,
 2152|       |
 2153|  34.6k|                                0,
 2154|  34.6k|                                link->max_message_size,
 2155|  34.6k|                                link->properties_raw);
 2156|  34.6k|        int err = pn_framing_send_amqp(transport, ssn_state->local_channel, buf);
 2157|  34.6k|        if (err) return err;
  ------------------
  |  Branch (2157:13): [True: 0, False: 34.6k]
  ------------------
 2158|  34.6k|      }
 2159|  34.6k|    }
 2160|  34.6k|  }
 2161|       |
 2162|   120k|  return 0;
 2163|   120k|}
transport.c:pni_map_local_handle:
 2066|  34.6k|static int pni_map_local_handle(pn_link_t *link) {
 2067|  34.6k|  pn_link_state_t *state = &link->state;
 2068|  34.6k|  pn_session_state_t *ssn_state = &link->session->state;
 2069|  34.6k|  int valid;
 2070|  34.6k|  state->local_handle = allocate_alias(ssn_state->local_handles, ssn_state->remote_handle_max, &valid);
 2071|  34.6k|  if ( !valid )
  ------------------
  |  Branch (2071:8): [True: 0, False: 34.6k]
  ------------------
 2072|      0|    return 0;
 2073|  34.6k|  pn_hash_put(ssn_state->local_handles, state->local_handle, link);
 2074|  34.6k|  pn_ep_incref(&link->endpoint);
 2075|  34.6k|  return 1;
 2076|  34.6k|}
transport.c:expiry_symbol:
 2049|  69.2k|{
 2050|  69.2k|  if (!terminus->has_expiry_policy) return (pn_bytes_t){0, NULL};
  ------------------
  |  Branch (2050:7): [True: 69.2k, False: 0]
  ------------------
 2051|       |
 2052|      0|  switch (terminus->expiry_policy)
  ------------------
  |  Branch (2052:11): [True: 0, False: 0]
  ------------------
 2053|      0|  {
 2054|      0|  case PN_EXPIRE_WITH_LINK:
  ------------------
  |  Branch (2054:3): [True: 0, False: 0]
  ------------------
 2055|      0|    return PN_BYTES_LITERAL(link-detach);
  ------------------
  |  |  211|      0|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
 2056|      0|  case PN_EXPIRE_WITH_SESSION:
  ------------------
  |  Branch (2056:3): [True: 0, False: 0]
  ------------------
 2057|      0|    return PN_BYTES_LITERAL(session-end);
  ------------------
  |  |  211|      0|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
 2058|      0|  case PN_EXPIRE_WITH_CONNECTION:
  ------------------
  |  Branch (2058:3): [True: 0, False: 0]
  ------------------
 2059|      0|    return PN_BYTES_LITERAL(connection-close);
  ------------------
  |  |  211|      0|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
 2060|      0|  case PN_EXPIRE_NEVER:
  ------------------
  |  Branch (2060:3): [True: 0, False: 0]
  ------------------
 2061|      0|    return PN_BYTES_LITERAL(never);
  ------------------
  |  |  211|      0|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
 2062|      0|  }
 2063|      0|  return (pn_bytes_t){0, NULL};
 2064|      0|}
transport.c:dist_mode2symbol:
 1190|  34.6k|{
 1191|  34.6k|  switch (mode)
 1192|  34.6k|  {
 1193|      0|  case PN_DIST_MODE_COPY:
  ------------------
  |  Branch (1193:3): [True: 0, False: 34.6k]
  ------------------
 1194|      0|    return PN_BYTES_LITERAL(copy);
  ------------------
  |  |  211|      0|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
 1195|      0|  case PN_DIST_MODE_MOVE:
  ------------------
  |  Branch (1195:3): [True: 0, False: 34.6k]
  ------------------
 1196|      0|    return PN_BYTES_LITERAL(move);
  ------------------
  |  |  211|      0|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
 1197|  34.6k|  default:
  ------------------
  |  Branch (1197:3): [True: 34.6k, False: 0]
  ------------------
 1198|       |    return (pn_bytes_t){0, NULL};
 1199|  34.6k|  }
 1200|  34.6k|}
transport.c:pni_process_flow_receiver:
 2198|   120k|{
 2199|   120k|  if (endpoint->type == RECEIVER && endpoint->state & PN_LOCAL_ACTIVE)
  ------------------
  |  |   55|  34.6k|#define PN_LOCAL_ACTIVE (2)
  ------------------
  |  Branch (2199:7): [True: 34.6k, False: 85.4k]
  |  Branch (2199:37): [True: 34.6k, False: 0]
  ------------------
 2200|  34.6k|  {
 2201|  34.6k|    pn_link_t *rcv = (pn_link_t *) endpoint;
 2202|  34.6k|    pn_session_t *ssn = rcv->session;
 2203|  34.6k|    pn_link_state_t *state = &rcv->state;
 2204|  34.6k|    if ((int16_t) ssn->state.local_channel >= 0 &&
  ------------------
  |  Branch (2204:9): [True: 34.6k, False: 0]
  ------------------
 2205|  34.6k|        (int32_t) state->local_handle >= 0 &&
  ------------------
  |  Branch (2205:9): [True: 34.6k, False: 0]
  ------------------
 2206|  34.6k|        ((rcv->drain || state->link_credit != rcv->credit - rcv->queued) || pni_session_need_flow(ssn))) {
  ------------------
  |  Branch (2206:11): [True: 0, False: 34.6k]
  |  Branch (2206:25): [True: 34.6k, False: 0]
  |  Branch (2206:77): [True: 0, False: 0]
  ------------------
 2207|  34.6k|      state->link_credit = rcv->credit - rcv->queued;
 2208|  34.6k|      return pni_post_flow(transport, ssn, rcv);
 2209|  34.6k|    }
 2210|  34.6k|  }
 2211|       |
 2212|  85.4k|  return 0;
 2213|   120k|}
transport.c:pni_session_need_flow:
 2186|  63.9k|static inline bool pni_session_need_flow(pn_session_t *ssn) {
 2187|  63.9k|  if (ssn->need_flow)
  ------------------
  |  Branch (2187:7): [True: 0, False: 63.9k]
  ------------------
 2188|      0|    return true;
 2189|  63.9k|  if (ssn->check_flow && ssn->state.incoming_window < ssn->incoming_window_lwm &&
  ------------------
  |  Branch (2189:7): [True: 0, False: 63.9k]
  |  Branch (2189:26): [True: 0, False: 0]
  ------------------
 2190|      0|      pni_session_incoming_window(ssn) > ssn->state.incoming_window)
  ------------------
  |  Branch (2190:7): [True: 0, False: 0]
  ------------------
 2191|      0|    return true;
 2192|       |
 2193|  63.9k|  ssn->check_flow = false;
 2194|       |  return false;
 2195|  63.9k|}
transport.c:pni_post_flow:
 2166|  34.6k|{
 2167|  34.6k|  ssn->check_flow = false;
 2168|  34.6k|  ssn->need_flow = false;
 2169|  34.6k|  ssn->state.incoming_window = pni_session_incoming_window(ssn);
 2170|  34.6k|  ssn->state.outgoing_window = pni_session_outgoing_window(ssn);
 2171|  34.6k|  bool linkq = (bool) link;
 2172|  34.6k|  pn_link_state_t *state = linkq ? &link->state : NULL;
  ------------------
  |  Branch (2172:28): [True: 34.6k, False: 0]
  ------------------
 2173|       |  /* "DL[?IIII?I?I?In?o]" */
 2174|  34.6k|  pn_bytes_t buf = pn_amqp_encode_flow(&transport->scratch_space, AMQP_DESC_FLOW,
  ------------------
  |  |  151|  34.6k|#define AMQP_DESC_FLOW ((uint64_t) 19)
  ------------------
 2175|  34.6k|                       (int16_t) ssn->state.remote_channel >= 0, ssn->state.incoming_transfer_count,
 2176|  34.6k|                       ssn->state.incoming_window,
 2177|  34.6k|                       ssn->state.outgoing_transfer_count,
 2178|  34.6k|                       ssn->state.outgoing_window,
 2179|  34.6k|                       linkq, linkq ? state->local_handle : 0,
  ------------------
  |  Branch (2179:31): [True: 34.6k, False: 0]
  ------------------
 2180|  34.6k|                       linkq, linkq ? state->delivery_count : 0,
  ------------------
  |  Branch (2180:31): [True: 34.6k, False: 0]
  ------------------
 2181|  34.6k|                       linkq, linkq ? state->link_credit : 0,
  ------------------
  |  Branch (2181:31): [True: 34.6k, False: 0]
  ------------------
 2182|  34.6k|                       linkq, linkq ? link->drain : false);
  ------------------
  |  Branch (2182:31): [True: 34.6k, False: 0]
  ------------------
 2183|  34.6k|  return pn_framing_send_amqp(transport, ssn->state.local_channel, buf);
 2184|  34.6k|}
transport.c:pni_process_tpwork:
 2381|   244k|{
 2382|   244k|  if (endpoint->type == CONNECTION && !transport->close_sent)
  ------------------
  |  Branch (2382:7): [True: 101k, False: 143k]
  |  Branch (2382:39): [True: 101k, False: 0]
  ------------------
 2383|   101k|  {
 2384|   101k|    pn_connection_t *conn = (pn_connection_t *) endpoint;
 2385|   101k|    pn_delivery_t *delivery = conn->tpwork_head;
 2386|   165k|    while (delivery)
  ------------------
  |  Branch (2386:12): [True: 63.9k, False: 101k]
  ------------------
 2387|  63.9k|    {
 2388|  63.9k|      pn_delivery_t *tp_next = delivery->tpwork_next;
 2389|  63.9k|      bool settle = false;
 2390|       |
 2391|  63.9k|      pn_link_t *link = delivery->link;
 2392|  63.9k|      pn_delivery_map_t *dm = NULL;
 2393|  63.9k|      if (pn_link_is_sender(link)) {
  ------------------
  |  Branch (2393:11): [True: 0, False: 63.9k]
  ------------------
 2394|      0|        dm = &link->session->state.outgoing;
 2395|      0|        int err = pni_process_tpwork_sender(transport, delivery, &settle);
 2396|      0|        if (err) return err;
  ------------------
  |  Branch (2396:13): [True: 0, False: 0]
  ------------------
 2397|  63.9k|      } else {
 2398|  63.9k|        dm = &link->session->state.incoming;
 2399|  63.9k|        int err = pni_process_tpwork_receiver(transport, delivery, &settle);
 2400|  63.9k|        if (err) return err;
  ------------------
  |  Branch (2400:13): [True: 0, False: 63.9k]
  ------------------
 2401|  63.9k|      }
 2402|       |
 2403|  63.9k|      if (settle) {
  ------------------
  |  Branch (2403:11): [True: 63.9k, False: 0]
  ------------------
 2404|  63.9k|        pn_full_settle(dm, delivery);
 2405|  63.9k|      } else if (!pn_delivery_buffered(delivery)) {
  ------------------
  |  Branch (2405:18): [True: 0, False: 0]
  ------------------
 2406|      0|        pn_clear_tpwork(delivery);
 2407|      0|      }
 2408|       |
 2409|  63.9k|      delivery = tp_next;
 2410|  63.9k|    }
 2411|   101k|  }
 2412|       |
 2413|   244k|  return 0;
 2414|   244k|}
transport.c:pni_post_disp:
 2240|  5.54k|{
 2241|  5.54k|  pn_link_t *link = delivery->link;
 2242|  5.54k|  pn_session_t *ssn = link->session;
 2243|  5.54k|  pn_session_state_t *ssn_state = &ssn->state;
 2244|  5.54k|  pn_modified(transport->connection, &link->session->endpoint, false);
 2245|  5.54k|  pn_delivery_state_t *state = &delivery->state;
 2246|  5.54k|  assert(state->init);
 2247|  5.54k|  bool role = (link->endpoint.type == RECEIVER);
 2248|  5.54k|  uint64_t code = delivery->local.type;
 2249|       |
 2250|  5.54k|  if (!code && !delivery->local.settled) {
  ------------------
  |  Branch (2250:7): [True: 0, False: 5.54k]
  |  Branch (2250:16): [True: 0, False: 0]
  ------------------
 2251|      0|    return 0;
 2252|      0|  }
 2253|       |
 2254|  5.54k|  if (!pni_disposition_batchable(&delivery->local)) {
  ------------------
  |  Branch (2254:7): [True: 0, False: 5.54k]
  ------------------
 2255|      0|    pn_bytes_t buf = pn_amqp_encode_disposition(&transport->scratch_space, AMQP_DESC_DISPOSITION,
  ------------------
  |  |  155|      0|#define AMQP_DESC_DISPOSITION ((uint64_t) 21)
  ------------------
 2256|      0|      role, state->id,
 2257|      0|      delivery->local.settled, delivery->local.settled,
 2258|      0|      &delivery->local);
 2259|      0|    return pn_framing_send_amqp(transport, ssn->state.local_channel, buf);
 2260|      0|  }
 2261|       |
 2262|  5.54k|  if (ssn_state->disp && code == ssn_state->disp_code &&
  ------------------
  |  Branch (2262:7): [True: 792, False: 4.75k]
  |  Branch (2262:26): [True: 792, False: 0]
  ------------------
 2263|    792|      delivery->local.settled == ssn_state->disp_settled &&
  ------------------
  |  Branch (2263:7): [True: 792, False: 0]
  ------------------
 2264|    792|      ssn_state->disp_type == role) {
  ------------------
  |  Branch (2264:7): [True: 792, False: 0]
  ------------------
 2265|    792|    if (state->id == ssn_state->disp_first - 1) {
  ------------------
  |  Branch (2265:9): [True: 0, False: 792]
  ------------------
 2266|      0|      ssn_state->disp_first = state->id;
 2267|      0|      return 0;
 2268|    792|    } else if (state->id == ssn_state->disp_last + 1) {
  ------------------
  |  Branch (2268:16): [True: 780, False: 12]
  ------------------
 2269|    780|      ssn_state->disp_last = state->id;
 2270|    780|      return 0;
 2271|    780|    }
 2272|    792|  }
 2273|       |
 2274|  4.76k|  if (ssn_state->disp) {
  ------------------
  |  Branch (2274:7): [True: 12, False: 4.75k]
  ------------------
 2275|     12|    int err = pni_flush_disp(transport, ssn);
 2276|     12|    if (err) return err;
  ------------------
  |  Branch (2276:9): [True: 0, False: 12]
  ------------------
 2277|     12|  }
 2278|       |
 2279|  4.76k|  ssn_state->disp_type = role;
 2280|  4.76k|  ssn_state->disp_code = code;
 2281|  4.76k|  ssn_state->disp_settled = delivery->local.settled;
 2282|  4.76k|  ssn_state->disp_first = state->id;
 2283|  4.76k|  ssn_state->disp_last = state->id;
 2284|  4.76k|  ssn_state->disp = true;
 2285|       |
 2286|  4.76k|  return 0;
 2287|  4.76k|}
transport.c:pni_flush_disp:
 2216|  39.3k|{
 2217|  39.3k|  uint64_t code = ssn->state.disp_code;
 2218|  39.3k|  bool settled = ssn->state.disp_settled;
 2219|  39.3k|  if (ssn->state.disp) {
  ------------------
  |  Branch (2219:7): [True: 4.76k, False: 34.6k]
  ------------------
 2220|       |    /* "DL[oI?I?o?DL[]]" */
 2221|  4.76k|    pn_bytes_t buf = pn_amqp_encode_disposition_batch(&transport->scratch_space, AMQP_DESC_DISPOSITION,
  ------------------
  |  |  155|  4.76k|#define AMQP_DESC_DISPOSITION ((uint64_t) 21)
  ------------------
 2222|  4.76k|                            ssn->state.disp_type,
 2223|  4.76k|                            ssn->state.disp_first,
 2224|  4.76k|                            ssn->state.disp_last!=ssn->state.disp_first, ssn->state.disp_last,
 2225|  4.76k|                            settled, settled,
 2226|  4.76k|                            (bool)code, code);
 2227|  4.76k|    int err = pn_framing_send_amqp(transport, ssn->state.local_channel, buf);
 2228|  4.76k|    if (err) return err;
  ------------------
  |  Branch (2228:9): [True: 0, False: 4.76k]
  ------------------
 2229|  4.76k|    ssn->state.disp_type = 0;
 2230|  4.76k|    ssn->state.disp_code = 0;
 2231|  4.76k|    ssn->state.disp_settled = 0;
 2232|  4.76k|    ssn->state.disp_first = 0;
 2233|  4.76k|    ssn->state.disp_last = 0;
 2234|  4.76k|    ssn->state.disp = false;
 2235|  4.76k|  }
 2236|  39.3k|  return 0;
 2237|  39.3k|}
transport.c:pni_process_tpwork_receiver:
 2361|  63.9k|{
 2362|  63.9k|  *settle = false;
 2363|  63.9k|  pn_link_t *link = delivery->link;
 2364|       |  // XXX: need to prevent duplicate disposition sending
 2365|  63.9k|  pn_session_t *ssn = link->session;
 2366|  63.9k|  if ((int16_t) ssn->state.local_channel >= 0 && !delivery->remote.settled && delivery->state.init) {
  ------------------
  |  Branch (2366:7): [True: 63.9k, False: 0]
  |  Branch (2366:50): [True: 63.4k, False: 452]
  |  Branch (2366:79): [True: 5.54k, False: 57.9k]
  ------------------
 2367|  5.54k|    int err = pni_post_disp(transport, delivery);
 2368|  5.54k|    if (err) return err;
  ------------------
  |  Branch (2368:9): [True: 0, False: 5.54k]
  ------------------
 2369|  5.54k|  }
 2370|       |
 2371|  63.9k|  if (pni_session_need_flow(ssn)) {
  ------------------
  |  Branch (2371:7): [True: 0, False: 63.9k]
  ------------------
 2372|      0|    int err = pni_post_flow(transport, ssn, link);
 2373|      0|    if (err) return err;
  ------------------
  |  Branch (2373:9): [True: 0, False: 0]
  ------------------
 2374|      0|  }
 2375|       |
 2376|  63.9k|  *settle = delivery->local.settled;
 2377|  63.9k|  return 0;
 2378|  63.9k|}
transport.c:pn_full_settle:
 1352|  63.9k|{
 1353|       |  assert(!delivery->work);
 1354|  63.9k|  pn_clear_tpwork(delivery);
 1355|  63.9k|  pn_delivery_map_del(db, delivery);
 1356|  63.9k|  pn_incref(delivery);
 1357|  63.9k|  pn_decref(delivery);
 1358|  63.9k|}
transport.c:pni_process_flush_disp:
 2417|   124k|{
 2418|   124k|  if (endpoint->type == SESSION) {
  ------------------
  |  Branch (2418:7): [True: 39.3k, False: 85.4k]
  ------------------
 2419|  39.3k|    pn_session_t *session = (pn_session_t *) endpoint;
 2420|  39.3k|    pn_session_state_t *state = &session->state;
 2421|  39.3k|    if ((int16_t) state->local_channel >= 0 && !transport->close_sent)
  ------------------
  |  Branch (2421:9): [True: 39.3k, False: 0]
  |  Branch (2421:48): [True: 39.3k, False: 0]
  ------------------
 2422|  39.3k|    {
 2423|  39.3k|      int err = pni_flush_disp(transport, session);
 2424|  39.3k|      if (err) return err;
  ------------------
  |  Branch (2424:11): [True: 0, False: 39.3k]
  ------------------
 2425|  39.3k|      if (session->need_flow) {
  ------------------
  |  Branch (2425:11): [True: 0, False: 39.3k]
  ------------------
 2426|      0|        err = pni_post_flow(transport, session, NULL);
 2427|      0|        if (err) return err;
  ------------------
  |  Branch (2427:13): [True: 0, False: 0]
  ------------------
 2428|      0|      }
 2429|  39.3k|    }
 2430|  39.3k|  }
 2431|       |
 2432|   124k|  return 0;
 2433|   124k|}
transport.c:pni_process_flow_sender:
 2436|   124k|{
 2437|   124k|  if (endpoint->type == SENDER && endpoint->state & PN_LOCAL_ACTIVE)
  ------------------
  |  |   55|      0|#define PN_LOCAL_ACTIVE (2)
  ------------------
  |  Branch (2437:7): [True: 0, False: 124k]
  |  Branch (2437:35): [True: 0, False: 0]
  ------------------
 2438|      0|  {
 2439|      0|    pn_link_t *snd = (pn_link_t *) endpoint;
 2440|      0|    pn_session_t *ssn = snd->session;
 2441|      0|    pn_link_state_t *state = &snd->state;
 2442|      0|    if ((int16_t) ssn->state.local_channel >= 0 &&
  ------------------
  |  Branch (2442:9): [True: 0, False: 0]
  ------------------
 2443|      0|        (int32_t) state->local_handle >= 0 &&
  ------------------
  |  Branch (2443:9): [True: 0, False: 0]
  ------------------
 2444|      0|        snd->drain && snd->drained) {
  ------------------
  |  Branch (2444:9): [True: 0, False: 0]
  |  Branch (2444:23): [True: 0, False: 0]
  ------------------
 2445|      0|      pn_delivery_t *tail = snd->unsettled_tail;
 2446|      0|      if (!tail || !pn_delivery_buffered(tail)) {
  ------------------
  |  Branch (2446:11): [True: 0, False: 0]
  |  Branch (2446:20): [True: 0, False: 0]
  ------------------
 2447|      0|        state->delivery_count += state->link_credit;
 2448|      0|        state->link_credit = 0;
 2449|      0|        snd->drained = 0;
 2450|      0|        return pni_post_flow(transport, ssn, snd);
 2451|      0|      }
 2452|      0|    }
 2453|      0|  }
 2454|       |
 2455|   124k|  return 0;
 2456|   124k|}
transport.c:pni_process_link_teardown:
 2470|   124k|{
 2471|   124k|  if (endpoint->type == SENDER || endpoint->type == RECEIVER)
  ------------------
  |  Branch (2471:7): [True: 0, False: 124k]
  |  Branch (2471:35): [True: 34.6k, False: 90.2k]
  ------------------
 2472|  34.6k|  {
 2473|  34.6k|    pn_link_t *link = (pn_link_t *) endpoint;
 2474|  34.6k|    pn_session_t *session = link->session;
 2475|  34.6k|    pn_session_state_t *ssn_state = &session->state;
 2476|  34.6k|    pn_link_state_t *state = &link->state;
 2477|  34.6k|    if (((endpoint->state & PN_LOCAL_CLOSED) || link->detached) && (int32_t) state->local_handle >= 0 &&
  ------------------
  |  |   60|  34.6k|#define PN_LOCAL_CLOSED (4)
  ------------------
  |  Branch (2477:10): [True: 0, False: 34.6k]
  |  Branch (2477:49): [True: 0, False: 34.6k]
  |  Branch (2477:68): [True: 0, False: 0]
  ------------------
 2478|      0|        (int16_t) ssn_state->local_channel >= 0 && !transport->close_sent) {
  ------------------
  |  Branch (2478:9): [True: 0, False: 0]
  |  Branch (2478:52): [True: 0, False: 0]
  ------------------
 2479|      0|      if (pn_link_is_sender(link) && pn_link_queued(link) &&
  ------------------
  |  Branch (2479:11): [True: 0, False: 0]
  |  Branch (2479:38): [True: 0, False: 0]
  ------------------
 2480|      0|          (int32_t) state->remote_handle != -2 &&
  ------------------
  |  Branch (2480:11): [True: 0, False: 0]
  ------------------
 2481|      0|          (int16_t) ssn_state->remote_channel != -2 &&
  ------------------
  |  Branch (2481:11): [True: 0, False: 0]
  ------------------
 2482|      0|          !transport->close_rcvd) return 0;
  ------------------
  |  Branch (2482:11): [True: 0, False: 0]
  ------------------
 2483|       |
 2484|      0|      pn_bytes_t buf = pn_amqp_encode_detach(&transport->scratch_space, AMQP_DESC_DETACH,
  ------------------
  |  |  157|      0|#define AMQP_DESC_DETACH ((uint64_t) 22)
  ------------------
 2485|      0|                                               state->local_handle,
 2486|      0|                                               !link->detached, !link->detached,
 2487|      0|                                               &endpoint->condition);
 2488|      0|      int err = pn_framing_send_amqp(transport, ssn_state->local_channel, buf);
 2489|      0|      if (err) return err;
  ------------------
  |  Branch (2489:11): [True: 0, False: 0]
  ------------------
 2490|      0|      pni_unmap_local_handle(link);
 2491|      0|    }
 2492|       |
 2493|  34.6k|    pn_clear_modified(transport->connection, endpoint);
 2494|  34.6k|  }
 2495|       |
 2496|   124k|  return 0;
 2497|   124k|}
transport.c:pni_process_ssn_teardown:
 2538|  90.2k|{
 2539|  90.2k|  if (endpoint->type == SESSION)
  ------------------
  |  Branch (2539:7): [True: 39.3k, False: 50.8k]
  ------------------
 2540|  39.3k|  {
 2541|  39.3k|    pn_session_t *session = (pn_session_t *) endpoint;
 2542|  39.3k|    pn_session_state_t *state = &session->state;
 2543|  39.3k|    if (endpoint->state & PN_LOCAL_CLOSED && (int16_t) state->local_channel >= 0
  ------------------
  |  |   60|  78.7k|#define PN_LOCAL_CLOSED (4)
  ------------------
  |  Branch (2543:9): [True: 0, False: 39.3k]
  |  Branch (2543:46): [True: 0, False: 0]
  ------------------
 2544|      0|        && !transport->close_sent)
  ------------------
  |  Branch (2544:12): [True: 0, False: 0]
  ------------------
 2545|      0|    {
 2546|      0|      if (pni_pointful_buffering(transport, session)) {
  ------------------
  |  Branch (2546:11): [True: 0, False: 0]
  ------------------
 2547|      0|        return 0;
 2548|      0|      }
 2549|       |
 2550|      0|      pn_bytes_t buf = pn_amqp_encode_close(&transport->scratch_space, AMQP_DESC_END, &endpoint->condition);
  ------------------
  |  |  159|      0|#define AMQP_DESC_END ((uint64_t) 23)
  ------------------
 2551|      0|      int err = pn_framing_send_amqp(transport, state->local_channel, buf);
 2552|      0|      if (err) return err;
  ------------------
  |  Branch (2552:11): [True: 0, False: 0]
  ------------------
 2553|      0|      pni_unmap_local_channel(session);
 2554|      0|    }
 2555|       |
 2556|  39.3k|    pn_clear_modified(transport->connection, endpoint);
 2557|  39.3k|  }
 2558|  90.2k|  return 0;
 2559|  90.2k|}
transport.c:pni_pointful_buffering:
 2500|  15.2k|{
 2501|  15.2k|  if (transport->close_rcvd) return false;
  ------------------
  |  Branch (2501:7): [True: 729, False: 14.4k]
  ------------------
 2502|  14.4k|  if (!transport->open_rcvd) return true;
  ------------------
  |  Branch (2502:7): [True: 14.2k, False: 252]
  ------------------
 2503|       |
 2504|    252|  pn_connection_t *conn = transport->connection;
 2505|    252|  pn_link_t *link = pn_link_head(conn, 0);
 2506|  34.2k|  while (link) {
  ------------------
  |  Branch (2506:10): [True: 34.0k, False: 252]
  ------------------
 2507|  34.0k|    if (pn_link_is_sender(link) && pn_link_queued(link) > 0) {
  ------------------
  |  Branch (2507:9): [True: 7.44k, False: 26.5k]
  |  Branch (2507:36): [True: 0, False: 7.44k]
  ------------------
 2508|      0|      pn_session_t *ssn = link->session;
 2509|      0|      if (session && session == ssn) {
  ------------------
  |  Branch (2509:11): [True: 0, False: 0]
  |  Branch (2509:22): [True: 0, False: 0]
  ------------------
 2510|      0|        if ((int32_t) link->state.remote_handle != -2 &&
  ------------------
  |  Branch (2510:13): [True: 0, False: 0]
  ------------------
 2511|      0|            (int16_t) session->state.remote_channel != -2) {
  ------------------
  |  Branch (2511:13): [True: 0, False: 0]
  ------------------
 2512|      0|          return true;
 2513|      0|        }
 2514|      0|      }
 2515|      0|    }
 2516|  34.0k|    link = pn_link_next(link, 0);
 2517|  34.0k|  }
 2518|       |
 2519|    252|  return false;
 2520|    252|}
transport.c:pni_process_conn_teardown:
 2562|  50.8k|{
 2563|  50.8k|  if (endpoint->type == CONNECTION)
  ------------------
  |  Branch (2563:7): [True: 50.8k, False: 0]
  ------------------
 2564|  50.8k|  {
 2565|  50.8k|    if (endpoint->state & PN_LOCAL_CLOSED && !transport->close_sent) {
  ------------------
  |  |   60|   101k|#define PN_LOCAL_CLOSED (4)
  ------------------
  |  Branch (2565:9): [True: 15.2k, False: 35.6k]
  |  Branch (2565:46): [True: 15.2k, False: 0]
  ------------------
 2566|  15.2k|      if (pni_pointful_buffering(transport, NULL)) return 0;
  ------------------
  |  Branch (2566:11): [True: 14.2k, False: 981]
  ------------------
 2567|    981|      int err = pni_post_close(transport, NULL);
 2568|    981|      if (err) return err;
  ------------------
  |  Branch (2568:11): [True: 0, False: 981]
  ------------------
 2569|    981|      transport->close_sent = true;
 2570|    981|    }
 2571|       |
 2572|  36.6k|    pn_clear_modified(transport->connection, endpoint);
 2573|  36.6k|  }
 2574|  36.6k|  return 0;
 2575|  50.8k|}
transport.c:transport_produce:
 2787|   297k|{
 2788|   297k|  if (transport->head_closed) return PN_EOS;
  ------------------
  |  |   48|  27.2k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
  |  Branch (2788:7): [True: 27.2k, False: 270k]
  ------------------
 2789|       |
 2790|   270k|  ssize_t space = transport->output_size - transport->output_pending;
 2791|       |
 2792|   270k|  if (space <= 0) {     // can we expand the buffer?
  ------------------
  |  Branch (2792:7): [True: 0, False: 270k]
  ------------------
 2793|      0|    int more = 0;
 2794|      0|    if (!transport->remote_max_frame)   // no limit, so double it
  ------------------
  |  Branch (2794:9): [True: 0, False: 0]
  ------------------
 2795|      0|      more = transport->output_size;
 2796|      0|    else if (transport->remote_max_frame > transport->output_size)
  ------------------
  |  Branch (2796:14): [True: 0, False: 0]
  ------------------
 2797|      0|      more = pn_min(transport->output_size, transport->remote_max_frame - transport->output_size);
  ------------------
  |  |  272|      0|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (272:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2798|      0|    if (more) {
  ------------------
  |  Branch (2798:9): [True: 0, False: 0]
  ------------------
 2799|      0|      char *newbuf = (char *)pni_mem_subreallocate(pn_class(transport), transport, transport->output_buf, transport->output_size + more );
 2800|      0|      if (newbuf) {
  ------------------
  |  Branch (2800:11): [True: 0, False: 0]
  ------------------
 2801|      0|        transport->output_buf = newbuf;
 2802|      0|        transport->output_size += more;
 2803|      0|        space += more;
 2804|      0|      }
 2805|      0|    }
 2806|      0|  }
 2807|       |
 2808|   368k|  while (space > 0) {
  ------------------
  |  Branch (2808:10): [True: 368k, False: 0]
  ------------------
 2809|   368k|    ssize_t n;
 2810|   368k|    n = transport->io_layers[0]->
 2811|   368k|      process_output( transport, 0,
 2812|   368k|                      &transport->output_buf[transport->output_pending],
 2813|   368k|                      space );
 2814|   368k|    if (n > 0) {
  ------------------
  |  Branch (2814:9): [True: 98.3k, False: 270k]
  ------------------
 2815|  98.3k|      space -= n;
 2816|  98.3k|      transport->output_pending += n;
 2817|   270k|    } else if (n == 0) {
  ------------------
  |  Branch (2817:16): [True: 245k, False: 24.6k]
  ------------------
 2818|   245k|      break;
 2819|   245k|    } else {
 2820|  24.6k|      if (transport->output_pending)
  ------------------
  |  Branch (2820:11): [True: 24.3k, False: 342]
  ------------------
 2821|  24.3k|        break;   // return what is available
 2822|    342|      PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP | PN_SUBSYSTEM_IO, PN_LEVEL_FRAME | PN_LEVEL_RAW, "  -> EOS");
  ------------------
  |  |   57|    342|    do { \
  |  |   58|    342|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   54|    342|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:6): [Folded, False: 342]
  |  |  |  |  |  Branch (54:38): [True: 342, False: 0]
  |  |  |  |  |  Branch (54:73): [True: 0, False: 342]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|    342|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   60|    342|    } while(0)
  |  |  ------------------
  |  |  |  Branch (60:13): [Folded, False: 342]
  |  |  ------------------
  ------------------
 2823|    342|      pni_close_head(transport);
 2824|    342|      return n;
 2825|  24.6k|    }
 2826|   368k|  }
 2827|       |
 2828|   270k|  return transport->output_pending;
 2829|   270k|}
transport.c:pni_close_head:
 2776|  34.6k|{
 2777|  34.6k|  if (!transport->head_closed) {
  ------------------
  |  Branch (2777:7): [True: 34.6k, False: 0]
  ------------------
 2778|       |    transport->head_closed = true;
 2779|  34.6k|    pn_collector_t *collector = pni_transport_collector(transport);
 2780|  34.6k|    pn_collector_put_object(collector, transport, PN_TRANSPORT_HEAD_CLOSED);
 2781|  34.6k|    pni_maybe_post_closed(transport);
 2782|  34.6k|  }
 2783|  34.6k|}

pn_quote_data:
   38|  12.4k|{
   39|  12.4k|  int idx = 0;
   40|  45.0k|  for (unsigned i = 0; i < size; i++)
  ------------------
  |  Branch (40:24): [True: 32.7k, False: 12.3k]
  ------------------
   41|  32.7k|  {
   42|  32.7k|    uint8_t c = src[i];
   43|       |    // output printable ASCII, ensure '\' always introduces hex escape, escape quote marks
   44|  32.7k|    if (c < 128 && c != '\\' && c != '\"' && c != '\'' && isprint(c)) {
  ------------------
  |  Branch (44:9): [True: 24.3k, False: 8.36k]
  |  Branch (44:20): [True: 23.7k, False: 630]
  |  Branch (44:33): [True: 23.3k, False: 376]
  |  Branch (44:46): [True: 22.6k, False: 714]
  |  Branch (44:59): [True: 5.76k, False: 16.8k]
  ------------------
   45|  5.76k|      if (idx < (int) (capacity - 1)) {
  ------------------
  |  Branch (45:11): [True: 5.75k, False: 11]
  ------------------
   46|  5.75k|        dst[idx++] = c;
   47|  5.75k|      } else {
   48|     11|        if (idx > 0) {
  ------------------
  |  Branch (48:13): [True: 8, False: 3]
  ------------------
   49|      8|          dst[idx] = '\0';
   50|      8|        }
   51|     11|        return PN_OVERFLOW;
  ------------------
  |  |   50|     11|#define PN_OVERFLOW (-3)       /**< Overflow error */
  ------------------
   52|     11|      }
   53|  26.9k|    } else {
   54|  26.9k|      if (idx < (int) (capacity - 4)) {
  ------------------
  |  Branch (54:11): [True: 26.8k, False: 62]
  ------------------
   55|  26.8k|        idx += sprintf(dst + idx, "\\x%.2x", c);
   56|  26.8k|      } else {
   57|     62|        if (idx > 0) {
  ------------------
  |  Branch (57:13): [True: 30, False: 32]
  ------------------
   58|     30|          dst[idx] = '\0';
   59|     30|        }
   60|     62|        return PN_OVERFLOW;
  ------------------
  |  |   50|     62|#define PN_OVERFLOW (-3)       /**< Overflow error */
  ------------------
   61|     62|      }
   62|  26.9k|    }
   63|  32.7k|  }
   64|       |
   65|  12.3k|  dst[idx] = '\0';
   66|  12.3k|  return idx;
   67|  12.4k|}
pn_strdup:
  120|  2.77k|{
  121|  2.77k|  if (!src) return NULL;
  ------------------
  |  Branch (121:7): [True: 0, False: 2.77k]
  ------------------
  122|  2.77k|  char *dest = (char *) pni_mem_allocate(PN_CLASSCLASS(pn_strdup), strlen(src)+1);
  ------------------
  |  |  102|  2.77k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  123|  2.77k|  if (!dest) return NULL;
  ------------------
  |  Branch (123:7): [True: 0, False: 2.77k]
  ------------------
  124|  2.77k|  return strcpy(dest, src);
  125|  2.77k|}
pn_strndup:
  128|  5.97k|{
  129|  5.97k|  if (src) {
  ------------------
  |  Branch (129:7): [True: 5.97k, False: 0]
  ------------------
  130|  5.97k|    unsigned size = 0;
  131|  9.00k|    for (const char *c = src; size < n && *c; c++) {
  ------------------
  |  Branch (131:31): [True: 4.47k, False: 4.52k]
  |  Branch (131:43): [True: 3.03k, False: 1.44k]
  ------------------
  132|  3.03k|      size++;
  133|  3.03k|    }
  134|       |
  135|  5.97k|    char *dest = (char *) pni_mem_allocate(PN_CLASSCLASS(pn_strdup), size + 1);
  ------------------
  |  |  102|  5.97k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  136|  5.97k|    if (!dest) return NULL;
  ------------------
  |  Branch (136:9): [True: 0, False: 5.97k]
  ------------------
  137|  5.97k|    strncpy(dest, src, pn_min(n, size));
  ------------------
  |  |  272|  5.97k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (272:22): [True: 1.44k, False: 4.52k]
  |  |  ------------------
  ------------------
  138|  5.97k|    dest[size] = '\0';
  139|  5.97k|    return dest;
  140|  5.97k|  } else {
  141|       |    return NULL;
  142|      0|  }
  143|  5.97k|}

string.c:pni_round_up_pow2:
  162|  8.21M|static inline uint32_t pni_round_up_pow2(uint32_t n) {
  163|  8.21M|  n--;
  164|  8.21M|  n |= n >> 1;
  165|  8.21M|  n |= n >> 2;
  166|  8.21M|  n |= n >> 4;
  167|  8.21M|  n |= n >> 8;
  168|  8.21M|  n |= n >> 16;
  169|  8.21M|  return n + 1;
  170|  8.21M|}
engine.c:pn_bytes_free:
   65|  35.4M|static inline void pn_bytes_free(pn_bytes_t in) {
   66|  35.4M|  free((void*)in.start);
   67|  35.4M|}
engine.c:pn_bytes_dup:
   55|  90.5k|static inline pn_bytes_t pn_bytes_dup(pn_bytes_t in) {
   56|  90.5k|  if (in.size) {
  ------------------
  |  Branch (56:7): [True: 90.0k, False: 519]
  ------------------
   57|  90.0k|    char* rbytes = malloc(in.size);
   58|  90.0k|    memcpy(rbytes, in.start, in.size);
   59|  90.0k|    return (pn_bytes_t){in.size, rbytes};
   60|  90.0k|  } else {
   61|       |    return (pn_bytes_t){0, NULL};
   62|    519|  }
   63|  90.5k|}
transport.c:pn_rwbytes_alloc:
   87|  34.6k|static inline pn_rwbytes_t pn_rwbytes_alloc(size_t size) {
   88|  34.6k|  char* space = malloc(size);
   89|  34.6k|  size_t s = space ? size : 0;
  ------------------
  |  Branch (89:14): [True: 34.6k, False: 0]
  ------------------
   90|  34.6k|  return (pn_rwbytes_t){.size=s, .start=space};
   91|  34.6k|}
transport.c:pn_rwbytes_free:
  100|  34.6k|static inline void pn_rwbytes_free(pn_rwbytes_t in) {
  101|  34.6k|  free((void*)in.start);
  102|  34.6k|}
transport.c:pn_bytes_free:
   65|  9.54M|static inline void pn_bytes_free(pn_bytes_t in) {
   66|  9.54M|  free((void*)in.start);
   67|  9.54M|}
transport.c:pn_bytes_dup:
   55|  9.38M|static inline pn_bytes_t pn_bytes_dup(pn_bytes_t in) {
   56|  9.38M|  if (in.size) {
  ------------------
  |  Branch (56:7): [True: 578k, False: 8.80M]
  ------------------
   57|   578k|    char* rbytes = malloc(in.size);
   58|   578k|    memcpy(rbytes, in.start, in.size);
   59|   578k|    return (pn_bytes_t){in.size, rbytes};
   60|  8.80M|  } else {
   61|       |    return (pn_bytes_t){0, NULL};
   62|  8.80M|  }
   63|  9.38M|}
transport.c:pn_bytes_equal:
   51|   311k|static inline bool pn_bytes_equal(const pn_bytes_t a, const pn_bytes_t b) {
   52|   311k|  return (a.size == b.size && !memcmp(a.start, b.start, a.size));
  ------------------
  |  Branch (52:11): [True: 145k, False: 165k]
  |  Branch (52:31): [True: 63.3k, False: 82.5k]
  ------------------
   53|   311k|}
transport.c:pni_switch_to_raw_multiple:
  133|   173k|static inline void pni_switch_to_raw_multiple(pn_rwbytes_t *scratch, pn_data_t **data, pn_bytes_t *bytes) {
  134|   173k|  if (!*data || pn_data_size(*data) == 0) {
  ------------------
  |  Branch (134:7): [True: 173k, False: 0]
  |  Branch (134:17): [True: 0, False: 0]
  ------------------
  135|   173k|    return;
  136|   173k|  }
  137|      0|  pn_data_rewind(*data);
  138|       |  // Rewind and position to first node so data type is defined.
  139|      0|  pn_data_next(*data);
  140|       |
  141|      0|  if (pn_data_type(*data) == PN_ARRAY) {
  ------------------
  |  Branch (141:7): [True: 0, False: 0]
  ------------------
  142|      0|    switch (pn_data_get_array(*data)) {
  143|      0|      case 0:
  ------------------
  |  Branch (143:7): [True: 0, False: 0]
  ------------------
  144|      0|        pn_bytes_free(*bytes);
  145|      0|        *bytes = (pn_bytes_t){0, NULL};
  146|      0|        pn_data_clear(*data);
  147|      0|        break;
  148|      0|      case 1:
  ------------------
  |  Branch (148:7): [True: 0, False: 0]
  ------------------
  149|      0|        pn_data_enter(*data);
  150|      0|        pn_data_narrow(*data);
  151|      0|        pni_switch_to_raw(scratch, data, bytes);
  152|      0|        break;
  153|      0|      default:
  ------------------
  |  Branch (153:7): [True: 0, False: 0]
  ------------------
  154|      0|        pni_switch_to_raw(scratch, data, bytes);
  155|      0|    }
  156|      0|  } else {
  157|      0|    pni_switch_to_raw(scratch, data, bytes);
  158|      0|  }
  159|      0|}
transport.c:pni_switch_to_raw:
  118|   173k|static inline void pni_switch_to_raw(pn_rwbytes_t *scratch, pn_data_t **data, pn_bytes_t *bytes) {
  119|   173k|  if (*data == NULL || pn_data_size(*data)==0) {
  ------------------
  |  Branch (119:7): [True: 173k, False: 0]
  |  Branch (119:24): [True: 0, False: 0]
  ------------------
  120|   173k|    return;
  121|   173k|  }
  122|      0|  ssize_t data_size = 0;
  123|      0|  if (PN_OVERFLOW == (data_size = pn_data_encode(*data, scratch->start, scratch->size))) {
  ------------------
  |  |   50|      0|#define PN_OVERFLOW (-3)       /**< Overflow error */
  ------------------
  |  Branch (123:7): [True: 0, False: 0]
  ------------------
  124|      0|    pn_rwbytes_realloc(scratch, pn_data_encoded_size(*data));
  125|      0|    data_size = pn_data_encode(*data, scratch->start, scratch->size);
  126|      0|  }
  127|       |
  128|      0|  pn_bytes_free(*bytes);
  129|      0|  *bytes = pn_bytes_dup((pn_bytes_t){.size=data_size, .start=scratch->start});
  130|      0|  pn_data_clear(*data);
  131|      0|}
message.c:pn_bytes_free:
   65|   588k|static inline void pn_bytes_free(pn_bytes_t in) {
   66|   588k|  free((void*)in.start);
   67|   588k|}
message.c:pn_bytes_dup:
   55|   292k|static inline pn_bytes_t pn_bytes_dup(pn_bytes_t in) {
   56|   292k|  if (in.size) {
  ------------------
  |  Branch (56:7): [True: 3.26k, False: 289k]
  ------------------
   57|  3.26k|    char* rbytes = malloc(in.size);
   58|  3.26k|    memcpy(rbytes, in.start, in.size);
   59|  3.26k|    return (pn_bytes_t){in.size, rbytes};
   60|   289k|  } else {
   61|       |    return (pn_bytes_t){0, NULL};
   62|   289k|  }
   63|   292k|}
message.c:pni_switch_to_data:
   70|  73.1k|                                       size_t max_nodes) {
   71|  73.1k|  if (*data == NULL) {
  ------------------
  |  Branch (71:7): [True: 73.1k, False: 0]
  ------------------
   72|  73.1k|    *data = pn_data(0);
   73|  73.1k|  }
   74|  73.1k|  if (bytes->start) {
  ------------------
  |  Branch (74:7): [True: 3.07k, False: 70.0k]
  ------------------
   75|  3.07k|    pn_data_clear(*data);
   76|       |    /* Intern buffer capped at bytes->size: the interned bytes must come from
   77|       |       the input bytes so tight 1:1 bound without an artificial ceiling. */
   78|  3.07k|    pn_data_set_decode_limits(*data, max_nodes, bytes->size);
   79|  3.07k|    pn_data_decode(*data, bytes->start, bytes->size);
   80|  3.07k|    pn_data_rewind(*data);
   81|       |
   82|  3.07k|    pn_bytes_free(*bytes);
   83|       |    *bytes = (pn_bytes_t){0, NULL};
   84|  3.07k|  }
   85|  73.1k|}
frame_generators.c:pn_rwbytes_realloc:
   93|     68|static inline pn_rwbytes_t pn_rwbytes_realloc(pn_rwbytes_t *in, size_t size) {
   94|     68|  char* space = realloc(in->start, size);
   95|     68|  size_t s = space ? size : 0;
  ------------------
  |  Branch (95:14): [True: 68, False: 0]
  ------------------
   96|     68|  *in = (pn_rwbytes_t){.size=s, .start=space};
   97|     68|  return *in;
   98|     68|}
buffer.c:pni_round_up_pow2:
  162|  2.71k|static inline uint32_t pni_round_up_pow2(uint32_t n) {
  163|  2.71k|  n--;
  164|  2.71k|  n |= n >> 1;
  165|  2.71k|  n |= n >> 2;
  166|  2.71k|  n |= n >> 4;
  167|  2.71k|  n |= n >> 8;
  168|  2.71k|  n |= n >> 16;
  169|  2.71k|  return n + 1;
  170|  2.71k|}
framing.c:pni_read32:
  195|  3.42M|{
  196|  3.42M|  uint32_t a = pni_read16(bytes);
  197|  3.42M|  uint32_t b = pni_read16(&bytes[2]);
  198|  3.42M|  uint32_t r = a << 16 | b;
  199|  3.42M|  return r;
  200|  3.42M|}
framing.c:pni_read16:
  187|  10.2M|{
  188|  10.2M|  uint16_t a = (uint8_t) bytes[0];
  189|  10.2M|  uint16_t b = (uint8_t) bytes[1];
  190|  10.2M|  uint16_t r = a << 8 | b;
  191|  10.2M|  return r;
  192|  10.2M|}
framing.c:pni_write32:
  179|   167k|{
  180|   167k|  bytes[0] = 0xFF & (value >> 24);
  181|   167k|  bytes[1] = 0xFF & (value >> 16);
  182|   167k|  bytes[2] = 0xFF & (value >>  8);
  183|   167k|  bytes[3] = 0xFF & (value      );
  184|   167k|}
framing.c:pni_write16:
  173|   167k|{
  174|   167k|  bytes[0] = 0xFF & (value >> 8);
  175|   167k|  bytes[1] = 0xFF & (value     );
  176|   167k|}

pn_sasl_free:
  796|  34.6k|{
  797|  34.6k|  if (transport) {
  ------------------
  |  Branch (797:7): [True: 34.6k, False: 0]
  ------------------
  798|  34.6k|    pni_sasl_t *sasl = transport->sasl;
  799|  34.6k|    if (sasl) {
  ------------------
  |  Branch (799:9): [True: 0, False: 34.6k]
  ------------------
  800|      0|      pn_free(sasl->selected_mechanism);
  801|      0|      free(sasl->included_mechanisms);
  802|      0|      free(sasl->password);
  803|      0|      free(sasl->external_auth);
  804|      0|      pn_free(sasl->local_fqdn);
  805|       |
  806|      0|      if (sasl->impl_context) {
  ------------------
  |  Branch (806:11): [True: 0, False: 0]
  ------------------
  807|      0|        pni_sasl_impl_free(transport);
  808|      0|      }
  809|      0|      pn_buffer_free(sasl->decoded_buffer);
  810|      0|      pn_buffer_free(sasl->encoded_buffer);
  811|      0|      free(sasl);
  812|      0|    }
  813|  34.6k|  }
  814|  34.6k|}

pn_ssl_free:
 1020|  34.6k|{
 1021|  34.6k|  pni_ssl_t *ssl = transport->ssl;
 1022|  34.6k|  if (!ssl) return;
  ------------------
  |  Branch (1022:7): [True: 34.6k, False: 0]
  ------------------
 1023|      0|  ssl_log(transport, PN_LEVEL_TRACE, "SSL socket freed." );
 1024|      0|  release_ssl_socket( ssl );
 1025|      0|  if (ssl->session_id) free((void *)ssl->session_id);
  ------------------
  |  Branch (1025:7): [True: 0, False: 0]
  ------------------
 1026|      0|  if (ssl->peer_hostname) free((void *)ssl->peer_hostname);
  ------------------
  |  Branch (1026:7): [True: 0, False: 0]
  ------------------
 1027|      0|  if (ssl->inbuf) free((void *)ssl->inbuf);
  ------------------
  |  Branch (1027:7): [True: 0, False: 0]
  ------------------
 1028|      0|  if (ssl->outbuf) free((void *)ssl->outbuf);
  ------------------
  |  Branch (1028:7): [True: 0, False: 0]
  ------------------
 1029|      0|  if (ssl->subject) free(ssl->subject);
  ------------------
  |  Branch (1029:7): [True: 0, False: 0]
  ------------------
 1030|      0|  if (ssl->peer_certificate) X509_free(ssl->peer_certificate);
  ------------------
  |  Branch (1030:7): [True: 0, False: 0]
  ------------------
 1031|      0|  free(ssl);
 1032|      0|}

devnull:
   60|  2.41k|void devnull(intptr_t context, pn_log_subsystem_t sub,  pn_log_level_t sev, const char *message) {}
LLVMFuzzerTestOneInput:
   62|  34.6k|int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   63|  34.6k|  if (VERBOSE)
  ------------------
  |  Branch (63:7): [Folded, False: 34.6k]
  ------------------
   64|      0|    printf("BEGIN LLVMFuzzerTestOneInput\n");
   65|  34.6k|  app_data_t app = {{0}};
   66|  34.6k|  sprintf(app.container_id, "%s:%06x",
   67|  34.6k|           "fuzz_connection_driver", rand() & 0xffffff);
   68|       |
   69|  34.6k|  pn_connection_driver_t driver;
   70|  34.6k|  if (pn_connection_driver_init(&driver, NULL, NULL) != 0) {
  ------------------
  |  Branch (70:7): [True: 0, False: 34.6k]
  ------------------
   71|      0|    printf("pn_connection_driver_init\n");
   72|      0|    exit(1);
   73|      0|  }
   74|       |
   75|  34.6k|  pn_logger_set_log_sink(pn_default_logger(), devnull, 0);
   76|       |
   77|  34.6k|  uint8_t *data = (uint8_t *)Data;
   78|  34.6k|  size_t size = Size;
   79|       |
   80|  34.6k|  fdc_write(&driver);
   81|       |
   82|  34.6k|  pn_event_t *event;
   83|   276k|  while ((event = pn_connection_driver_next_event(&driver)) != NULL) {
  ------------------
  |  Branch (83:10): [True: 242k, False: 34.6k]
  ------------------
   84|   242k|    handle(&app, event);
   85|   242k|  }
   86|       |
   87|  34.6k|  fdc_write(&driver);
   88|       |
   89|  49.9k|  do {
   90|  49.9k|    fdc_write(&driver);
   91|  49.9k|    fcd_read(&driver, &data, &size);
   92|  49.9k|    if (VERBOSE)
  ------------------
  |  Branch (92:9): [Folded, False: 49.9k]
  ------------------
   93|      0|      printf("size is %d, data is %p\n", (int)size, (void *)data);
   94|  5.78M|    while ((event = pn_connection_driver_next_event(&driver)) != NULL) {
  ------------------
  |  Branch (94:12): [True: 5.73M, False: 49.9k]
  ------------------
   95|  5.73M|      handle(&app, event);
   96|  5.73M|    }
   97|  49.9k|  } while (size > 0);
  ------------------
  |  Branch (97:12): [True: 15.3k, False: 34.6k]
  ------------------
   98|       |
   99|  34.6k|  pn_connection_driver_close(&driver);
  100|  34.6k|  pn_connection_driver_destroy(&driver);
  101|  34.6k|  if (VERBOSE)
  ------------------
  |  Branch (101:7): [Folded, False: 34.6k]
  ------------------
  102|      0|    printf("END LLVMFuzzerTestOneInput\n");
  103|  34.6k|  return 0;
  104|  34.6k|}
fcd_read:
  198|  49.9k|size_t fcd_read(pn_connection_driver_t *driver, uint8_t **data, size_t *size) {
  199|  49.9k|  pn_rwbytes_t buf = pn_connection_driver_read_buffer(driver);
  200|  49.9k|  size_t s = (*size < buf.size) ? *size : buf.size;
  ------------------
  |  Branch (200:14): [True: 34.3k, False: 15.6k]
  ------------------
  201|  49.9k|  if (buf.start == NULL) {
  ------------------
  |  Branch (201:7): [True: 273, False: 49.7k]
  ------------------
  202|       |    // The engine offered a null buffer for further input.
  203|       |    // This is legit, because it is just that the "socket" was closed
  204|       |    //  for further input, after reading the invalid header.
  205|    273|    *size = 0;
  206|    273|    return *size;
  207|    273|  }
  208|  49.7k|  memcpy(buf.start, *data, s);
  209|       |
  210|  49.7k|  pn_connection_driver_read_done(driver, s);
  211|  49.7k|  *data += s;
  212|  49.7k|  *size -= s;
  213|       |
  214|  49.7k|  return *size;
  215|  49.9k|}
fuzz-connection-driver.c:handle:
  106|  5.97M|static void handle(app_data_t *app, pn_event_t *event) {
  107|  5.97M|  switch (pn_event_type(event)) {
  108|       |
  109|  34.6k|  case PN_CONNECTION_INIT: {
  ------------------
  |  Branch (109:3): [True: 34.6k, False: 5.94M]
  ------------------
  110|  34.6k|    pn_connection_t *c = pn_event_connection(event);
  111|  34.6k|    pn_connection_set_container(c, app->container_id);
  112|  34.6k|    pn_connection_open(c);
  113|  34.6k|    pn_session_t *s = pn_session(c);
  114|  34.6k|    pn_session_open(s);
  115|  34.6k|    pn_link_t *l = pn_receiver(s, "my_receiver");
  116|  34.6k|    pn_terminus_set_address(pn_link_source(l), NULL);
  117|  34.6k|    pn_link_open(l);
  118|  34.6k|    pn_link_flow(l, 20);
  119|  34.6k|  } break;
  120|       |
  121|   116k|  case PN_DELIVERY: {
  ------------------
  |  Branch (121:3): [True: 116k, False: 5.86M]
  ------------------
  122|       |    /* A message has been received */
  123|   116k|    pn_link_t *link = NULL;
  124|   116k|    pn_delivery_t *dlv = pn_event_delivery(event);
  125|   116k|    if (pn_delivery_readable(dlv) && !pn_delivery_partial(dlv)) {
  ------------------
  |  Branch (125:9): [True: 91.4k, False: 25.4k]
  |  Branch (125:38): [True: 75.3k, False: 16.0k]
  ------------------
  126|  75.3k|      link = pn_delivery_link(dlv);
  127|  75.3k|      decode_message(dlv);
  128|       |      /* Accept the delivery */
  129|  75.3k|      pn_delivery_update(dlv, PN_ACCEPTED);
  ------------------
  |  |   66|  75.3k|#define PN_ACCEPTED (0x0000000000000024)
  ------------------
  130|       |      /* done with the delivery, move to the next and free it */
  131|  75.3k|      pn_link_advance(link);
  132|  75.3k|      pn_delivery_settle(dlv); /* dlv is now freed */
  133|  75.3k|    }
  134|   116k|  } break;
  135|       |
  136|  8.60k|  case PN_TRANSPORT_ERROR:
  ------------------
  |  Branch (136:3): [True: 8.60k, False: 5.97M]
  ------------------
  137|  8.60k|    check_condition(event, pn_transport_condition(pn_event_transport(event)));
  138|  8.60k|    pn_connection_close(pn_event_connection(event));
  139|  8.60k|    break;
  140|       |
  141|  1.47k|  case PN_CONNECTION_REMOTE_CLOSE:
  ------------------
  |  Branch (141:3): [True: 1.47k, False: 5.97M]
  ------------------
  142|  1.47k|    check_condition(event,
  143|  1.47k|                    pn_connection_remote_condition(pn_event_connection(event)));
  144|  1.47k|    pn_connection_close(pn_event_connection(event));
  145|  1.47k|    break;
  146|       |
  147|  88.3k|  case PN_SESSION_REMOTE_CLOSE:
  ------------------
  |  Branch (147:3): [True: 88.3k, False: 5.89M]
  ------------------
  148|  88.3k|    check_condition(event,
  149|  88.3k|                    pn_session_remote_condition(pn_event_session(event)));
  150|  88.3k|    pn_connection_close(pn_event_connection(event));
  151|  88.3k|    break;
  152|       |
  153|   111k|  case PN_LINK_REMOTE_CLOSE:
  ------------------
  |  Branch (153:3): [True: 111k, False: 5.86M]
  ------------------
  154|   137k|  case PN_LINK_REMOTE_DETACH:
  ------------------
  |  Branch (154:3): [True: 25.8k, False: 5.95M]
  ------------------
  155|   137k|    check_condition(event, pn_link_remote_condition(pn_event_link(event)));
  156|   137k|    pn_connection_close(pn_event_connection(event));
  157|   137k|    break;
  158|       |
  159|  5.59M|  default:
  ------------------
  |  Branch (159:3): [True: 5.59M, False: 386k]
  ------------------
  160|  5.59M|    break;
  161|  5.97M|  }
  162|  5.97M|}
fuzz-connection-driver.c:decode_message:
  174|  75.3k|static void decode_message(pn_delivery_t *dlv) {
  175|  75.3k|  static char buffer[MAX_SIZE];
  176|  75.3k|  ssize_t len;
  177|       |  // try to decode the message body
  178|  75.3k|  if (pn_delivery_pending(dlv) < MAX_SIZE) {
  ------------------
  |  |   37|  75.3k|#define MAX_SIZE 1024
  ------------------
  |  Branch (178:7): [True: 74.8k, False: 561]
  ------------------
  179|       |    // read in the raw data
  180|  74.8k|    len = pn_link_recv(pn_delivery_link(dlv), buffer, MAX_SIZE);
  ------------------
  |  |   37|  74.8k|#define MAX_SIZE 1024
  ------------------
  181|  74.8k|    if (len > 0) {
  ------------------
  |  Branch (181:9): [True: 73.1k, False: 1.65k]
  ------------------
  182|       |      // decode it into a proton message
  183|  73.1k|      pn_message_t *m = pn_message();
  184|  73.1k|      if (PN_OK == pn_message_decode(m, buffer, len)) {
  ------------------
  |  |   47|  73.1k|#define PN_OK (0)              /**< No error */
  ------------------
  |  Branch (184:11): [True: 73.1k, False: 0]
  ------------------
  185|  73.1k|        char *s = pn_tostring(pn_message_body(m));
  186|  73.1k|        if (ERRORS)
  ------------------
  |  Branch (186:13): [Folded, False: 73.1k]
  ------------------
  187|      0|          printf("%s\n", s);
  188|  73.1k|        free(s);
  189|  73.1k|      }
  190|  73.1k|      pn_message_free(m);
  191|  73.1k|    }
  192|  74.8k|  }
  193|  75.3k|}
fuzz-connection-driver.c:check_condition:
  164|   235k|static void check_condition(pn_event_t *e, pn_condition_t *cond) {
  165|   235k|  if (VERBOSE)
  ------------------
  |  Branch (165:7): [Folded, False: 235k]
  ------------------
  166|      0|    printf("beginning check_condition\n");
  167|   235k|  if (pn_condition_is_set(cond)) {
  ------------------
  |  Branch (167:7): [True: 8.69k, False: 226k]
  ------------------
  168|  8.69k|    if (VERBOSE || ERRORS)
  ------------------
  |  Branch (168:9): [Folded, False: 0]
  |  Branch (168:20): [Folded, False: 0]
  ------------------
  169|      0|      fprintf(stderr, "%s: %s: %s\n", pn_event_type_name(pn_event_type(e)),
  170|      0|              pn_condition_get_name(cond), pn_condition_get_description(cond));
  171|  8.69k|  }
  172|   235k|}
fuzz-connection-driver.c:fdc_write:
  218|   119k|static void fdc_write(pn_connection_driver_t *driver) {
  219|   119k|  pn_bytes_t buffer = pn_connection_driver_write_buffer(driver);
  220|   119k|  pn_connection_driver_write_done(driver, buffer.size);
  221|   119k|}

