pn_amqp_decode_DqC:
    7|  28.1k|{
    8|  28.1k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
    9|  28.1k|    consume_described_copy(&consumer, arg0);
   10|  28.1k|    return consumer.position;
   11|  28.1k|}
pn_amqp_decode_DqEqqqqqDqqDqEqqqqqCCee:
   15|  1.05M|{
   16|  1.05M|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
   17|  1.05M|    {
   18|  1.05M|        pni_consumer_t subconsumer;
   19|  1.05M|        consume_described(&consumer, &subconsumer);
   20|  1.05M|        pni_consumer_t consumer = subconsumer;
   21|  1.05M|        {
   22|  1.05M|            pni_consumer_t subconsumer;
   23|  1.05M|            uint32_t count;
   24|  1.05M|            consume_list(&consumer, &subconsumer, &count);
   25|  1.05M|            pni_consumer_t consumer = subconsumer;
   26|  1.05M|            consume_anything(&consumer);
   27|  1.05M|            consume_anything(&consumer);
   28|  1.05M|            consume_anything(&consumer);
   29|  1.05M|            consume_anything(&consumer);
   30|  1.05M|            consume_anything(&consumer);
   31|  1.05M|            consume_described_anything(&consumer);
   32|  1.05M|            {
   33|  1.05M|                pni_consumer_t subconsumer;
   34|  1.05M|                consume_described(&consumer, &subconsumer);
   35|  1.05M|                pni_consumer_t consumer = subconsumer;
   36|  1.05M|                {
   37|  1.05M|                    pni_consumer_t subconsumer;
   38|  1.05M|                    uint32_t count;
   39|  1.05M|                    consume_list(&consumer, &subconsumer, &count);
   40|  1.05M|                    pni_consumer_t consumer = subconsumer;
   41|  1.05M|                    consume_anything(&consumer);
   42|  1.05M|                    consume_anything(&consumer);
   43|  1.05M|                    consume_anything(&consumer);
   44|  1.05M|                    consume_anything(&consumer);
   45|  1.05M|                    consume_anything(&consumer);
   46|  1.05M|                    consume_copy(&consumer, arg0);
   47|  1.05M|                    consume_copy(&consumer, arg1);
   48|  1.05M|                    consume_end_list(&consumer);
   49|  1.05M|                }
   50|  1.05M|            }
   51|  1.05M|            consume_end_list(&consumer);
   52|  1.05M|        }
   53|  1.05M|    }
   54|  1.05M|    return consumer.position;
   55|  1.05M|}
pn_amqp_decode_DqEqqqqqDqqDqECeqqqe:
   59|   174k|{
   60|   174k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
   61|   174k|    {
   62|   174k|        pni_consumer_t subconsumer;
   63|   174k|        consume_described(&consumer, &subconsumer);
   64|   174k|        pni_consumer_t consumer = subconsumer;
   65|   174k|        {
   66|   174k|            pni_consumer_t subconsumer;
   67|   174k|            uint32_t count;
   68|   174k|            consume_list(&consumer, &subconsumer, &count);
   69|   174k|            pni_consumer_t consumer = subconsumer;
   70|   174k|            consume_anything(&consumer);
   71|   174k|            consume_anything(&consumer);
   72|   174k|            consume_anything(&consumer);
   73|   174k|            consume_anything(&consumer);
   74|   174k|            consume_anything(&consumer);
   75|   174k|            consume_described_anything(&consumer);
   76|   174k|            {
   77|   174k|                pni_consumer_t subconsumer;
   78|   174k|                consume_described(&consumer, &subconsumer);
   79|   174k|                pni_consumer_t consumer = subconsumer;
   80|   174k|                {
   81|   174k|                    pni_consumer_t subconsumer;
   82|   174k|                    uint32_t count;
   83|   174k|                    consume_list(&consumer, &subconsumer, &count);
   84|   174k|                    pni_consumer_t consumer = subconsumer;
   85|   174k|                    consume_copy(&consumer, arg0);
   86|   174k|                    consume_end_list(&consumer);
   87|   174k|                }
   88|   174k|            }
   89|   174k|            consume_anything(&consumer);
   90|   174k|            consume_anything(&consumer);
   91|   174k|            consume_anything(&consumer);
   92|   174k|            consume_end_list(&consumer);
   93|   174k|        }
   94|   174k|    }
   95|   174k|    return consumer.position;
   96|   174k|}
pn_amqp_decode_DqEqqqqqDqqDLqqqqe:
  100|  1.21M|{
  101|  1.21M|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  102|  1.21M|    {
  103|  1.21M|        pni_consumer_t subconsumer;
  104|  1.21M|        consume_described(&consumer, &subconsumer);
  105|  1.21M|        pni_consumer_t consumer = subconsumer;
  106|  1.21M|        {
  107|  1.21M|            pni_consumer_t subconsumer;
  108|  1.21M|            uint32_t count;
  109|  1.21M|            consume_list(&consumer, &subconsumer, &count);
  110|  1.21M|            pni_consumer_t consumer = subconsumer;
  111|  1.21M|            consume_anything(&consumer);
  112|  1.21M|            consume_anything(&consumer);
  113|  1.21M|            consume_anything(&consumer);
  114|  1.21M|            consume_anything(&consumer);
  115|  1.21M|            consume_anything(&consumer);
  116|  1.21M|            consume_described_anything(&consumer);
  117|  1.21M|            consume_described_type_anything(&consumer, arg0);
  118|  1.21M|            consume_anything(&consumer);
  119|  1.21M|            consume_anything(&consumer);
  120|  1.21M|            consume_anything(&consumer);
  121|  1.21M|            consume_end_list(&consumer);
  122|  1.21M|        }
  123|  1.21M|    }
  124|  1.21M|    return consumer.position;
  125|  1.21M|}
pn_amqp_decode_DqEqqqqqDqEqqqqqCqCqCCee:
  129|  1.23M|{
  130|  1.23M|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  131|  1.23M|    {
  132|  1.23M|        pni_consumer_t subconsumer;
  133|  1.23M|        consume_described(&consumer, &subconsumer);
  134|  1.23M|        pni_consumer_t consumer = subconsumer;
  135|  1.23M|        {
  136|  1.23M|            pni_consumer_t subconsumer;
  137|  1.23M|            uint32_t count;
  138|  1.23M|            consume_list(&consumer, &subconsumer, &count);
  139|  1.23M|            pni_consumer_t consumer = subconsumer;
  140|  1.23M|            consume_anything(&consumer);
  141|  1.23M|            consume_anything(&consumer);
  142|  1.23M|            consume_anything(&consumer);
  143|  1.23M|            consume_anything(&consumer);
  144|  1.23M|            consume_anything(&consumer);
  145|  1.23M|            {
  146|  1.23M|                pni_consumer_t subconsumer;
  147|  1.23M|                consume_described(&consumer, &subconsumer);
  148|  1.23M|                pni_consumer_t consumer = subconsumer;
  149|  1.23M|                {
  150|  1.23M|                    pni_consumer_t subconsumer;
  151|  1.23M|                    uint32_t count;
  152|  1.23M|                    consume_list(&consumer, &subconsumer, &count);
  153|  1.23M|                    pni_consumer_t consumer = subconsumer;
  154|  1.23M|                    consume_anything(&consumer);
  155|  1.23M|                    consume_anything(&consumer);
  156|  1.23M|                    consume_anything(&consumer);
  157|  1.23M|                    consume_anything(&consumer);
  158|  1.23M|                    consume_anything(&consumer);
  159|  1.23M|                    consume_copy(&consumer, arg0);
  160|  1.23M|                    consume_anything(&consumer);
  161|  1.23M|                    consume_copy(&consumer, arg1);
  162|  1.23M|                    consume_anything(&consumer);
  163|  1.23M|                    consume_copy(&consumer, arg2);
  164|  1.23M|                    consume_copy(&consumer, arg3);
  165|  1.23M|                    consume_end_list(&consumer);
  166|  1.23M|                }
  167|  1.23M|            }
  168|  1.23M|            consume_end_list(&consumer);
  169|  1.23M|        }
  170|  1.23M|    }
  171|  1.23M|    return consumer.position;
  172|  1.23M|}
pn_amqp_decode_DqEQHIIIQIe:
  176|   686k|{
  177|   686k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  178|   686k|    {
  179|   686k|        pni_consumer_t subconsumer;
  180|   686k|        consume_described(&consumer, &subconsumer);
  181|   686k|        pni_consumer_t consumer = subconsumer;
  182|   686k|        {
  183|   686k|            pni_consumer_t subconsumer;
  184|   686k|            uint32_t count;
  185|   686k|            consume_list(&consumer, &subconsumer, &count);
  186|   686k|            pni_consumer_t consumer = subconsumer;
  187|   686k|            *arg0 = consume_ushort(&consumer, arg1);;
  188|   686k|            consume_uint(&consumer, arg2);
  189|   686k|            consume_uint(&consumer, arg3);
  190|   686k|            consume_uint(&consumer, arg4);
  191|   686k|            *arg5 = consume_uint(&consumer, arg6);;
  192|   686k|            consume_end_list(&consumer);
  193|   686k|        }
  194|   686k|    }
  195|   686k|    return consumer.position;
  196|   686k|}
pn_amqp_decode_DqEQIQLe:
  200|  6.15k|{
  201|  6.15k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  202|  6.15k|    {
  203|  6.15k|        pni_consumer_t subconsumer;
  204|  6.15k|        consume_described(&consumer, &subconsumer);
  205|  6.15k|        pni_consumer_t consumer = subconsumer;
  206|  6.15k|        {
  207|  6.15k|            pni_consumer_t subconsumer;
  208|  6.15k|            uint32_t count;
  209|  6.15k|            consume_list(&consumer, &subconsumer, &count);
  210|  6.15k|            pni_consumer_t consumer = subconsumer;
  211|  6.15k|            *arg0 = consume_uint(&consumer, arg1);;
  212|  6.15k|            *arg2 = consume_ulong(&consumer, arg3);;
  213|  6.15k|            consume_end_list(&consumer);
  214|  6.15k|        }
  215|  6.15k|    }
  216|  6.15k|    return consumer.position;
  217|  6.15k|}
pn_amqp_decode_DqEQIIIIQIQIIqoe:
  221|  49.1k|{
  222|  49.1k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  223|  49.1k|    {
  224|  49.1k|        pni_consumer_t subconsumer;
  225|  49.1k|        consume_described(&consumer, &subconsumer);
  226|  49.1k|        pni_consumer_t consumer = subconsumer;
  227|  49.1k|        {
  228|  49.1k|            pni_consumer_t subconsumer;
  229|  49.1k|            uint32_t count;
  230|  49.1k|            consume_list(&consumer, &subconsumer, &count);
  231|  49.1k|            pni_consumer_t consumer = subconsumer;
  232|  49.1k|            *arg0 = consume_uint(&consumer, arg1);;
  233|  49.1k|            consume_uint(&consumer, arg2);
  234|  49.1k|            consume_uint(&consumer, arg3);
  235|  49.1k|            consume_uint(&consumer, arg4);
  236|  49.1k|            *arg5 = consume_uint(&consumer, arg6);;
  237|  49.1k|            *arg7 = consume_uint(&consumer, arg8);;
  238|  49.1k|            consume_uint(&consumer, arg9);
  239|  49.1k|            consume_anything(&consumer);
  240|  49.1k|            consume_bool(&consumer, arg10);
  241|  49.1k|            consume_end_list(&consumer);
  242|  49.1k|        }
  243|  49.1k|    }
  244|  49.1k|    return consumer.position;
  245|  49.1k|}
pn_amqp_decode_DqEQSQSQIQHIqqCCCe:
  249|   156k|{
  250|   156k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  251|   156k|    {
  252|   156k|        pni_consumer_t subconsumer;
  253|   156k|        consume_described(&consumer, &subconsumer);
  254|   156k|        pni_consumer_t consumer = subconsumer;
  255|   156k|        {
  256|   156k|            pni_consumer_t subconsumer;
  257|   156k|            uint32_t count;
  258|   156k|            consume_list(&consumer, &subconsumer, &count);
  259|   156k|            pni_consumer_t consumer = subconsumer;
  260|   156k|            *arg0 = consume_string(&consumer, arg1);;
  261|   156k|            *arg2 = consume_string(&consumer, arg3);;
  262|   156k|            *arg4 = consume_uint(&consumer, arg5);;
  263|   156k|            *arg6 = consume_ushort(&consumer, arg7);;
  264|   156k|            consume_uint(&consumer, arg8);
  265|   156k|            consume_anything(&consumer);
  266|   156k|            consume_anything(&consumer);
  267|   156k|            consume_copy(&consumer, arg9);
  268|   156k|            consume_copy(&consumer, arg10);
  269|   156k|            consume_copy(&consumer, arg11);
  270|   156k|            consume_end_list(&consumer);
  271|   156k|        }
  272|   156k|    }
  273|   156k|    return consumer.position;
  274|   156k|}
pn_amqp_decode_DqEQoQoCe:
  278|   167k|{
  279|   167k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  280|   167k|    {
  281|   167k|        pni_consumer_t subconsumer;
  282|   167k|        consume_described(&consumer, &subconsumer);
  283|   167k|        pni_consumer_t consumer = subconsumer;
  284|   167k|        {
  285|   167k|            pni_consumer_t subconsumer;
  286|   167k|            uint32_t count;
  287|   167k|            consume_list(&consumer, &subconsumer, &count);
  288|   167k|            pni_consumer_t consumer = subconsumer;
  289|   167k|            *arg0 = consume_bool(&consumer, arg1);;
  290|   167k|            *arg2 = consume_bool(&consumer, arg3);;
  291|   167k|            consume_copy(&consumer, arg4);
  292|   167k|            consume_end_list(&consumer);
  293|   167k|        }
  294|   167k|    }
  295|   167k|    return consumer.position;
  296|   167k|}
pn_amqp_decode_DqEDqEsSCee:
  321|  23.8k|{
  322|  23.8k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  323|  23.8k|    {
  324|  23.8k|        pni_consumer_t subconsumer;
  325|  23.8k|        consume_described(&consumer, &subconsumer);
  326|  23.8k|        pni_consumer_t consumer = subconsumer;
  327|  23.8k|        {
  328|  23.8k|            pni_consumer_t subconsumer;
  329|  23.8k|            uint32_t count;
  330|  23.8k|            consume_list(&consumer, &subconsumer, &count);
  331|  23.8k|            pni_consumer_t consumer = subconsumer;
  332|  23.8k|            {
  333|  23.8k|                pni_consumer_t subconsumer;
  334|  23.8k|                consume_described(&consumer, &subconsumer);
  335|  23.8k|                pni_consumer_t consumer = subconsumer;
  336|  23.8k|                {
  337|  23.8k|                    pni_consumer_t subconsumer;
  338|  23.8k|                    uint32_t count;
  339|  23.8k|                    consume_list(&consumer, &subconsumer, &count);
  340|  23.8k|                    pni_consumer_t consumer = subconsumer;
  341|  23.8k|                    consume_symbol(&consumer, arg0);
  342|  23.8k|                    consume_string(&consumer, arg1);
  343|  23.8k|                    consume_copy(&consumer, arg2);
  344|  23.8k|                    consume_end_list(&consumer);
  345|  23.8k|                }
  346|  23.8k|            }
  347|  23.8k|            consume_end_list(&consumer);
  348|  23.8k|        }
  349|  23.8k|    }
  350|  23.8k|    return consumer.position;
  351|  23.8k|}
pn_amqp_decode_DqEIQIzqQooqDQLRoooe:
  355|  1.07M|{
  356|  1.07M|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  357|  1.07M|    {
  358|  1.07M|        pni_consumer_t subconsumer;
  359|  1.07M|        consume_described(&consumer, &subconsumer);
  360|  1.07M|        pni_consumer_t consumer = subconsumer;
  361|  1.07M|        {
  362|  1.07M|            pni_consumer_t subconsumer;
  363|  1.07M|            uint32_t count;
  364|  1.07M|            consume_list(&consumer, &subconsumer, &count);
  365|  1.07M|            pni_consumer_t consumer = subconsumer;
  366|  1.07M|            consume_uint(&consumer, arg0);
  367|  1.07M|            *arg1 = consume_uint(&consumer, arg2);;
  368|  1.07M|            consume_binaryornull(&consumer, arg3);
  369|  1.07M|            consume_anything(&consumer);
  370|  1.07M|            *arg4 = consume_bool(&consumer, arg5);;
  371|  1.07M|            consume_bool(&consumer, arg6);
  372|  1.07M|            consume_anything(&consumer);
  373|  1.07M|            consume_described_maybe_type_raw(&consumer, arg7, arg8, arg9);
  374|  1.07M|            consume_bool(&consumer, arg10);
  375|  1.07M|            consume_bool(&consumer, arg11);
  376|  1.07M|            consume_bool(&consumer, arg12);
  377|  1.07M|            consume_end_list(&consumer);
  378|  1.07M|        }
  379|  1.07M|    }
  380|  1.07M|    return consumer.position;
  381|  1.07M|}
pn_amqp_decode_DqEIoRe:
  385|  44.0k|{
  386|  44.0k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  387|  44.0k|    {
  388|  44.0k|        pni_consumer_t subconsumer;
  389|  44.0k|        consume_described(&consumer, &subconsumer);
  390|  44.0k|        pni_consumer_t consumer = subconsumer;
  391|  44.0k|        {
  392|  44.0k|            pni_consumer_t subconsumer;
  393|  44.0k|            uint32_t count;
  394|  44.0k|            consume_list(&consumer, &subconsumer, &count);
  395|  44.0k|            pni_consumer_t consumer = subconsumer;
  396|  44.0k|            consume_uint(&consumer, arg0);
  397|  44.0k|            consume_bool(&consumer, arg1);
  398|  44.0k|            consume_raw(&consumer, arg2);
  399|  44.0k|            consume_end_list(&consumer);
  400|  44.0k|        }
  401|  44.0k|    }
  402|  44.0k|    return consumer.position;
  403|  44.0k|}
pn_amqp_decode_DqESIoQBQBDqESIsIoqseDqESIsIoeqqILqqQCe:
  427|  1.23M|{
  428|  1.23M|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  429|  1.23M|    {
  430|  1.23M|        pni_consumer_t subconsumer;
  431|  1.23M|        consume_described(&consumer, &subconsumer);
  432|  1.23M|        pni_consumer_t consumer = subconsumer;
  433|  1.23M|        {
  434|  1.23M|            pni_consumer_t subconsumer;
  435|  1.23M|            uint32_t count;
  436|  1.23M|            consume_list(&consumer, &subconsumer, &count);
  437|  1.23M|            pni_consumer_t consumer = subconsumer;
  438|  1.23M|            consume_string(&consumer, arg0);
  439|  1.23M|            consume_uint(&consumer, arg1);
  440|  1.23M|            consume_bool(&consumer, arg2);
  441|  1.23M|            *arg3 = consume_ubyte(&consumer, arg4);;
  442|  1.23M|            *arg5 = consume_ubyte(&consumer, arg6);;
  443|  1.23M|            {
  444|  1.23M|                pni_consumer_t subconsumer;
  445|  1.23M|                consume_described(&consumer, &subconsumer);
  446|  1.23M|                pni_consumer_t consumer = subconsumer;
  447|  1.23M|                {
  448|  1.23M|                    pni_consumer_t subconsumer;
  449|  1.23M|                    uint32_t count;
  450|  1.23M|                    consume_list(&consumer, &subconsumer, &count);
  451|  1.23M|                    pni_consumer_t consumer = subconsumer;
  452|  1.23M|                    consume_string(&consumer, arg7);
  453|  1.23M|                    consume_uint(&consumer, arg8);
  454|  1.23M|                    consume_symbol(&consumer, arg9);
  455|  1.23M|                    consume_uint(&consumer, arg10);
  456|  1.23M|                    consume_bool(&consumer, arg11);
  457|  1.23M|                    consume_anything(&consumer);
  458|  1.23M|                    consume_symbol(&consumer, arg12);
  459|  1.23M|                    consume_end_list(&consumer);
  460|  1.23M|                }
  461|  1.23M|            }
  462|  1.23M|            {
  463|  1.23M|                pni_consumer_t subconsumer;
  464|  1.23M|                consume_described(&consumer, &subconsumer);
  465|  1.23M|                pni_consumer_t consumer = subconsumer;
  466|  1.23M|                {
  467|  1.23M|                    pni_consumer_t subconsumer;
  468|  1.23M|                    uint32_t count;
  469|  1.23M|                    consume_list(&consumer, &subconsumer, &count);
  470|  1.23M|                    pni_consumer_t consumer = subconsumer;
  471|  1.23M|                    consume_string(&consumer, arg13);
  472|  1.23M|                    consume_uint(&consumer, arg14);
  473|  1.23M|                    consume_symbol(&consumer, arg15);
  474|  1.23M|                    consume_uint(&consumer, arg16);
  475|  1.23M|                    consume_bool(&consumer, arg17);
  476|  1.23M|                    consume_end_list(&consumer);
  477|  1.23M|                }
  478|  1.23M|            }
  479|  1.23M|            consume_anything(&consumer);
  480|  1.23M|            consume_anything(&consumer);
  481|  1.23M|            consume_uint(&consumer, arg18);
  482|  1.23M|            consume_ulong(&consumer, arg19);
  483|  1.23M|            consume_anything(&consumer);
  484|  1.23M|            consume_anything(&consumer);
  485|  1.23M|            *arg20 = consume_copy(&consumer, arg21);;
  486|  1.23M|            consume_end_list(&consumer);
  487|  1.23M|        }
  488|  1.23M|    }
  489|  1.23M|    return consumer.position;
  490|  1.23M|}
pn_amqp_decode_DqEazSSSassttSISe:
  494|  24.5k|{
  495|  24.5k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  496|  24.5k|    {
  497|  24.5k|        pni_consumer_t subconsumer;
  498|  24.5k|        consume_described(&consumer, &subconsumer);
  499|  24.5k|        pni_consumer_t consumer = subconsumer;
  500|  24.5k|        {
  501|  24.5k|            pni_consumer_t subconsumer;
  502|  24.5k|            uint32_t count;
  503|  24.5k|            consume_list(&consumer, &subconsumer, &count);
  504|  24.5k|            pni_consumer_t consumer = subconsumer;
  505|  24.5k|            consume_atom(&consumer, arg0);
  506|  24.5k|            consume_binaryornull(&consumer, arg1);
  507|  24.5k|            consume_string(&consumer, arg2);
  508|  24.5k|            consume_string(&consumer, arg3);
  509|  24.5k|            consume_string(&consumer, arg4);
  510|  24.5k|            consume_atom(&consumer, arg5);
  511|  24.5k|            consume_symbol(&consumer, arg6);
  512|  24.5k|            consume_symbol(&consumer, arg7);
  513|  24.5k|            consume_timestamp(&consumer, arg8);
  514|  24.5k|            consume_timestamp(&consumer, arg9);
  515|  24.5k|            consume_string(&consumer, arg10);
  516|  24.5k|            consume_uint(&consumer, arg11);
  517|  24.5k|            consume_string(&consumer, arg12);
  518|  24.5k|            consume_end_list(&consumer);
  519|  24.5k|        }
  520|  24.5k|    }
  521|  24.5k|    return consumer.position;
  522|  24.5k|}
pn_amqp_decode_DqEoQBIoIe:
  526|  7.90k|{
  527|  7.90k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  528|  7.90k|    {
  529|  7.90k|        pni_consumer_t subconsumer;
  530|  7.90k|        consume_described(&consumer, &subconsumer);
  531|  7.90k|        pni_consumer_t consumer = subconsumer;
  532|  7.90k|        {
  533|  7.90k|            pni_consumer_t subconsumer;
  534|  7.90k|            uint32_t count;
  535|  7.90k|            consume_list(&consumer, &subconsumer, &count);
  536|  7.90k|            pni_consumer_t consumer = subconsumer;
  537|  7.90k|            consume_bool(&consumer, arg0);
  538|  7.90k|            *arg1 = consume_ubyte(&consumer, arg2);;
  539|  7.90k|            consume_uint(&consumer, arg3);
  540|  7.90k|            consume_bool(&consumer, arg4);
  541|  7.90k|            consume_uint(&consumer, arg5);
  542|  7.90k|            consume_end_list(&consumer);
  543|  7.90k|        }
  544|  7.90k|    }
  545|  7.90k|    return consumer.position;
  546|  7.90k|}
pn_amqp_decode_DqEoIQIoRe:
  550|  69.2k|{
  551|  69.2k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  552|  69.2k|    {
  553|  69.2k|        pni_consumer_t subconsumer;
  554|  69.2k|        consume_described(&consumer, &subconsumer);
  555|  69.2k|        pni_consumer_t consumer = subconsumer;
  556|  69.2k|        {
  557|  69.2k|            pni_consumer_t subconsumer;
  558|  69.2k|            uint32_t count;
  559|  69.2k|            consume_list(&consumer, &subconsumer, &count);
  560|  69.2k|            pni_consumer_t consumer = subconsumer;
  561|  69.2k|            consume_bool(&consumer, arg0);
  562|  69.2k|            consume_uint(&consumer, arg1);
  563|  69.2k|            *arg2 = consume_uint(&consumer, arg3);;
  564|  69.2k|            consume_bool(&consumer, arg4);
  565|  69.2k|            consume_raw(&consumer, arg5);
  566|  69.2k|            consume_end_list(&consumer);
  567|  69.2k|        }
  568|  69.2k|    }
  569|  69.2k|    return consumer.position;
  570|  69.2k|}
pn_amqp_decode_DqEsSCe:
  574|  43.6k|{
  575|  43.6k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  576|  43.6k|    {
  577|  43.6k|        pni_consumer_t subconsumer;
  578|  43.6k|        consume_described(&consumer, &subconsumer);
  579|  43.6k|        pni_consumer_t consumer = subconsumer;
  580|  43.6k|        {
  581|  43.6k|            pni_consumer_t subconsumer;
  582|  43.6k|            uint32_t count;
  583|  43.6k|            consume_list(&consumer, &subconsumer, &count);
  584|  43.6k|            pni_consumer_t consumer = subconsumer;
  585|  43.6k|            consume_symbol(&consumer, arg0);
  586|  43.6k|            consume_string(&consumer, arg1);
  587|  43.6k|            consume_copy(&consumer, arg2);
  588|  43.6k|            consume_end_list(&consumer);
  589|  43.6k|        }
  590|  43.6k|    }
  591|  43.6k|    return consumer.position;
  592|  43.6k|}
pn_amqp_decode_DQLq:
  657|   675k|{
  658|   675k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  659|   675k|    consume_described_maybe_type_anything(&consumer, arg0, arg1);
  660|   675k|    return consumer.position;
  661|   675k|}
pn_amqp_decode_DQLQq:
  665|  68.8k|{
  666|  68.8k|    pni_consumer_t consumer = make_consumer_from_bytes(bytes);
  667|  68.8k|    consume_described_maybe_type_maybe_anything(&consumer, arg0, arg1, arg2);
  668|  68.8k|    return consumer.position;
  669|  68.8k|}

pn_amqp_encode_inner_DLEQDLEsSCee:
   34|  21.2k|{
   35|  21.2k|    pni_compound_context compound = make_compound();
   36|  21.2k|    emit_descriptor(emitter, &compound, arg0);
   37|  21.3k|    for (bool small_encoding = true; ; small_encoding = false) {
   38|  21.3k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
   39|  21.3k|        pni_compound_context compound = c;
   40|  21.3k|        if (arg1) {
  ------------------
  |  Branch (40:13): [True: 20.9k, False: 401]
  ------------------
   41|  20.9k|            emit_descriptor(emitter, &compound, arg2);
   42|  21.0k|            for (bool small_encoding = true; ; small_encoding = false) {
   43|  21.0k|                pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
   44|  21.0k|                pni_compound_context compound = c;
   45|  21.0k|                emit_symbol(emitter, &compound, arg3);
   46|  21.0k|                emit_string(emitter, &compound, arg4);
   47|  21.0k|                emit_copy(emitter, &compound, arg5);
   48|  21.0k|                emit_end_list(emitter, &compound, small_encoding);
   49|  21.0k|                if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (49:21): [True: 20.9k, False: 146]
  ------------------
   50|  21.0k|            }
   51|  20.9k|        } else {
   52|    401|            emit_null(emitter, &compound);
   53|    401|        }
   54|  21.3k|        emit_end_list(emitter, &compound, small_encoding);
   55|  21.3k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (55:13): [True: 21.2k, False: 75]
  ------------------
   56|  21.3k|    }
   57|  21.2k|    return resize_required(emitter);
   58|  21.2k|}
pn_amqp_encode_DLEQDLEsSCee:
   61|  21.2k|{
   62|  21.2k|    do {
   63|  21.2k|        pni_emitter_t emitter = make_emitter_from_buffer(buffer);
   64|  21.2k|        if (pn_amqp_encode_inner_DLEQDLEsSCee(&emitter, arg0, arg1, arg2, arg3, arg4, arg5)) {
  ------------------
  |  Branch (64:13): [True: 29, False: 21.2k]
  ------------------
   65|     29|            size_buffer_to_emitter(buffer, &emitter);
   66|     29|            continue;
   67|     29|        }
   68|  21.2k|        return make_bytes_from_emitter(emitter);
   69|  21.2k|    } while (true);
   70|       |    /*Unreachable*/
   71|  21.2k|}
pn_amqp_encode_inner_DLEQHIIIIe:
   81|  30.6k|{
   82|  30.6k|    pni_compound_context compound = make_compound();
   83|  30.6k|    emit_descriptor(emitter, &compound, arg0);
   84|  30.6k|    for (bool small_encoding = true; ; small_encoding = false) {
   85|  30.6k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
   86|  30.6k|        pni_compound_context compound = c;
   87|  30.6k|        if (arg1) {
  ------------------
  |  Branch (87:13): [True: 0, False: 30.6k]
  ------------------
   88|      0|            emit_ushort(emitter, &compound, arg2);
   89|  30.6k|        } else {
   90|  30.6k|            emit_null(emitter, &compound);
   91|  30.6k|        }
   92|  30.6k|        emit_uint(emitter, &compound, arg3);
   93|  30.6k|        emit_uint(emitter, &compound, arg4);
   94|  30.6k|        emit_uint(emitter, &compound, arg5);
   95|  30.6k|        emit_uint(emitter, &compound, arg6);
   96|  30.6k|        emit_end_list(emitter, &compound, small_encoding);
   97|  30.6k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (97:13): [True: 30.6k, False: 0]
  ------------------
   98|  30.6k|    }
   99|  30.6k|    return resize_required(emitter);
  100|  30.6k|}
pn_amqp_encode_DLEQHIIIIe:
  103|  30.6k|{
  104|  30.6k|    do {
  105|  30.6k|        pni_emitter_t emitter = make_emitter_from_buffer(buffer);
  106|  30.6k|        if (pn_amqp_encode_inner_DLEQHIIIIe(&emitter, arg0, arg1, arg2, arg3, arg4, arg5, arg6)) {
  ------------------
  |  Branch (106:13): [True: 0, False: 30.6k]
  ------------------
  107|      0|            size_buffer_to_emitter(buffer, &emitter);
  108|      0|            continue;
  109|      0|        }
  110|  30.6k|        return make_bytes_from_emitter(emitter);
  111|  30.6k|    } while (true);
  112|       |    /*Unreachable*/
  113|  30.6k|}
pn_amqp_encode_inner_DLEQIIIIQIQIQInQoe:
  123|  30.6k|{
  124|  30.6k|    pni_compound_context compound = make_compound();
  125|  30.6k|    emit_descriptor(emitter, &compound, arg0);
  126|  30.6k|    for (bool small_encoding = true; ; small_encoding = false) {
  127|  30.6k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  128|  30.6k|        pni_compound_context compound = c;
  129|  30.6k|        if (arg1) {
  ------------------
  |  Branch (129:13): [True: 0, False: 30.6k]
  ------------------
  130|      0|            emit_uint(emitter, &compound, arg2);
  131|  30.6k|        } else {
  132|  30.6k|            emit_null(emitter, &compound);
  133|  30.6k|        }
  134|  30.6k|        emit_uint(emitter, &compound, arg3);
  135|  30.6k|        emit_uint(emitter, &compound, arg4);
  136|  30.6k|        emit_uint(emitter, &compound, arg5);
  137|  30.6k|        if (arg6) {
  ------------------
  |  Branch (137:13): [True: 30.6k, False: 0]
  ------------------
  138|  30.6k|            emit_uint(emitter, &compound, arg7);
  139|  30.6k|        } else {
  140|      0|            emit_null(emitter, &compound);
  141|      0|        }
  142|  30.6k|        if (arg8) {
  ------------------
  |  Branch (142:13): [True: 30.6k, False: 0]
  ------------------
  143|  30.6k|            emit_uint(emitter, &compound, arg9);
  144|  30.6k|        } else {
  145|      0|            emit_null(emitter, &compound);
  146|      0|        }
  147|  30.6k|        if (arg10) {
  ------------------
  |  Branch (147:13): [True: 30.6k, False: 0]
  ------------------
  148|  30.6k|            emit_uint(emitter, &compound, arg11);
  149|  30.6k|        } else {
  150|      0|            emit_null(emitter, &compound);
  151|      0|        }
  152|  30.6k|        emit_null(emitter, &compound);
  153|  30.6k|        if (arg12) {
  ------------------
  |  Branch (153:13): [True: 30.6k, False: 0]
  ------------------
  154|  30.6k|            emit_bool(emitter, &compound, arg13);
  155|  30.6k|        } else {
  156|      0|            emit_null(emitter, &compound);
  157|      0|        }
  158|  30.6k|        emit_end_list(emitter, &compound, small_encoding);
  159|  30.6k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (159:13): [True: 30.6k, False: 0]
  ------------------
  160|  30.6k|    }
  161|  30.6k|    return resize_required(emitter);
  162|  30.6k|}
pn_amqp_encode_DLEQIIIIQIQIQInQoe:
  165|  30.6k|{
  166|  30.6k|    do {
  167|  30.6k|        pni_emitter_t emitter = make_emitter_from_buffer(buffer);
  168|  30.6k|        if (pn_amqp_encode_inner_DLEQIIIIQIQIQInQoe(&emitter, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13)) {
  ------------------
  |  Branch (168:13): [True: 0, False: 30.6k]
  ------------------
  169|      0|            size_buffer_to_emitter(buffer, &emitter);
  170|      0|            continue;
  171|      0|        }
  172|  30.6k|        return make_bytes_from_emitter(emitter);
  173|  30.6k|    } while (true);
  174|       |    /*Unreachable*/
  175|  30.6k|}
pn_amqp_encode_inner_DLESIoBBQDLESIsIoCQsCnMMeQDLESIsIoCMennILnnCe:
  514|  30.6k|{
  515|  30.6k|    pni_compound_context compound = make_compound();
  516|  30.6k|    emit_descriptor(emitter, &compound, arg0);
  517|  30.6k|    for (bool small_encoding = true; ; small_encoding = false) {
  518|  30.6k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  519|  30.6k|        pni_compound_context compound = c;
  520|  30.6k|        emit_string(emitter, &compound, arg1);
  521|  30.6k|        emit_uint(emitter, &compound, arg2);
  522|  30.6k|        emit_bool(emitter, &compound, arg3);
  523|  30.6k|        emit_ubyte(emitter, &compound, arg4);
  524|  30.6k|        emit_ubyte(emitter, &compound, arg5);
  525|  30.6k|        if (arg6) {
  ------------------
  |  Branch (525:13): [True: 30.6k, False: 0]
  ------------------
  526|  30.6k|            emit_descriptor(emitter, &compound, arg7);
  527|  30.6k|            for (bool small_encoding = true; ; small_encoding = false) {
  528|  30.6k|                pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  529|  30.6k|                pni_compound_context compound = c;
  530|  30.6k|                emit_string(emitter, &compound, arg8);
  531|  30.6k|                emit_uint(emitter, &compound, arg9);
  532|  30.6k|                emit_symbol(emitter, &compound, arg10);
  533|  30.6k|                emit_uint(emitter, &compound, arg11);
  534|  30.6k|                emit_bool(emitter, &compound, arg12);
  535|  30.6k|                emit_copy(emitter, &compound, arg13);
  536|  30.6k|                if (arg14) {
  ------------------
  |  Branch (536:21): [True: 0, False: 30.6k]
  ------------------
  537|      0|                    emit_symbol(emitter, &compound, arg15);
  538|  30.6k|                } else {
  539|  30.6k|                    emit_null(emitter, &compound);
  540|  30.6k|                }
  541|  30.6k|                emit_copy(emitter, &compound, arg16);
  542|  30.6k|                emit_null(emitter, &compound);
  543|  30.6k|                emit_multiple(emitter, &compound, arg17);
  544|  30.6k|                emit_multiple(emitter, &compound, arg18);
  545|  30.6k|                emit_end_list(emitter, &compound, small_encoding);
  546|  30.6k|                if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (546:21): [True: 30.6k, False: 0]
  ------------------
  547|  30.6k|            }
  548|  30.6k|        } else {
  549|      0|            emit_null(emitter, &compound);
  550|      0|        }
  551|  30.6k|        if (arg19) {
  ------------------
  |  Branch (551:13): [True: 30.6k, False: 0]
  ------------------
  552|  30.6k|            emit_descriptor(emitter, &compound, arg20);
  553|  30.6k|            for (bool small_encoding = true; ; small_encoding = false) {
  554|  30.6k|                pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  555|  30.6k|                pni_compound_context compound = c;
  556|  30.6k|                emit_string(emitter, &compound, arg21);
  557|  30.6k|                emit_uint(emitter, &compound, arg22);
  558|  30.6k|                emit_symbol(emitter, &compound, arg23);
  559|  30.6k|                emit_uint(emitter, &compound, arg24);
  560|  30.6k|                emit_bool(emitter, &compound, arg25);
  561|  30.6k|                emit_copy(emitter, &compound, arg26);
  562|  30.6k|                emit_multiple(emitter, &compound, arg27);
  563|  30.6k|                emit_end_list(emitter, &compound, small_encoding);
  564|  30.6k|                if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (564:21): [True: 30.6k, False: 0]
  ------------------
  565|  30.6k|            }
  566|  30.6k|        } else {
  567|      0|            emit_null(emitter, &compound);
  568|      0|        }
  569|  30.6k|        emit_null(emitter, &compound);
  570|  30.6k|        emit_null(emitter, &compound);
  571|  30.6k|        emit_uint(emitter, &compound, arg28);
  572|  30.6k|        emit_ulong(emitter, &compound, arg29);
  573|  30.6k|        emit_null(emitter, &compound);
  574|  30.6k|        emit_null(emitter, &compound);
  575|  30.6k|        emit_copy(emitter, &compound, arg30);
  576|  30.6k|        emit_end_list(emitter, &compound, small_encoding);
  577|  30.6k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (577:13): [True: 30.6k, False: 0]
  ------------------
  578|  30.6k|    }
  579|  30.6k|    return resize_required(emitter);
  580|  30.6k|}
pn_amqp_encode_DLESIoBBQDLESIsIoCQsCnMMeQDLESIsIoCMennILnnCe:
  583|  30.6k|{
  584|  30.6k|    do {
  585|  30.6k|        pni_emitter_t emitter = make_emitter_from_buffer(buffer);
  586|  30.6k|        if (pn_amqp_encode_inner_DLESIoBBQDLESIsIoCQsCnMMeQDLESIsIoCMennILnnCe(&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 (586:13): [True: 0, False: 30.6k]
  ------------------
  587|      0|            size_buffer_to_emitter(buffer, &emitter);
  588|      0|            continue;
  589|      0|        }
  590|  30.6k|        return make_bytes_from_emitter(emitter);
  591|  30.6k|    } while (true);
  592|       |    /*Unreachable*/
  593|  30.6k|}
pn_amqp_encode_inner_DLESSQIQHQInnMMCe:
  603|  30.6k|{
  604|  30.6k|    pni_compound_context compound = make_compound();
  605|  30.6k|    emit_descriptor(emitter, &compound, arg0);
  606|  30.6k|    for (bool small_encoding = true; ; small_encoding = false) {
  607|  30.6k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  608|  30.6k|        pni_compound_context compound = c;
  609|  30.6k|        emit_string(emitter, &compound, arg1);
  610|  30.6k|        emit_string(emitter, &compound, arg2);
  611|  30.6k|        if (arg3) {
  ------------------
  |  Branch (611:13): [True: 30.6k, False: 0]
  ------------------
  612|  30.6k|            emit_uint(emitter, &compound, arg4);
  613|  30.6k|        } else {
  614|      0|            emit_null(emitter, &compound);
  615|      0|        }
  616|  30.6k|        if (arg5) {
  ------------------
  |  Branch (616:13): [True: 30.6k, False: 0]
  ------------------
  617|  30.6k|            emit_ushort(emitter, &compound, arg6);
  618|  30.6k|        } else {
  619|      0|            emit_null(emitter, &compound);
  620|      0|        }
  621|  30.6k|        if (arg7) {
  ------------------
  |  Branch (621:13): [True: 0, False: 30.6k]
  ------------------
  622|      0|            emit_uint(emitter, &compound, arg8);
  623|  30.6k|        } else {
  624|  30.6k|            emit_null(emitter, &compound);
  625|  30.6k|        }
  626|  30.6k|        emit_null(emitter, &compound);
  627|  30.6k|        emit_null(emitter, &compound);
  628|  30.6k|        emit_multiple(emitter, &compound, arg9);
  629|  30.6k|        emit_multiple(emitter, &compound, arg10);
  630|  30.6k|        emit_copy(emitter, &compound, arg11);
  631|  30.6k|        emit_end_list(emitter, &compound, small_encoding);
  632|  30.6k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (632:13): [True: 30.6k, False: 0]
  ------------------
  633|  30.6k|    }
  634|  30.6k|    return resize_required(emitter);
  635|  30.6k|}
pn_amqp_encode_DLESSQIQHQInnMMCe:
  638|  30.6k|{
  639|  30.6k|    do {
  640|  30.6k|        pni_emitter_t emitter = make_emitter_from_buffer(buffer);
  641|  30.6k|        if (pn_amqp_encode_inner_DLESSQIQHQInnMMCe(&emitter, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)) {
  ------------------
  |  Branch (641:13): [True: 0, False: 30.6k]
  ------------------
  642|      0|            size_buffer_to_emitter(buffer, &emitter);
  643|      0|            continue;
  644|      0|        }
  645|  30.6k|        return make_bytes_from_emitter(emitter);
  646|  30.6k|    } while (true);
  647|       |    /*Unreachable*/
  648|  30.6k|}
pn_amqp_encode_inner_DLEoIQIQoQDLEee:
  784|   307k|{
  785|   307k|    pni_compound_context compound = make_compound();
  786|   307k|    emit_descriptor(emitter, &compound, arg0);
  787|   307k|    for (bool small_encoding = true; ; small_encoding = false) {
  788|   307k|        pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  789|   307k|        pni_compound_context compound = c;
  790|   307k|        emit_bool(emitter, &compound, arg1);
  791|   307k|        emit_uint(emitter, &compound, arg2);
  792|   307k|        if (arg3) {
  ------------------
  |  Branch (792:13): [True: 64.5k, False: 242k]
  ------------------
  793|  64.5k|            emit_uint(emitter, &compound, arg4);
  794|   242k|        } else {
  795|   242k|            emit_null(emitter, &compound);
  796|   242k|        }
  797|   307k|        if (arg5) {
  ------------------
  |  Branch (797:13): [True: 307k, False: 0]
  ------------------
  798|   307k|            emit_bool(emitter, &compound, arg6);
  799|   307k|        } else {
  800|      0|            emit_null(emitter, &compound);
  801|      0|        }
  802|   307k|        if (arg7) {
  ------------------
  |  Branch (802:13): [True: 307k, False: 0]
  ------------------
  803|   307k|            emit_descriptor(emitter, &compound, arg8);
  804|   307k|            for (bool small_encoding = true; ; small_encoding = false) {
  805|   307k|                pni_compound_context c = emit_list(emitter, &compound, small_encoding, true);
  806|   307k|                pni_compound_context compound = c;
  807|   307k|                emit_end_list(emitter, &compound, small_encoding);
  808|   307k|                if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (808:21): [True: 307k, False: 0]
  ------------------
  809|   307k|            }
  810|   307k|        } else {
  811|      0|            emit_null(emitter, &compound);
  812|      0|        }
  813|   307k|        emit_end_list(emitter, &compound, small_encoding);
  814|   307k|        if (encode_succeeded(emitter, &compound)) break;
  ------------------
  |  Branch (814:13): [True: 307k, False: 0]
  ------------------
  815|   307k|    }
  816|   307k|    return resize_required(emitter);
  817|   307k|}
pn_amqp_encode_DLEoIQIQoQDLEee:
  820|   307k|{
  821|   307k|    do {
  822|   307k|        pni_emitter_t emitter = make_emitter_from_buffer(buffer);
  823|   307k|        if (pn_amqp_encode_inner_DLEoIQIQoQDLEee(&emitter, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) {
  ------------------
  |  Branch (823:13): [True: 0, False: 307k]
  ------------------
  824|      0|            size_buffer_to_emitter(buffer, &emitter);
  825|      0|            continue;
  826|      0|        }
  827|   307k|        return make_bytes_from_emitter(emitter);
  828|   307k|    } while (true);
  829|       |    /*Unreachable*/
  830|   307k|}

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

pn_buffer:
   46|   703k|{
   47|   703k|  pn_buffer_t *buf = (pn_buffer_t *) pni_mem_allocate(PN_CLASSCLASS(pn_buffer), sizeof(pn_buffer_t));
  ------------------
  |  |  101|   703k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   48|   703k|  if (buf != NULL) {
  ------------------
  |  Branch (48:7): [True: 703k, False: 0]
  ------------------
   49|   703k|    buf->capacity = capacity;
   50|   703k|    buf->start = 0;
   51|   703k|    buf->size = 0;
   52|   703k|    if (capacity > 0) {
  ------------------
  |  Branch (52:9): [True: 703k, False: 0]
  ------------------
   53|   703k|        buf->bytes = (char *) pni_mem_suballocate(PN_CLASSCLASS(pn_buffer), buf, capacity);
  ------------------
  |  |  101|   703k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   54|   703k|        if (buf->bytes == NULL) {
  ------------------
  |  Branch (54:13): [True: 0, False: 703k]
  ------------------
   55|      0|            pni_mem_deallocate(PN_CLASSCLASS(pn_buffer), buf);
  ------------------
  |  |  101|      0|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   56|      0|            buf = NULL;
   57|      0|        }
   58|   703k|    }
   59|      0|    else {
   60|      0|        buf->bytes = NULL;
   61|      0|    }
   62|   703k|  }
   63|   703k|  return buf;
   64|   703k|}
pn_buffer_free:
   67|  25.6M|{
   68|  25.6M|  if (buf) {
  ------------------
  |  Branch (68:7): [True: 703k, False: 24.9M]
  ------------------
   69|   703k|    pni_mem_subdeallocate(PN_CLASSCLASS(pn_buffer), buf, buf->bytes);
  ------------------
  |  |  101|   703k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   70|   703k|    pni_mem_deallocate(PN_CLASSCLASS(pn_buffer), buf);
  ------------------
  |  |  101|   703k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
   71|   703k|  }
   72|  25.6M|}
pn_buffer_size:
   75|  2.29M|{
   76|  2.29M|  return buf->size;
   77|  2.29M|}
pn_buffer_capacity:
   80|   142k|{
   81|   142k|  return buf->capacity;
   82|   142k|}
pn_buffer_available:
   85|  2.71M|{
   86|  2.71M|  return buf->capacity - buf->size;
   87|  2.71M|}
pn_buffer_ensure:
  144|  2.00M|{
  145|  2.00M|  size_t old_capacity = buf->capacity;
  146|  2.00M|  size_t old_head = pni_buffer_head(buf);
  147|  2.00M|  bool wrapped = pni_buffer_wrapped(buf);
  148|       |
  149|  2.02M|  while (pn_buffer_available(buf) < size) {
  ------------------
  |  Branch (149:10): [True: 20.7k, False: 2.00M]
  ------------------
  150|  20.7k|    buf->capacity = 2*(buf->capacity ? buf->capacity : 16);
  ------------------
  |  Branch (150:24): [True: 20.7k, False: 0]
  ------------------
  151|  20.7k|  }
  152|       |
  153|  2.00M|  if (buf->capacity != old_capacity) {
  ------------------
  |  Branch (153:7): [True: 6.63k, False: 2.00M]
  ------------------
  154|  6.63k|    char* new_bytes = (char *) pni_mem_subreallocate(PN_CLASSCLASS(pn_buffer), buf, buf->bytes, buf->capacity);
  ------------------
  |  |  101|  6.63k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  155|  6.63k|    if (new_bytes) {
  ------------------
  |  Branch (155:9): [True: 6.63k, False: 0]
  ------------------
  156|  6.63k|      buf->bytes = new_bytes;
  157|       |
  158|  6.63k|      if (wrapped) {
  ------------------
  |  Branch (158:11): [True: 841, False: 5.79k]
  ------------------
  159|    841|          size_t n = old_capacity - old_head;
  160|    841|          memmove(buf->bytes + buf->capacity - n, buf->bytes + old_head, n);
  161|    841|          buf->start = buf->capacity - n;
  162|    841|      }
  163|  6.63k|    }
  164|  6.63k|  }
  165|       |
  166|  2.00M|  return 0;
  167|  2.00M|}
pn_buffer_append:
  170|  4.03M|{
  171|  4.03M|  if (!size) return 0;
  ------------------
  |  Branch (171:7): [True: 2.47M, False: 1.55M]
  ------------------
  172|  1.55M|  int err = pn_buffer_ensure(buf, size);
  173|  1.55M|  if (err) return err;
  ------------------
  |  Branch (173:7): [True: 0, False: 1.55M]
  ------------------
  174|       |
  175|  1.55M|  size_t tail = pni_buffer_tail(buf);
  176|  1.55M|  size_t tail_space = pni_buffer_tail_space(buf);
  177|  1.55M|  size_t n = pn_min(tail_space, size);
  ------------------
  |  |  163|  1.55M|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 1.55M, False: 3.91k]
  |  |  ------------------
  ------------------
  178|       |
  179|       |  // Heuristic check for a strange usage in messenger
  180|  1.55M|  if (bytes!=buf->bytes+tail) {
  ------------------
  |  Branch (180:7): [True: 1.55M, False: 0]
  ------------------
  181|  1.55M|    memcpy(buf->bytes + tail, bytes, n);
  182|  1.55M|    memcpy(buf->bytes, bytes + n, size - n);
  183|  1.55M|  }
  184|  1.55M|  buf->size += size;
  185|       |
  186|  1.55M|  return 0;
  187|  1.55M|}
pn_buffer_get:
  220|  1.23M|{
  221|  1.23M|  size = pn_min(size, buf->size);
  ------------------
  |  |  163|  1.23M|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 1.23M, False: 657]
  |  |  ------------------
  ------------------
  222|  1.23M|  size_t start = pni_buffer_index(buf, offset);
  223|  1.23M|  size_t stop = pni_buffer_index(buf, offset + size);
  224|       |
  225|  1.23M|  if (size == 0) return 0;
  ------------------
  |  Branch (225:7): [True: 672k, False: 565k]
  ------------------
  226|       |
  227|   565k|  size_t sz1;
  228|   565k|  size_t sz2;
  229|       |
  230|   565k|  if (start >= stop) {
  ------------------
  |  Branch (230:7): [True: 332, False: 565k]
  ------------------
  231|    332|    sz1 = buf->capacity - start;
  232|    332|    sz2 = stop;
  233|   565k|  } else {
  234|   565k|    sz1 = stop - start;
  235|   565k|    sz2 = 0;
  236|   565k|  }
  237|       |
  238|   565k|  memcpy(dst, buf->bytes + start, sz1);
  239|   565k|  memcpy(dst + sz1, buf->bytes, sz2);
  240|       |
  241|   565k|  return sz1 + sz2;
  242|  1.23M|}
pn_buffer_trim:
  245|  1.23M|{
  246|  1.23M|  if (left + right > buf->size) return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (246:7): [True: 0, False: 1.23M]
  ------------------
  247|       |
  248|       |  // In special case where we trim everything just clear buffer
  249|  1.23M|  if (left + right == buf->size) {
  ------------------
  |  Branch (249:7): [True: 1.23M, False: 657]
  ------------------
  250|  1.23M|    pn_buffer_clear(buf);
  251|  1.23M|    return 0;
  252|  1.23M|  }
  253|    657|  buf->start += left;
  254|    657|  if (buf->start >= buf->capacity)
  ------------------
  |  Branch (254:7): [True: 151, False: 506]
  ------------------
  255|    151|    buf->start -= buf->capacity;
  256|       |
  257|    657|  buf->size -= left + right;
  258|       |
  259|    657|  return 0;
  260|  1.23M|}
pn_buffer_clear:
  263|  6.48M|{
  264|  6.48M|  buf->start = 0;
  265|  6.48M|  buf->size = 0;
  266|  6.48M|}
pn_buffer_defrag:
  288|  71.1k|{
  289|  71.1k|  pn_buffer_rotate(buf, buf->start);
  290|  71.1k|  buf->start = 0;
  291|  71.1k|  return 0;
  292|  71.1k|}
pn_buffer_memory:
  304|  71.1k|{
  305|  71.1k|  if (!buf) {
  ------------------
  |  Branch (305:7): [True: 0, False: 71.1k]
  ------------------
  306|      0|    return (pn_rwbytes_t){0, NULL};
  307|      0|  }
  308|  71.1k|  pn_buffer_defrag(buf);
  309|  71.1k|  return (pn_rwbytes_t){.size=buf->size, .start=buf->bytes};
  310|  71.1k|}
pn_buffer_free_memory:
  313|   451k|{
  314|   451k|  if (!buf) {
  ------------------
  |  Branch (314:7): [True: 0, False: 451k]
  ------------------
  315|      0|    return (pn_rwbytes_t){0, NULL};
  316|      0|  }
  317|   451k|  size_t free_size = buf->capacity-buf->size;
  318|   451k|  if (buf->start == 0) {
  ------------------
  |  Branch (318:7): [True: 451k, False: 0]
  ------------------
  319|   451k|    return (pn_rwbytes_t){.size=free_size, .start=buf->bytes};
  320|   451k|  }
  321|       |  // If free memory in one single blob don't need to defragment
  322|      0|  if (buf->start+buf->size > buf->capacity) {
  ------------------
  |  Branch (322:7): [True: 0, False: 0]
  ------------------
  323|      0|    return (pn_rwbytes_t){.size=free_size, .start=buf->bytes+buf->start-free_size};
  324|      0|  }
  325|      0|  pn_buffer_defrag(buf);
  326|      0|  return (pn_rwbytes_t){.size=free_size, .start=buf->bytes+buf->start+buf->size};
  327|      0|}
buffer.c:pni_buffer_head:
   90|  4.19M|{
   91|  4.19M|  return buf->start;
   92|  4.19M|}
buffer.c:pni_buffer_wrapped:
  103|  3.56M|{
  104|  3.56M|  return buf->size && pni_buffer_head(buf) >= pni_buffer_tail(buf);
  ------------------
  |  Branch (104:10): [True: 2.18M, False: 1.38M]
  |  Branch (104:23): [True: 572k, False: 1.61M]
  ------------------
  105|  3.56M|}
buffer.c:pni_buffer_tail:
   95|  5.06M|{
   96|  5.06M|  size_t tail = buf->start + buf->size;
   97|  5.06M|  if (tail >= buf->capacity)
  ------------------
  |  Branch (97:7): [True: 802k, False: 4.26M]
  ------------------
   98|   802k|    tail -= buf->capacity;
   99|  5.06M|  return tail;
  100|  5.06M|}
buffer.c:pni_buffer_tail_space:
  108|  1.55M|{
  109|  1.55M|  if (pni_buffer_wrapped(buf)) {
  ------------------
  |  Branch (109:7): [True: 229k, False: 1.32M]
  ------------------
  110|   229k|    return pn_buffer_available(buf);
  111|  1.32M|  } else {
  112|  1.32M|    return buf->capacity - pni_buffer_tail(buf);
  113|  1.32M|  }
  114|  1.55M|}
buffer.c:pni_buffer_index:
  213|  2.47M|{
  214|  2.47M|  size_t result = buf->start + index;
  215|  2.47M|  if (result >= buf->capacity) result -= buf->capacity;
  ------------------
  |  Branch (215:7): [True: 332, False: 2.47M]
  ------------------
  216|  2.47M|  return result;
  217|  2.47M|}
buffer.c:pn_buffer_rotate:
  268|  71.1k|static void pn_buffer_rotate (pn_buffer_t *buf, size_t sz) {
  269|  71.1k|  if (sz == 0) return;
  ------------------
  |  Branch (269:7): [True: 70.5k, False: 645]
  ------------------
  270|       |
  271|    645|  unsigned c = 0, v = 0;
  272|  77.5k|  for (; c < buf->capacity; v++) {
  ------------------
  |  Branch (272:10): [True: 76.9k, False: 645]
  ------------------
  273|  76.9k|    unsigned t = v, tp = v + sz;
  274|  76.9k|    char tmp = buf->bytes[v];
  275|  76.9k|    c++;
  276|   161k|    while (tp != v) {
  ------------------
  |  Branch (276:12): [True: 84.7k, False: 76.9k]
  ------------------
  277|  84.7k|      buf->bytes[t] = buf->bytes[tp];
  278|  84.7k|      t = tp;
  279|  84.7k|      tp += sz;
  280|  84.7k|      if (tp >= buf->capacity) tp -= buf->capacity;
  ------------------
  |  Branch (280:11): [True: 84.7k, False: 0]
  ------------------
  281|  84.7k|      c++;
  282|  84.7k|    }
  283|  76.9k|    buf->bytes[t] = tmp;
  284|  76.9k|  }
  285|    645|}

pn_type_name:
   44|  2.72k|{
   45|  2.72k|  switch (type)
   46|  2.72k|  {
   47|    254|  case PN_NULL: return "PN_NULL";
  ------------------
  |  Branch (47:3): [True: 254, False: 2.47k]
  ------------------
   48|  1.24k|  case PN_BOOL: return "PN_BOOL";
  ------------------
  |  Branch (48:3): [True: 1.24k, False: 1.48k]
  ------------------
   49|      4|  case PN_UBYTE: return "PN_UBYTE";
  ------------------
  |  Branch (49:3): [True: 4, False: 2.72k]
  ------------------
   50|      0|  case PN_BYTE: return "PN_BYTE";
  ------------------
  |  Branch (50:3): [True: 0, False: 2.72k]
  ------------------
   51|      0|  case PN_USHORT: return "PN_USHORT";
  ------------------
  |  Branch (51:3): [True: 0, False: 2.72k]
  ------------------
   52|      0|  case PN_SHORT: return "PN_SHORT";
  ------------------
  |  Branch (52:3): [True: 0, False: 2.72k]
  ------------------
   53|    121|  case PN_UINT: return "PN_UINT";
  ------------------
  |  Branch (53:3): [True: 121, False: 2.60k]
  ------------------
   54|      4|  case PN_INT: return "PN_INT";
  ------------------
  |  Branch (54:3): [True: 4, False: 2.72k]
  ------------------
   55|      0|  case PN_CHAR: return "PN_CHAR";
  ------------------
  |  Branch (55:3): [True: 0, False: 2.72k]
  ------------------
   56|    141|  case PN_ULONG: return "PN_ULONG";
  ------------------
  |  Branch (56:3): [True: 141, False: 2.58k]
  ------------------
   57|      0|  case PN_LONG: return "PN_LONG";
  ------------------
  |  Branch (57:3): [True: 0, False: 2.72k]
  ------------------
   58|      0|  case PN_TIMESTAMP: return "PN_TIMESTAMP";
  ------------------
  |  Branch (58:3): [True: 0, False: 2.72k]
  ------------------
   59|      1|  case PN_FLOAT: return "PN_FLOAT";
  ------------------
  |  Branch (59:3): [True: 1, False: 2.72k]
  ------------------
   60|      1|  case PN_DOUBLE: return "PN_DOUBLE";
  ------------------
  |  Branch (60:3): [True: 1, False: 2.72k]
  ------------------
   61|      0|  case PN_DECIMAL32: return "PN_DECIMAL32";
  ------------------
  |  Branch (61:3): [True: 0, False: 2.72k]
  ------------------
   62|      1|  case PN_DECIMAL64: return "PN_DECIMAL64";
  ------------------
  |  Branch (62:3): [True: 1, False: 2.72k]
  ------------------
   63|      0|  case PN_DECIMAL128: return "PN_DECIMAL128";
  ------------------
  |  Branch (63:3): [True: 0, False: 2.72k]
  ------------------
   64|      0|  case PN_UUID: return "PN_UUID";
  ------------------
  |  Branch (64:3): [True: 0, False: 2.72k]
  ------------------
   65|     19|  case PN_BINARY: return "PN_BINARY";
  ------------------
  |  Branch (65:3): [True: 19, False: 2.70k]
  ------------------
   66|      0|  case PN_STRING: return "PN_STRING";
  ------------------
  |  Branch (66:3): [True: 0, False: 2.72k]
  ------------------
   67|      0|  case PN_SYMBOL: return "PN_SYMBOL";
  ------------------
  |  Branch (67:3): [True: 0, False: 2.72k]
  ------------------
   68|      0|  case PN_DESCRIBED: return "PN_DESCRIBED";
  ------------------
  |  Branch (68:3): [True: 0, False: 2.72k]
  ------------------
   69|      1|  case PN_ARRAY: return "PN_ARRAY";
  ------------------
  |  Branch (69:3): [True: 1, False: 2.72k]
  ------------------
   70|     80|  case PN_LIST: return "PN_LIST";
  ------------------
  |  Branch (70:3): [True: 80, False: 2.64k]
  ------------------
   71|      0|  case PN_MAP: return "PN_MAP";
  ------------------
  |  Branch (71:3): [True: 0, False: 2.72k]
  ------------------
   72|    854|  default: break;
  ------------------
  |  Branch (72:3): [True: 854, False: 1.87k]
  ------------------
   73|  2.72k|  }
   74|       |
   75|    854|  return "<UNKNOWN>";
   76|  2.72k|}
pni_inspect_atom:
  114|  2.63M|{
  115|  2.63M|  switch (atom->type) {
  116|   496k|  case PN_NULL:
  ------------------
  |  Branch (116:3): [True: 496k, False: 2.14M]
  ------------------
  117|   496k|    pn_fixed_string_addf(str, "null");
  118|   496k|    return;
  119|  1.72M|  case PN_BOOL:
  ------------------
  |  Branch (119:3): [True: 1.72M, False: 918k]
  ------------------
  120|  1.72M|    pn_fixed_string_addf(str, atom->u.as_bool ? "true" : "false");
  ------------------
  |  Branch (120:31): [True: 784k, False: 935k]
  ------------------
  121|  1.72M|    return;
  122|    436|  case PN_UBYTE:
  ------------------
  |  Branch (122:3): [True: 436, False: 2.63M]
  ------------------
  123|    436|    pn_fixed_string_addf(str, "%" PRIu8, atom->u.as_ubyte);
  124|    436|    return;
  125|  1.58k|  case PN_BYTE:
  ------------------
  |  Branch (125:3): [True: 1.58k, False: 2.63M]
  ------------------
  126|  1.58k|    pn_fixed_string_addf(str, "%" PRIi8, atom->u.as_byte);
  127|  1.58k|    return;
  128|  5.74k|  case PN_USHORT:
  ------------------
  |  Branch (128:3): [True: 5.74k, False: 2.63M]
  ------------------
  129|  5.74k|    pn_fixed_string_addf(str, "%" PRIu16, atom->u.as_ushort);
  130|  5.74k|    return;
  131|    269|  case PN_SHORT:
  ------------------
  |  Branch (131:3): [True: 269, False: 2.63M]
  ------------------
  132|    269|    pn_fixed_string_addf(str, "%" PRIi16, atom->u.as_short);
  133|    269|    return;
  134|   118k|  case PN_UINT:
  ------------------
  |  Branch (134:3): [True: 118k, False: 2.51M]
  ------------------
  135|   118k|    pn_fixed_string_addf(str, "%" PRIu32, atom->u.as_uint);
  136|   118k|    return;
  137|    691|  case PN_INT:
  ------------------
  |  Branch (137:3): [True: 691, False: 2.63M]
  ------------------
  138|    691|    pn_fixed_string_addf(str, "%" PRIi32, atom->u.as_int);
  139|    691|    return;
  140|    326|  case PN_CHAR:
  ------------------
  |  Branch (140:3): [True: 326, False: 2.63M]
  ------------------
  141|    326|    pn_fixed_string_addf(str, "%c",  atom->u.as_char);
  142|    326|    return;
  143|   286k|  case PN_ULONG:
  ------------------
  |  Branch (143:3): [True: 286k, False: 2.35M]
  ------------------
  144|   286k|    pn_fixed_string_addf(str, "%" PRIu64, atom->u.as_ulong);
  145|   286k|    return;
  146|    362|  case PN_LONG:
  ------------------
  |  Branch (146:3): [True: 362, False: 2.63M]
  ------------------
  147|    362|    pn_fixed_string_addf(str, "%" PRIi64, atom->u.as_long);
  148|    362|    return;
  149|    290|  case PN_TIMESTAMP:
  ------------------
  |  Branch (149:3): [True: 290, False: 2.63M]
  ------------------
  150|    290|    pn_fixed_string_addf(str, "%" PRIi64, atom->u.as_timestamp);
  151|    290|    return;
  152|    262|  case PN_FLOAT:
  ------------------
  |  Branch (152:3): [True: 262, False: 2.63M]
  ------------------
  153|    262|    pn_fixed_string_addf(str, "%g", atom->u.as_float);
  154|    262|    return;
  155|    419|  case PN_DOUBLE:
  ------------------
  |  Branch (155:3): [True: 419, False: 2.63M]
  ------------------
  156|    419|    pn_fixed_string_addf(str, "%g", atom->u.as_double);
  157|    419|    return;
  158|    326|  case PN_DECIMAL32:
  ------------------
  |  Branch (158:3): [True: 326, False: 2.63M]
  ------------------
  159|    326|    pn_fixed_string_addf(str, "D32(%" PRIu32 ")", atom->u.as_decimal32);
  160|    326|    return;
  161|    113|  case PN_DECIMAL64:
  ------------------
  |  Branch (161:3): [True: 113, False: 2.63M]
  ------------------
  162|    113|    pn_fixed_string_addf(str, "D64(%" PRIu64 ")", atom->u.as_decimal64);
  163|    113|    return;
  164|    238|  case PN_DECIMAL128:
  ------------------
  |  Branch (164:3): [True: 238, False: 2.63M]
  ------------------
  165|    238|    pn_fixed_string_addf(str, "D128(%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
  166|    238|                          "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
  167|    238|                          "%02hhx%02hhx)",
  168|    238|                          atom->u.as_decimal128.bytes[0],
  169|    238|                          atom->u.as_decimal128.bytes[1],
  170|    238|                          atom->u.as_decimal128.bytes[2],
  171|    238|                          atom->u.as_decimal128.bytes[3],
  172|    238|                          atom->u.as_decimal128.bytes[4],
  173|    238|                          atom->u.as_decimal128.bytes[5],
  174|    238|                          atom->u.as_decimal128.bytes[6],
  175|    238|                          atom->u.as_decimal128.bytes[7],
  176|    238|                          atom->u.as_decimal128.bytes[8],
  177|    238|                          atom->u.as_decimal128.bytes[9],
  178|    238|                          atom->u.as_decimal128.bytes[10],
  179|    238|                          atom->u.as_decimal128.bytes[11],
  180|    238|                          atom->u.as_decimal128.bytes[12],
  181|    238|                          atom->u.as_decimal128.bytes[13],
  182|    238|                          atom->u.as_decimal128.bytes[14],
  183|    238|                          atom->u.as_decimal128.bytes[15]);
  184|    238|    return;
  185|     92|  case PN_UUID:
  ------------------
  |  Branch (185:3): [True: 92, False: 2.63M]
  ------------------
  186|     92|    pn_fixed_string_addf(str, "UUID(%02hhx%02hhx%02hhx%02hhx-"
  187|     92|                          "%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-"
  188|     92|                          "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx)",
  189|     92|                          atom->u.as_uuid.bytes[0],
  190|     92|                          atom->u.as_uuid.bytes[1],
  191|     92|                          atom->u.as_uuid.bytes[2],
  192|     92|                          atom->u.as_uuid.bytes[3],
  193|     92|                          atom->u.as_uuid.bytes[4],
  194|     92|                          atom->u.as_uuid.bytes[5],
  195|     92|                          atom->u.as_uuid.bytes[6],
  196|     92|                          atom->u.as_uuid.bytes[7],
  197|     92|                          atom->u.as_uuid.bytes[8],
  198|     92|                          atom->u.as_uuid.bytes[9],
  199|     92|                          atom->u.as_uuid.bytes[10],
  200|     92|                          atom->u.as_uuid.bytes[11],
  201|     92|                          atom->u.as_uuid.bytes[12],
  202|     92|                          atom->u.as_uuid.bytes[13],
  203|     92|                          atom->u.as_uuid.bytes[14],
  204|     92|                          atom->u.as_uuid.bytes[15]);
  205|     92|    return;
  206|  1.38k|  case PN_BINARY:
  ------------------
  |  Branch (206:3): [True: 1.38k, False: 2.63M]
  ------------------
  207|  2.04k|  case PN_STRING:
  ------------------
  |  Branch (207:3): [True: 668, False: 2.63M]
  ------------------
  208|  4.84k|  case PN_SYMBOL:
  ------------------
  |  Branch (208:3): [True: 2.79k, False: 2.63M]
  ------------------
  209|  4.84k|    {
  210|  4.84k|      const char *pfx;
  211|  4.84k|      pn_bytes_t bin = atom->u.as_bytes;
  212|  4.84k|      bool quote;
  213|  4.84k|      switch (atom->type) {
  214|  1.38k|      case PN_BINARY:
  ------------------
  |  Branch (214:7): [True: 1.38k, False: 3.46k]
  ------------------
  215|  1.38k|        pfx = "b";
  216|  1.38k|        quote = true;
  217|  1.38k|        break;
  218|    668|      case PN_STRING:
  ------------------
  |  Branch (218:7): [True: 668, False: 4.17k]
  ------------------
  219|    668|        pfx = "";
  220|    668|        quote = true;
  221|    668|        break;
  222|  2.79k|      case PN_SYMBOL:
  ------------------
  |  Branch (222:7): [True: 2.79k, False: 2.04k]
  ------------------
  223|  2.79k|        pfx = ":";
  224|  2.79k|        quote = false;
  225|  4.75k|        for (unsigned i = 0; i < bin.size; i++) {
  ------------------
  |  Branch (225:30): [True: 2.92k, False: 1.82k]
  ------------------
  226|  2.92k|          if (!isalpha(bin.start[i])) {
  ------------------
  |  Branch (226:15): [True: 966, False: 1.95k]
  ------------------
  227|    966|            quote = true;
  228|    966|            break;
  229|    966|          }
  230|  2.92k|        }
  231|  2.79k|        break;
  232|      0|      default:
  ------------------
  |  Branch (232:7): [True: 0, False: 4.84k]
  ------------------
  233|      0|        assert(false);
  234|      0|        return;
  235|  4.84k|      }
  236|       |
  237|  4.84k|      pn_fixed_string_addf(str, "%s", pfx);
  238|  4.84k|      if (quote) pn_fixed_string_addf(str, "\"");
  ------------------
  |  Branch (238:11): [True: 3.01k, False: 1.82k]
  ------------------
  239|  4.84k|      pn_fixed_string_quote(str, bin.start, bin.size);
  240|  4.84k|      if (quote) pn_fixed_string_addf(str, "\"");
  ------------------
  |  Branch (240:11): [True: 3.01k, False: 1.82k]
  ------------------
  241|  4.84k|      return;
  242|  4.84k|    }
  243|      0|  case PN_LIST:
  ------------------
  |  Branch (243:3): [True: 0, False: 2.63M]
  ------------------
  244|      0|    pn_fixed_string_addf(str, "<list>");
  245|      0|    return;
  246|      0|  case PN_MAP:
  ------------------
  |  Branch (246:3): [True: 0, False: 2.63M]
  ------------------
  247|      0|    pn_fixed_string_addf(str, "<map>");
  248|      0|    return;
  249|      0|  case PN_ARRAY:
  ------------------
  |  Branch (249:3): [True: 0, False: 2.63M]
  ------------------
  250|      0|    pn_fixed_string_addf(str, "<array>");
  251|      0|    return;
  252|      0|  case PN_DESCRIBED:
  ------------------
  |  Branch (252:3): [True: 0, False: 2.63M]
  ------------------
  253|      0|    pn_fixed_string_addf(str, "<described>");
  254|      0|    return;
  255|      0|  default:
  ------------------
  |  Branch (255:3): [True: 0, False: 2.63M]
  ------------------
  256|      0|    pn_fixed_string_addf(str, "<undefined: %i>", atom->type);
  257|      0|    return;
  258|  2.63M|  }
  259|  2.63M|}
pni_inspect_enter:
  273|  3.64M|{
  274|  3.64M|  pn_fixed_string_t *str = (pn_fixed_string_t *) ctx;
  275|  3.64M|  pn_atom_t *atom = (pn_atom_t *) &node->atom;
  276|       |
  277|  3.64M|  pni_node_t *parent = pn_data_node(data, node->parent);
  278|  3.64M|  const pn_fields_t *fields = pni_node_fields(data, parent);
  279|  3.64M|  pni_node_t *grandparent = parent ? pn_data_node(data, parent->parent) : NULL;
  ------------------
  |  Branch (279:29): [True: 3.27M, False: 366k]
  ------------------
  280|  3.64M|  const pn_fields_t *grandfields = pni_node_fields(data, grandparent);
  281|       |
  282|  3.64M|  if (grandfields) {
  ------------------
  |  Branch (282:7): [True: 79.7k, False: 3.56M]
  ------------------
  283|  79.7k|    if (atom->type == PN_NULL) {
  ------------------
  |  Branch (283:9): [True: 1.96k, False: 77.7k]
  ------------------
  284|  1.96k|      return 0;
  285|  1.96k|    }
  286|  77.7k|    pni_nid_t lindex = pni_node_lindex(data, node);
  287|  77.7k|    const char *name = (lindex < grandfields->field_count)
  ------------------
  |  Branch (287:24): [True: 2.74k, False: 75.0k]
  ------------------
  288|  77.7k|        ? (const char*)FIELD_STRINGPOOL.STRING0+FIELD_FIELDS[grandfields->first_field_index+lindex]
  289|  77.7k|        : NULL;
  290|  77.7k|    if (name) {
  ------------------
  |  Branch (290:9): [True: 2.74k, False: 75.0k]
  ------------------
  291|  2.74k|      pn_fixed_string_addf(str, "%s=", name);
  292|  2.74k|    }
  293|  77.7k|  }
  294|       |
  295|  3.64M|  switch (atom->type) {
  296|   370k|  case PN_DESCRIBED:
  ------------------
  |  Branch (296:3): [True: 370k, False: 3.27M]
  ------------------
  297|   370k|    pn_fixed_string_addf(str, "@");
  298|   370k|    return 0;
  299|  2.72k|  case PN_ARRAY:
  ------------------
  |  Branch (299:3): [True: 2.72k, False: 3.63M]
  ------------------
  300|       |    // XXX: need to fix for described arrays
  301|  2.72k|    pn_fixed_string_addf(str, "@%s[", pn_type_name(node->type));
  302|  2.72k|    return 0;
  303|   625k|  case PN_LIST:
  ------------------
  |  Branch (303:3): [True: 625k, False: 3.01M]
  ------------------
  304|   625k|    pn_fixed_string_addf(str, "[");
  305|   625k|    return 0;
  306|  2.80k|  case PN_MAP:
  ------------------
  |  Branch (306:3): [True: 2.80k, False: 3.63M]
  ------------------
  307|  2.80k|    pn_fixed_string_addf(str, "{");
  308|  2.80k|    return 0;
  309|  2.63M|  default:
  ------------------
  |  Branch (309:3): [True: 2.63M, False: 1.00M]
  ------------------
  310|  2.63M|    if (fields && node->prev == 0) {
  ------------------
  |  Branch (310:9): [True: 8.90k, False: 2.63M]
  |  Branch (310:19): [True: 6.60k, False: 2.29k]
  ------------------
  311|  6.60k|      pn_fixed_string_addf(str, "%s", (const char *)FIELD_STRINGPOOL.STRING0+FIELD_NAME[fields->name_index]);
  312|  6.60k|      pn_fixed_string_addf(str, "(");
  313|  6.60k|      pni_inspect_atom(atom, str);
  314|  6.60k|      pn_fixed_string_addf(str, ")");
  315|  6.60k|      return 0;
  316|  2.63M|    } else {
  317|  2.63M|      pni_inspect_atom(atom, str);
  318|  2.63M|      return 0;
  319|  2.63M|    }
  320|  3.64M|  }
  321|  3.64M|}
pni_next_nonnull:
  324|  72.7k|{
  325|  74.1k|  while (node) {
  ------------------
  |  Branch (325:10): [True: 73.5k, False: 536]
  ------------------
  326|  73.5k|    node = pn_data_node(data, node->next);
  327|  73.5k|    if (node && node->atom.type != PN_NULL) {
  ------------------
  |  Branch (327:9): [True: 73.0k, False: 536]
  |  Branch (327:17): [True: 72.1k, False: 879]
  ------------------
  328|  72.1k|      return node;
  329|  72.1k|    }
  330|  73.5k|  }
  331|       |
  332|    536|  return NULL;
  333|  72.7k|}
pni_inspect_exit:
  336|  3.64M|{
  337|  3.64M|  pn_fixed_string_t *str = (pn_fixed_string_t *) ctx;
  338|       |
  339|  3.64M|  switch (node->atom.type) {
  340|  2.72k|  case PN_ARRAY:
  ------------------
  |  Branch (340:3): [True: 2.72k, False: 3.64M]
  ------------------
  341|   628k|  case PN_LIST:
  ------------------
  |  Branch (341:3): [True: 625k, False: 3.01M]
  ------------------
  342|   628k|    pn_fixed_string_addf(str, "]");
  343|   628k|    break;
  344|  2.80k|  case PN_MAP:
  ------------------
  |  Branch (344:3): [True: 2.80k, False: 3.64M]
  ------------------
  345|  2.80k|    pn_fixed_string_addf(str, "}");
  346|  2.80k|    break;
  347|  3.01M|  default:
  ------------------
  |  Branch (347:3): [True: 3.01M, False: 631k]
  ------------------
  348|  3.01M|    break;
  349|  3.64M|  }
  350|       |
  351|  3.64M|  pni_node_t *parent = pn_data_node(data, node->parent);
  352|  3.64M|  pni_node_t *grandparent = parent ? pn_data_node(data, parent->parent) : NULL;
  ------------------
  |  Branch (352:29): [True: 3.27M, False: 366k]
  ------------------
  353|  3.64M|  const pn_fields_t *grandfields = pni_node_fields(data, grandparent);
  354|  3.64M|  if (!grandfields || node->atom.type != PN_NULL) {
  ------------------
  |  Branch (354:7): [True: 3.56M, False: 79.7k]
  |  Branch (354:23): [True: 77.7k, False: 1.96k]
  ------------------
  355|  3.64M|    if (node->next) {
  ------------------
  |  Branch (355:9): [True: 3.24M, False: 393k]
  ------------------
  356|  3.24M|      if (parent && parent->atom.type == PN_MAP && (pni_node_lindex(data, node) % 2) == 0) {
  ------------------
  |  Branch (356:11): [True: 3.24M, False: 0]
  |  Branch (356:21): [True: 5.71k, False: 3.24M]
  |  Branch (356:52): [True: 3.38k, False: 2.33k]
  ------------------
  357|  3.38k|        pn_fixed_string_addf(str, "=");
  358|  3.24M|      } else if (parent && parent->atom.type == PN_DESCRIBED && node->prev == 0) {
  ------------------
  |  Branch (358:18): [True: 3.24M, False: 0]
  |  Branch (358:28): [True: 17.6k, False: 3.22M]
  |  Branch (358:65): [True: 13.9k, False: 3.67k]
  ------------------
  359|  13.9k|        pn_fixed_string_addf(str, " ");
  360|  3.22M|      } else {
  361|  3.22M|        if (!grandfields || pni_next_nonnull(data, node)) {
  ------------------
  |  Branch (361:13): [True: 3.15M, False: 72.7k]
  |  Branch (361:29): [True: 72.1k, False: 536]
  ------------------
  362|  3.22M|          pn_fixed_string_addf(str, ", ");
  363|  3.22M|        }
  364|  3.22M|      }
  365|  3.24M|    }
  366|  3.64M|  }
  367|       |
  368|  3.64M|  return 0;
  369|  3.64M|}
pn_data:
  391|  24.9M|{
  392|  24.9M|  static const pn_class_t clazz = PN_CLASS(pn_data);
  ------------------
  |  |   66|  24.9M|#define PN_CLASS(PREFIX) {                      \
  |  |   67|  24.9M|    #PREFIX,                                    \
  |  |   68|  24.9M|    CID_ ## PREFIX,                             \
  |  |   69|  24.9M|    NULL,                                       \
  |  |   70|  24.9M|    PREFIX ## _initialize,                      \
  |  |   71|  24.9M|    NULL,                                       \
  |  |   72|  24.9M|    NULL,                                       \
  |  |   73|  24.9M|    NULL,                                       \
  |  |   74|  24.9M|    PREFIX ## _finalize,                        \
  |  |   75|  24.9M|    NULL,                                       \
  |  |   76|  24.9M|    PREFIX ## _hashcode,                        \
  |  |   77|  24.9M|    PREFIX ## _compare,                         \
  |  |   78|  24.9M|    PREFIX ## _inspect                          \
  |  |   79|  24.9M|}
  ------------------
  393|  24.9M|  pn_data_t *data = (pn_data_t *) pn_class_new(&clazz, sizeof(pn_data_t));
  394|  24.9M|  data->capacity = capacity;
  395|  24.9M|  data->size = 0;
  396|  24.9M|  data->nodes = capacity ? (pni_node_t *) pni_mem_suballocate(&clazz, data, capacity * sizeof(pni_node_t)) : NULL;
  ------------------
  |  Branch (396:17): [True: 2.02M, False: 22.9M]
  ------------------
  397|  24.9M|  data->buf = NULL;
  398|  24.9M|  data->parent = 0;
  399|  24.9M|  data->current = 0;
  400|  24.9M|  data->base_parent = 0;
  401|  24.9M|  data->base_current = 0;
  402|  24.9M|  data->error = NULL;
  403|  24.9M|  return data;
  404|  24.9M|}
pn_data_free:
  407|  6.52M|{
  408|  6.52M|  pn_free(data);
  409|  6.52M|}
pn_data_error:
  417|   367k|{
  418|   367k|  return pni_data_error(data);
  419|   367k|}
pn_data_size:
  422|   297k|{
  423|   297k|  return data ? data->size : 0;
  ------------------
  |  Branch (423:10): [True: 297k, False: 0]
  ------------------
  424|   297k|}
pn_data_clear:
  427|  12.9M|{
  428|  12.9M|  if (data) {
  ------------------
  |  Branch (428:7): [True: 12.9M, False: 0]
  ------------------
  429|  12.9M|    data->size = 0;
  430|  12.9M|    data->parent = 0;
  431|  12.9M|    data->current = 0;
  432|  12.9M|    data->base_parent = 0;
  433|  12.9M|    data->base_current = 0;
  434|  12.9M|    if (data->buf) pn_buffer_clear(data->buf);
  ------------------
  |  Branch (434:9): [True: 152k, False: 12.7M]
  ------------------
  435|  12.9M|  }
  436|  12.9M|}
pn_data_rewind:
 1274|  8.28M|{
 1275|  8.28M|  data->parent = data->base_parent;
 1276|  8.28M|  data->current = data->base_current;
 1277|  8.28M|}
pni_data_traverse:
 1376|   507k|{
 1377|   507k|  pni_node_t *node = data->size ? pn_data_node(data, 1) : NULL;
  ------------------
  |  Branch (1377:22): [True: 366k, False: 140k]
  ------------------
 1378|  4.15M|  while (node) {
  ------------------
  |  Branch (1378:10): [True: 3.64M, False: 507k]
  ------------------
 1379|  3.64M|    pni_node_t *parent = pn_data_node(data, node->parent);
 1380|       |
 1381|  3.64M|    int err = enter(ctx, data, node);
 1382|  3.64M|    if (err) return err;
  ------------------
  |  Branch (1382:9): [True: 0, False: 3.64M]
  ------------------
 1383|       |
 1384|  3.64M|    size_t next = 0;
 1385|  3.64M|    if (node->down) {
  ------------------
  |  Branch (1385:9): [True: 27.8k, False: 3.61M]
  ------------------
 1386|  27.8k|      next = node->down;
 1387|  3.61M|    } else if (node->next) {
  ------------------
  |  Branch (1387:16): [True: 3.24M, False: 373k]
  ------------------
 1388|  3.24M|      err = exit(ctx, data, node);
 1389|  3.24M|      if (err) return err;
  ------------------
  |  Branch (1389:11): [True: 0, False: 3.24M]
  ------------------
 1390|  3.24M|      next = node->next;
 1391|  3.24M|    } else {
 1392|   373k|      err = exit(ctx, data, node);
 1393|   373k|      if (err) return err;
  ------------------
  |  Branch (1393:11): [True: 0, False: 373k]
  ------------------
 1394|   394k|      while (parent) {
  ------------------
  |  Branch (1394:14): [True: 27.8k, False: 366k]
  ------------------
 1395|  27.8k|        err = exit(ctx, data, parent);
 1396|  27.8k|        if (err) return err;
  ------------------
  |  Branch (1396:13): [True: 0, False: 27.8k]
  ------------------
 1397|  27.8k|        if (parent->next) {
  ------------------
  |  Branch (1397:13): [True: 6.55k, False: 21.3k]
  ------------------
 1398|  6.55k|          next = parent->next;
 1399|  6.55k|          break;
 1400|  21.3k|        } else {
 1401|  21.3k|          parent = pn_data_node(data, parent->parent);
 1402|  21.3k|        }
 1403|  27.8k|      }
 1404|   373k|    }
 1405|       |
 1406|  3.64M|    node = pn_data_node(data, next);
 1407|  3.64M|  }
 1408|       |
 1409|   507k|  return 0;
 1410|   507k|}
pni_data_parent_type:
 1423|   916k|{
 1424|   916k|  pni_node_t *node = pn_data_node(data, data->parent);
 1425|   916k|  if (node) {
  ------------------
  |  Branch (1425:7): [True: 235k, False: 680k]
  ------------------
 1426|   235k|    return node->atom.type;
 1427|   680k|  } else {
 1428|   680k|    return PN_INVALID;
 1429|   680k|  }
 1430|   916k|}
pn_data_siblings:
 1433|   129k|{
 1434|   129k|  pni_node_t *node = pn_data_node(data, data->parent);
 1435|   129k|  if (node) {
  ------------------
  |  Branch (1435:7): [True: 129k, False: 0]
  ------------------
 1436|   129k|    return node->children;
 1437|   129k|  } else {
 1438|      0|    return 0;
 1439|      0|  }
 1440|   129k|}
pn_data_enter:
 1443|  1.28M|{
 1444|  1.28M|  if (data->current) {
  ------------------
  |  Branch (1444:7): [True: 1.28M, False: 0]
  ------------------
 1445|  1.28M|    data->parent = data->current;
 1446|  1.28M|    data->current = 0;
 1447|  1.28M|    return true;
 1448|  1.28M|  } else {
 1449|      0|    return false;
 1450|      0|  }
 1451|  1.28M|}
pn_data_exit:
 1454|  54.4k|{
 1455|  54.4k|  if (data->parent) {
  ------------------
  |  Branch (1455:7): [True: 54.4k, False: 0]
  ------------------
 1456|  54.4k|    pni_node_t *parent = pn_data_node(data, data->parent);
 1457|  54.4k|    data->current = data->parent;
 1458|  54.4k|    data->parent = parent->parent;
 1459|  54.4k|    return true;
 1460|  54.4k|  } else {
 1461|      0|    return false;
 1462|      0|  }
 1463|  54.4k|}
pn_data_decode:
 1591|  1.05M|{
 1592|  1.05M|  pn_decoder_t decoder;
 1593|  1.05M|  pn_decoder_initialize(&decoder);
 1594|  1.05M|  ssize_t r = pn_decoder_decode(&decoder, bytes, size, data);
 1595|  1.05M|  pn_decoder_finalize(&decoder);
 1596|  1.05M|  return r;
 1597|  1.05M|}
pn_data_put_list:
 1600|  61.3M|{
 1601|  61.3M|  pni_node_t *node = pni_data_add(data);
 1602|  61.3M|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|    875|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1602:7): [True: 875, False: 61.3M]
  ------------------
 1603|  61.3M|  node->atom.type = PN_LIST;
 1604|  61.3M|  return 0;
 1605|  61.3M|}
pn_data_put_map:
 1608|   245k|{
 1609|   245k|  pni_node_t *node = pni_data_add(data);
 1610|   245k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|    376|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1610:7): [True: 376, False: 245k]
  ------------------
 1611|   245k|  node->atom.type = PN_MAP;
 1612|   245k|  return 0;
 1613|   245k|}
pn_data_put_array:
 1616|  29.3k|{
 1617|  29.3k|  pni_node_t *node = pni_data_add(data);
 1618|  29.3k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     95|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1618:7): [True: 95, False: 29.2k]
  ------------------
 1619|  29.2k|  node->atom.type = PN_ARRAY;
 1620|  29.2k|  node->described = described;
 1621|  29.2k|  node->type = type;
 1622|  29.2k|  return 0;
 1623|  29.3k|}
pni_data_set_array_type:
 1626|  12.4k|{
 1627|  12.4k|  pni_node_t *array = pni_data_current(data);
 1628|  12.4k|  if (array) array->type = type;
  ------------------
  |  Branch (1628:7): [True: 12.4k, False: 0]
  ------------------
 1629|  12.4k|}
pn_data_put_described:
 1632|   496k|{
 1633|   496k|  pni_node_t *node = pni_data_add(data);
 1634|   496k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     89|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1634:7): [True: 89, False: 496k]
  ------------------
 1635|   496k|  node->atom.type = PN_DESCRIBED;
 1636|   496k|  return 0;
 1637|   496k|}
pn_data_put_null:
 1640|  25.2M|{
 1641|  25.2M|  pni_node_t *node = pni_data_add(data);
 1642|  25.2M|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|    212|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1642:7): [True: 212, False: 25.2M]
  ------------------
 1643|  25.2M|  pni_atom_init(&node->atom, PN_NULL);
 1644|  25.2M|  return 0;
 1645|  25.2M|}
pn_data_put_bool:
 1648|  39.7M|{
 1649|  39.7M|  pni_node_t *node = pni_data_add(data);
 1650|  39.7M|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|    324|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1650:7): [True: 324, False: 39.7M]
  ------------------
 1651|  39.7M|  node->atom.type = PN_BOOL;
 1652|  39.7M|  node->atom.u.as_bool = b;
 1653|  39.7M|  return 0;
 1654|  39.7M|}
pn_data_put_ubyte:
 1657|  30.7k|{
 1658|  30.7k|  pni_node_t *node = pni_data_add(data);
 1659|  30.7k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|    295|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1659:7): [True: 295, False: 30.4k]
  ------------------
 1660|  30.4k|  node->atom.type = PN_UBYTE;
 1661|  30.4k|  node->atom.u.as_ubyte = ub;
 1662|  30.4k|  return 0;
 1663|  30.7k|}
pn_data_put_byte:
 1666|  39.4k|{
 1667|  39.4k|  pni_node_t *node = pni_data_add(data);
 1668|  39.4k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|    197|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1668:7): [True: 197, False: 39.2k]
  ------------------
 1669|  39.2k|  node->atom.type = PN_BYTE;
 1670|  39.2k|  node->atom.u.as_byte = b;
 1671|  39.2k|  return 0;
 1672|  39.4k|}
pn_data_put_ushort:
 1675|  14.1k|{
 1676|  14.1k|  pni_node_t *node = pni_data_add(data);
 1677|  14.1k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     79|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1677:7): [True: 79, False: 14.0k]
  ------------------
 1678|  14.0k|  node->atom.type = PN_USHORT;
 1679|  14.0k|  node->atom.u.as_ushort = us;
 1680|  14.0k|  return 0;
 1681|  14.1k|}
pn_data_put_short:
 1684|  6.49k|{
 1685|  6.49k|  pni_node_t *node = pni_data_add(data);
 1686|  6.49k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     71|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1686:7): [True: 71, False: 6.42k]
  ------------------
 1687|  6.42k|  node->atom.type = PN_SHORT;
 1688|  6.42k|  node->atom.u.as_short = s;
 1689|  6.42k|  return 0;
 1690|  6.49k|}
pn_data_put_uint:
 1693|   174M|{
 1694|   174M|  pni_node_t *node = pni_data_add(data);
 1695|   174M|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|    309|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1695:7): [True: 309, False: 174M]
  ------------------
 1696|   174M|  node->atom.type = PN_UINT;
 1697|   174M|  node->atom.u.as_uint = ui;
 1698|   174M|  return 0;
 1699|   174M|}
pn_data_put_int:
 1702|  16.3k|{
 1703|  16.3k|  pni_node_t *node = pni_data_add(data);
 1704|  16.3k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|    205|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1704:7): [True: 205, False: 16.1k]
  ------------------
 1705|  16.1k|  node->atom.type = PN_INT;
 1706|  16.1k|  node->atom.u.as_int = i;
 1707|  16.1k|  return 0;
 1708|  16.3k|}
pn_data_put_char:
 1711|  8.25k|{
 1712|  8.25k|  pni_node_t *node = pni_data_add(data);
 1713|  8.25k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     70|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1713:7): [True: 70, False: 8.18k]
  ------------------
 1714|  8.18k|  node->atom.type = PN_CHAR;
 1715|  8.18k|  node->atom.u.as_char = c;
 1716|  8.18k|  return 0;
 1717|  8.25k|}
pn_data_put_ulong:
 1720|  27.1M|{
 1721|  27.1M|  pni_node_t *node = pni_data_add(data);
 1722|  27.1M|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|    271|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1722:7): [True: 271, False: 27.1M]
  ------------------
 1723|  27.1M|  node->atom.type = PN_ULONG;
 1724|  27.1M|  node->atom.u.as_ulong = ul;
 1725|  27.1M|  return 0;
 1726|  27.1M|}
pn_data_put_long:
 1729|  23.1k|{
 1730|  23.1k|  pni_node_t *node = pni_data_add(data);
 1731|  23.1k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|    200|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1731:7): [True: 200, False: 22.9k]
  ------------------
 1732|  22.9k|  node->atom.type = PN_LONG;
 1733|  22.9k|  node->atom.u.as_long = l;
 1734|  22.9k|  return 0;
 1735|  23.1k|}
pn_data_put_timestamp:
 1738|  4.81k|{
 1739|  4.81k|  pni_node_t *node = pni_data_add(data);
 1740|  4.81k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     78|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1740:7): [True: 78, False: 4.74k]
  ------------------
 1741|  4.74k|  node->atom.type = PN_TIMESTAMP;
 1742|  4.74k|  node->atom.u.as_timestamp = t;
 1743|  4.74k|  return 0;
 1744|  4.81k|}
pn_data_put_float:
 1747|  4.82k|{
 1748|  4.82k|  pni_node_t *node = pni_data_add(data);
 1749|  4.82k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     80|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1749:7): [True: 80, False: 4.74k]
  ------------------
 1750|  4.74k|  node->atom.type = PN_FLOAT;
 1751|  4.74k|  node->atom.u.as_float = f;
 1752|  4.74k|  return 0;
 1753|  4.82k|}
pn_data_put_double:
 1756|  2.79k|{
 1757|  2.79k|  pni_node_t *node = pni_data_add(data);
 1758|  2.79k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     73|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1758:7): [True: 73, False: 2.72k]
  ------------------
 1759|  2.72k|  node->atom.type = PN_DOUBLE;
 1760|  2.72k|  node->atom.u.as_double = d;
 1761|  2.72k|  return 0;
 1762|  2.79k|}
pn_data_put_decimal32:
 1765|  2.68k|{
 1766|  2.68k|  pni_node_t *node = pni_data_add(data);
 1767|  2.68k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     71|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1767:7): [True: 71, False: 2.61k]
  ------------------
 1768|  2.61k|  node->atom.type = PN_DECIMAL32;
 1769|  2.61k|  node->atom.u.as_decimal32 = d;
 1770|  2.61k|  return 0;
 1771|  2.68k|}
pn_data_put_decimal64:
 1774|  2.05k|{
 1775|  2.05k|  pni_node_t *node = pni_data_add(data);
 1776|  2.05k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     74|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1776:7): [True: 74, False: 1.97k]
  ------------------
 1777|  1.97k|  node->atom.type = PN_DECIMAL64;
 1778|  1.97k|  node->atom.u.as_decimal64 = d;
 1779|  1.97k|  return 0;
 1780|  2.05k|}
pn_data_put_decimal128:
 1783|  1.92k|{
 1784|  1.92k|  pni_node_t *node = pni_data_add(data);
 1785|  1.92k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     77|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1785:7): [True: 77, False: 1.85k]
  ------------------
 1786|  1.85k|  node->atom.type = PN_DECIMAL128;
 1787|  1.85k|  memmove(node->atom.u.as_decimal128.bytes, d.bytes, 16);
 1788|  1.85k|  return 0;
 1789|  1.92k|}
pn_data_put_uuid:
 1792|  2.41k|{
 1793|  2.41k|  pni_node_t *node = pni_data_add(data);
 1794|  2.41k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     69|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1794:7): [True: 69, False: 2.34k]
  ------------------
 1795|  2.34k|  node->atom.type = PN_UUID;
 1796|  2.34k|  memmove(node->atom.u.as_uuid.bytes, u.bytes, 16);
 1797|  2.34k|  return 0;
 1798|  2.41k|}
pn_data_put_binary:
 1801|  37.6k|{
 1802|  37.6k|  pni_node_t *node = pni_data_add(data);
 1803|  37.6k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     69|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1803:7): [True: 69, False: 37.5k]
  ------------------
 1804|  37.5k|  node->atom.type = PN_BINARY;
 1805|  37.5k|  node->atom.u.as_bytes = bytes;
 1806|  37.5k|  return pni_data_intern_node(data, node);
 1807|  37.6k|}
pn_data_put_string:
 1810|  22.4k|{
 1811|  22.4k|  pni_node_t *node = pni_data_add(data);
 1812|  22.4k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     78|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1812:7): [True: 78, False: 22.3k]
  ------------------
 1813|  22.3k|  node->atom.type = PN_STRING;
 1814|  22.3k|  node->atom.u.as_bytes = string;
 1815|  22.3k|  return pni_data_intern_node(data, node);
 1816|  22.4k|}
pn_data_put_symbol:
 1819|  11.2k|{
 1820|  11.2k|  pni_node_t *node = pni_data_add(data);
 1821|  11.2k|  if (node == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|     70|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (1821:7): [True: 70, False: 11.2k]
  ------------------
 1822|  11.2k|  node->atom.type = PN_SYMBOL;
 1823|  11.2k|  node->atom.u.as_bytes = symbol;
 1824|  11.2k|  return pni_data_intern_node(data, node);
 1825|  11.2k|}
codec.c:pni_node_fields:
   95|  10.9M|{
   96|  10.9M|  if (!node) return NULL;
  ------------------
  |  Branch (96:7): [True: 2.34M, False: 8.58M]
  ------------------
   97|  8.58M|  if (node->atom.type != PN_DESCRIBED) return NULL;
  ------------------
  |  Branch (97:7): [True: 8.32M, False: 259k]
  ------------------
   98|       |
   99|   259k|  pni_node_t *descriptor = pn_data_node(data, node->down);
  100|       |
  101|   259k|  if (!descriptor || descriptor->atom.type != PN_ULONG) {
  ------------------
  |  Branch (101:7): [True: 0, False: 259k]
  |  Branch (101:22): [True: 68.8k, False: 190k]
  ------------------
  102|  68.8k|    return NULL;
  103|  68.8k|  }
  104|       |
  105|   190k|  if (descriptor->atom.u.as_ulong >= FIELD_MIN && descriptor->atom.u.as_ulong <= FIELD_MAX) {
  ------------------
  |  Branch (105:7): [True: 183k, False: 7.02k]
  |  Branch (105:51): [True: 177k, False: 5.60k]
  ------------------
  106|   177k|    const pn_fields_t *f = &FIELDS[descriptor->atom.u.as_ulong-FIELD_MIN];
  107|   177k|    return (f->name_index!=0) ? f : NULL;
  ------------------
  |  Branch (107:12): [True: 174k, False: 3.15k]
  ------------------
  108|   177k|  } else {
  109|  12.6k|    return NULL;
  110|  12.6k|  }
  111|   190k|}
codec.c:pni_node_lindex:
  263|  83.5k|{
  264|  83.5k|  int count = 0;
  265|  1.22G|  while (node) {
  ------------------
  |  Branch (265:10): [True: 1.22G, False: 83.5k]
  ------------------
  266|  1.22G|    node = pn_data_node(data, node->prev);
  267|  1.22G|    count++;
  268|  1.22G|  }
  269|  83.5k|  return count - 1;
  270|  83.5k|}
codec.c:pn_data_finalize:
   87|  24.9M|{
   88|  24.9M|  pn_data_t *data = (pn_data_t *) object;
   89|  24.9M|  pni_mem_subdeallocate(pn_class(data), data, data->nodes);
   90|  24.9M|  pn_buffer_free(data->buf);
   91|  24.9M|  pn_error_free(data->error);
   92|  24.9M|}
codec.c:pn_data_inspect:
  372|   507k|{
  373|   507k|  pn_data_t *data = (pn_data_t *) obj;
  374|       |
  375|   507k|  pni_data_traverse(data, pni_inspect_enter, pni_inspect_exit, dst);
  376|   507k|}
codec.c:pni_data_error:
  383|   367k|{
  384|   367k|  if (data->error == NULL) {
  ------------------
  |  Branch (384:7): [True: 352k, False: 15.6k]
  ------------------
  385|   352k|    data->error = pn_error();
  386|   352k|  }
  387|   367k|  return data->error;
  388|   367k|}
codec.c:pni_data_current:
 1280|   656M|{
 1281|   656M|  return pn_data_node(data, data->current);
 1282|   656M|}
codec.c:pni_data_add:
 1513|   329M|{
 1514|   329M|  pni_node_t *current = pni_data_current(data);
 1515|   329M|  pni_node_t *parent = pn_data_node(data, data->parent);
 1516|   329M|  pni_node_t *node;
 1517|       |
 1518|   329M|  if (current) {
  ------------------
  |  Branch (1518:7): [True: 327M, False: 1.57M]
  ------------------
 1519|   327M|    if (current->next) {
  ------------------
  |  Branch (1519:9): [True: 0, False: 327M]
  ------------------
 1520|      0|      node = pn_data_node(data, current->next);
 1521|   327M|    } else {
 1522|   327M|      node = pni_data_new(data);
 1523|   327M|      if (!node) return NULL;
  ------------------
  |  Branch (1523:11): [True: 3.32k, False: 327M]
  ------------------
 1524|       |
 1525|       |      // refresh the pointers in case we grew
 1526|   327M|      current = pni_data_current(data);
 1527|   327M|      parent = pn_data_node(data, data->parent);
 1528|   327M|      node->prev = data->current;
 1529|   327M|      current->next = pni_data_id(data, node);
 1530|   327M|      node->parent = data->parent;
 1531|   327M|      if (parent) {
  ------------------
  |  Branch (1531:11): [True: 327M, False: 0]
  ------------------
 1532|   327M|        if (!parent->down) {
  ------------------
  |  Branch (1532:13): [True: 0, False: 327M]
  ------------------
 1533|      0|          parent->down = pni_data_id(data, node);
 1534|      0|        }
 1535|   327M|        parent->children++;
 1536|   327M|      }
 1537|   327M|    }
 1538|   327M|  } else if (parent) {
  ------------------
  |  Branch (1538:14): [True: 857k, False: 713k]
  ------------------
 1539|   857k|    if (parent->down) {
  ------------------
  |  Branch (1539:9): [True: 0, False: 857k]
  ------------------
 1540|      0|      node = pn_data_node(data, parent->down);
 1541|   857k|    } else {
 1542|   857k|      node = pni_data_new(data);
 1543|   857k|      if (!node) return NULL;
  ------------------
  |  Branch (1543:11): [True: 1.08k, False: 856k]
  ------------------
 1544|       |
 1545|       |      // refresh the pointers in case we grew
 1546|   856k|      parent = pn_data_node(data, data->parent);
 1547|   856k|      node->prev = 0;
 1548|   856k|      node->parent = data->parent;
 1549|   856k|      parent->down = pni_data_id(data, node);
 1550|   856k|      parent->children++;
 1551|   856k|    }
 1552|   857k|  } else if (data->size) {
  ------------------
  |  Branch (1552:14): [True: 0, False: 713k]
  ------------------
 1553|      0|    node = pn_data_node(data, 1);
 1554|   713k|  } else {
 1555|   713k|    node = pni_data_new(data);
 1556|   713k|    if (!node) return NULL;
  ------------------
  |  Branch (1556:9): [True: 0, False: 713k]
  ------------------
 1557|       |
 1558|   713k|    node->prev = 0;
 1559|   713k|    node->parent = 0;
 1560|   713k|  }
 1561|       |
 1562|   329M|  node->down = 0;
 1563|   329M|  node->children = 0;
 1564|   329M|  node->data = false;
 1565|   329M|  node->described = false;
 1566|   329M|  node->data_offset = 0;
 1567|   329M|  node->data_size = 0;
 1568|   329M|  data->current = pni_data_id(data, node);
 1569|   329M|  return node;
 1570|   329M|}
codec.c:pni_data_new:
 1264|   329M|{
 1265|   329M|  if ((data->capacity <= data->size) && (pni_data_grow(data) != 0)) return NULL;
  ------------------
  |  Branch (1265:7): [True: 178k, False: 329M]
  |  Branch (1265:41): [True: 4.40k, False: 173k]
  ------------------
 1266|   329M|  pni_node_t *node = pn_data_node(data, ++(data->size));
 1267|   329M|  node->next = 0;
 1268|   329M|  node->down = 0;
 1269|   329M|  node->children = 0;
 1270|   329M|  return node;
 1271|   329M|}
codec.c:pni_data_grow:
  439|   178k|{
  440|   178k|  size_t capacity = data->capacity ? data->capacity : 2;
  ------------------
  |  Branch (440:21): [True: 21.0k, False: 156k]
  ------------------
  441|   178k|  if (capacity >= PNI_NID_MAX) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   31|   178k|#define PNI_NID_MAX ((pni_nid_t)-1)
  ------------------
                if (capacity >= PNI_NID_MAX) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|  4.40k|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (441:7): [True: 4.40k, False: 173k]
  ------------------
  442|   173k|  else if (capacity < PNI_NID_MAX/2) capacity *= 2;
  ------------------
  |  |   31|   173k|#define PNI_NID_MAX ((pni_nid_t)-1)
  ------------------
  |  Branch (442:12): [True: 173k, False: 593]
  ------------------
  443|    593|  else capacity = PNI_NID_MAX;
  ------------------
  |  |   31|    593|#define PNI_NID_MAX ((pni_nid_t)-1)
  ------------------
  444|       |
  445|   173k|  pni_node_t *new_nodes = (pni_node_t *) pni_mem_subreallocate(pn_class(data), data, data->nodes, capacity * sizeof(pni_node_t));
  446|   173k|  if (new_nodes == NULL) return PN_OUT_OF_MEMORY;
  ------------------
  |  |   56|      0|#define PN_OUT_OF_MEMORY (-10) /**< Out-of-memory error */
  ------------------
  |  Branch (446:7): [True: 0, False: 173k]
  ------------------
  447|   173k|  data->capacity = capacity;
  448|   173k|  data->nodes = new_nodes;
  449|   173k|  return 0;
  450|   173k|}
codec.c:pni_data_id:
 1259|   657M|{
 1260|   657M|  return node - data->nodes + 1;
 1261|   657M|}
codec.c:pni_atom_init:
   79|  25.2M|{
   80|  25.2M|  memset(atom, 0, sizeof(pn_atom_t));
   81|  25.2M|  atom->type = type;
   82|  25.2M|}
codec.c:pni_data_intern_node:
  485|  71.1k|{
  486|  71.1k|  pn_bytes_t *bytes = pni_data_bytes(data, node);
  487|  71.1k|  if (!bytes) return 0;
  ------------------
  |  Branch (487:7): [True: 0, False: 71.1k]
  ------------------
  488|  71.1k|  if (data->buf == NULL) {
  ------------------
  |  Branch (488:7): [True: 31.5k, False: 39.6k]
  ------------------
  489|       |    // Heuristic to avoid growing small buffers too much
  490|       |    // size + 1 to allow for zero termination
  491|  31.5k|    size_t size = pn_max(bytes->size+1, PNI_INTERN_MINSIZE);
  ------------------
  |  |  164|  31.5k|#define pn_max(X,Y) ((X) < (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (164:22): [True: 31.1k, False: 366]
  |  |  ------------------
  ------------------
  492|  31.5k|    data->buf = pn_buffer(size);
  493|  31.5k|  }
  494|  71.1k|  size_t oldcap = pn_buffer_capacity(data->buf);
  495|  71.1k|  ssize_t offset = pni_data_intern(data, bytes->start, bytes->size);
  496|  71.1k|  if (offset < 0) return offset;
  ------------------
  |  Branch (496:7): [True: 0, False: 71.1k]
  ------------------
  497|  71.1k|  node->data = true;
  498|  71.1k|  node->data_offset = offset;
  499|  71.1k|  node->data_size = bytes->size;
  500|  71.1k|  pn_rwbytes_t buf = pn_buffer_memory(data->buf);
  501|  71.1k|  bytes->start = buf.start + offset;
  502|       |
  503|  71.1k|  if (pn_buffer_capacity(data->buf) != oldcap) {
  ------------------
  |  Branch (503:7): [True: 852, False: 70.3k]
  ------------------
  504|    852|    pni_data_rebase(data, buf.start);
  505|    852|  }
  506|       |
  507|  71.1k|  return 0;
  508|  71.1k|}
codec.c:pni_data_bytes:
  463|  78.1k|{
  464|  78.1k|  switch (node->atom.type) {
  465|  39.1k|  case PN_BINARY:
  ------------------
  |  Branch (465:3): [True: 39.1k, False: 39.0k]
  ------------------
  466|  63.0k|  case PN_STRING:
  ------------------
  |  Branch (466:3): [True: 23.9k, False: 54.1k]
  ------------------
  467|  78.1k|  case PN_SYMBOL:
  ------------------
  |  Branch (467:3): [True: 15.0k, False: 63.0k]
  ------------------
  468|  78.1k|    return &node->atom.u.as_bytes;
  469|      0|  default: return NULL;
  ------------------
  |  Branch (469:3): [True: 0, False: 78.1k]
  ------------------
  470|  78.1k|  }
  471|  78.1k|}
codec.c:pni_data_intern:
  453|  71.1k|{
  454|  71.1k|  size_t offset = pn_buffer_size(data->buf);
  455|  71.1k|  int err = pn_buffer_append(data->buf, start, size);
  456|  71.1k|  if (err) return err;
  ------------------
  |  Branch (456:7): [True: 0, False: 71.1k]
  ------------------
  457|  71.1k|  err = pn_buffer_append(data->buf, "\0", 1);
  458|  71.1k|  if (err) return err;
  ------------------
  |  Branch (458:7): [True: 0, False: 71.1k]
  ------------------
  459|  71.1k|  return offset;
  460|  71.1k|}
codec.c:pni_data_rebase:
  474|    852|{
  475|   445k|  for (unsigned i = 0; i < data->size; i++) {
  ------------------
  |  Branch (475:24): [True: 444k, False: 852]
  ------------------
  476|   444k|    pni_node_t *node = &data->nodes[i];
  477|   444k|    if (node->data) {
  ------------------
  |  Branch (477:9): [True: 6.99k, False: 437k]
  ------------------
  478|  6.99k|      pn_bytes_t *bytes = pni_data_bytes(data, node);
  479|  6.99k|      bytes->start = base + node->data_offset;
  480|  6.99k|    }
  481|   444k|  }
  482|    852|}

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

frame_consumers.c:make_consumer_from_bytes:
   42|  8.03M|static inline pni_consumer_t make_consumer_from_bytes(pn_bytes_t output_bytes) {
   43|  8.03M|  return (pni_consumer_t){
   44|  8.03M|    .output_start = (const uint8_t*) output_bytes.start,
   45|  8.03M|    .size = output_bytes.size,
   46|  8.03M|    .position = 0
   47|  8.03M|  };
   48|  8.03M|}
frame_consumers.c:consume_described_copy:
  707|  28.1k|static inline bool consume_described_copy(pni_consumer_t *consumer, pn_data_t *data) {
  708|  28.1k|  pni_consumer_t subconsumer;
  709|  28.1k|  return consume_described(consumer, &subconsumer) && consume_copy(&subconsumer, data);
  ------------------
  |  Branch (709:10): [True: 28.1k, False: 0]
  |  Branch (709:55): [True: 18.4k, False: 9.74k]
  ------------------
  710|  28.1k|}
frame_consumers.c:consume_described:
  572|  12.2M|static inline bool consume_described(pni_consumer_t* consumer, pni_consumer_t *subconsumer) {
  573|  12.2M|  *subconsumer = (pni_consumer_t){.output_start=NULL, .position=0, .size=0};
  574|  12.2M|  uint8_t type;
  575|  12.2M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (575:7): [True: 1.15M, False: 11.0M]
  ------------------
  576|  11.0M|  switch (type) {
  577|  9.52M|    case PNE_DESCRIPTOR: {
  ------------------
  |  |    5|  9.52M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (577:5): [True: 9.52M, False: 1.56M]
  ------------------
  578|  9.52M|      uint8_t dummy;
  579|  9.52M|      bool dq = consume_single_value_not_described(consumer, &dummy);
  580|  9.52M|      size_t sposition = consumer->position;
  581|  9.52M|      bool vq = consume_single_value(consumer, &dummy);
  582|  9.52M|      if (dq && vq) {
  ------------------
  |  Branch (582:11): [True: 9.33M, False: 184k]
  |  Branch (582:17): [True: 9.20M, False: 133k]
  ------------------
  583|  9.20M|        size_t scsize = consumer->position > sposition ? consumer->position-sposition : 0;
  ------------------
  |  Branch (583:25): [True: 9.20M, False: 0]
  ------------------
  584|  9.20M|        *subconsumer = (pni_consumer_t){.output_start=consumer->output_start+sposition, .position=0, .size=scsize};
  585|  9.20M|        return true;
  586|  9.20M|      }
  587|   318k|      return false;
  588|  9.52M|    }
  589|  1.56M|    default:
  ------------------
  |  Branch (589:5): [True: 1.56M, False: 9.52M]
  ------------------
  590|  1.56M|      pni_consumer_skip_value_not_described(consumer, type);
  591|  1.56M|      return false;
  592|  11.0M|  }
  593|  11.0M|}
frame_consumers.c:pni_consumer_readf8:
   51|   190M|{
   52|   190M|  if (consumer->position+1 > consumer->size) {
  ------------------
  |  Branch (52:7): [True: 60.3M, False: 130M]
  ------------------
   53|  60.3M|    consumer->position = consumer->size;
   54|  60.3M|    return false;
   55|  60.3M|  }
   56|   130M|  uint8_t r = consumer->output_start[consumer->position+0];
   57|   130M|  consumer->position++;
   58|   130M|  *result = r;
   59|   130M|  return true;
   60|   190M|}
frame_consumers.c:consume_single_value_not_described:
  241|  20.1M|static inline bool consume_single_value_not_described(pni_consumer_t* consumer, uint8_t* type) {
  242|  20.1M|  uint8_t t;
  243|  20.1M|  if (!pni_consumer_readf8(consumer, &t)) return false;
  ------------------
  |  Branch (243:7): [True: 1.32M, False: 18.8M]
  ------------------
  244|  18.8M|  if (!pni_consumer_skip_value_not_described(consumer, t)) return false;
  ------------------
  |  Branch (244:7): [True: 1.67M, False: 17.1M]
  ------------------
  245|  17.1M|  if (t==0) return false;
  ------------------
  |  Branch (245:7): [True: 0, False: 17.1M]
  ------------------
  246|  17.1M|  *type = t;
  247|  17.1M|  return true;
  248|  17.1M|}
frame_consumers.c:consume_single_value:
  250|  67.5M|static inline bool consume_single_value(pni_consumer_t* consumer, uint8_t* type) {
  251|  67.5M|  uint8_t t;
  252|  67.5M|  if (!pni_consumer_readf8(consumer, &t)) return false;
  ------------------
  |  Branch (252:7): [True: 30.8M, 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.30M, False: 31.3M]
  ------------------
  255|  5.30M|    uint8_t dummy;
  256|       |    // Descriptor
  257|  5.30M|    bool dq = consume_single_value_not_described(consumer, &dummy);
  258|       |    // Value
  259|  5.30M|    bool vq = consume_single_value_not_described(consumer, &dummy);
  260|  5.30M|    return dq && vq;
  ------------------
  |  Branch (260:12): [True: 4.23M, False: 1.07M]
  |  Branch (260:18): [True: 3.55M, False: 680k]
  ------------------
  261|  31.3M|  } else {
  262|  31.3M|    return pni_consumer_skip_value_not_described(consumer, t);
  263|  31.3M|  }
  264|  36.6M|}
frame_consumers.c:pni_consumer_skip_value_not_described:
  209|  67.0M|static inline bool pni_consumer_skip_value_not_described(pni_consumer_t* consumer, uint8_t type) {
  210|  67.0M|  pn_bytes_t value;
  211|  67.0M|  return pni_consumer_read_value_not_described(consumer, type, &value);
  212|  67.0M|}
frame_consumers.c:pni_consumer_read_value_not_described:
  141|  67.0M|static inline bool pni_consumer_read_value_not_described(pni_consumer_t* consumer, uint8_t type, pn_bytes_t *value) {
  142|  67.0M|  uint8_t subcategory = type >> 4;
  143|  67.0M|  switch (subcategory) {
  144|       |    // Fixed width types:
  145|       |    // No data
  146|  20.6M|    case 0x4:
  ------------------
  |  Branch (146:5): [True: 20.6M, False: 46.3M]
  ------------------
  147|  20.6M|      *value = (pn_bytes_t){.size=0,.start=NULL};
  148|  20.6M|      return true;
  149|       |      // 1 Octet
  150|  19.3M|    case 0x5:
  ------------------
  |  Branch (150:5): [True: 19.3M, False: 47.6M]
  ------------------
  151|  19.3M|      if (consumer->position+1 > consumer->size) break;
  ------------------
  |  Branch (151:11): [True: 175k, False: 19.1M]
  ------------------
  152|  19.1M|      *value = (pn_bytes_t){.size=1,.start=(const char *)consumer->output_start+consumer->position};
  153|  19.1M|      consumer->position += 1;
  154|  19.1M|      return true;
  155|       |      // 2 Octets
  156|  3.81M|    case 0x6:
  ------------------
  |  Branch (156:5): [True: 3.81M, False: 63.1M]
  ------------------
  157|  3.81M|      if (consumer->position+2 > consumer->size) break;
  ------------------
  |  Branch (157:11): [True: 601k, False: 3.21M]
  ------------------
  158|  3.21M|      *value = (pn_bytes_t){.size=2,.start=(const char *)consumer->output_start+consumer->position};
  159|  3.21M|      consumer->position += 2;
  160|  3.21M|      return true;
  161|       |      // 4 Octets
  162|  1.65M|    case 0x7:
  ------------------
  |  Branch (162:5): [True: 1.65M, False: 65.3M]
  ------------------
  163|  1.65M|      if (consumer->position+4 > consumer->size) break;
  ------------------
  |  Branch (163:11): [True: 175k, False: 1.47M]
  ------------------
  164|  1.47M|      *value = (pn_bytes_t){.size=4,.start=(const char *)consumer->output_start+consumer->position};
  165|  1.47M|      consumer->position += 4;
  166|  1.47M|      return true;
  167|       |      // 8 Octets
  168|  1.13M|    case 0x8:
  ------------------
  |  Branch (168:5): [True: 1.13M, False: 65.8M]
  ------------------
  169|  1.13M|      if (consumer->position+8 > consumer->size) break;
  ------------------
  |  Branch (169:11): [True: 228k, False: 903k]
  ------------------
  170|   903k|      *value = (pn_bytes_t){.size=8,.start=(const char *)consumer->output_start+consumer->position};
  171|   903k|      consumer->position += 8;
  172|   903k|      return true;
  173|       |      // 16 Octets
  174|   633k|    case 0x9:
  ------------------
  |  Branch (174:5): [True: 633k, False: 66.3M]
  ------------------
  175|   633k|      if (consumer->position+16 > consumer->size) break;
  ------------------
  |  Branch (175:11): [True: 268k, False: 365k]
  ------------------
  176|   365k|      *value = (pn_bytes_t){.size=16,.start=(const char *)consumer->output_start+consumer->position};
  177|   365k|      consumer->position += 16;
  178|   365k|      return true;
  179|       |      // Variable width types:
  180|       |      // One Octet of size
  181|  4.09M|    case 0xA:
  ------------------
  |  Branch (181:5): [True: 4.09M, False: 62.9M]
  ------------------
  182|  14.8M|    case 0xC:
  ------------------
  |  Branch (182:5): [True: 10.7M, False: 56.2M]
  ------------------
  183|  15.7M|    case 0xE: {
  ------------------
  |  Branch (183:5): [True: 905k, False: 66.1M]
  ------------------
  184|  15.7M|      uint8_t size;
  185|  15.7M|      if (!pni_consumer_readf8(consumer, &size)) return false;
  ------------------
  |  Branch (185:11): [True: 248k, False: 15.5M]
  ------------------
  186|  15.5M|      if (consumer->position+size > consumer->size) break;
  ------------------
  |  Branch (186:11): [True: 534k, False: 14.9M]
  ------------------
  187|  14.9M|      *value = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  188|  14.9M|      consumer->position += size;
  189|  14.9M|      return true;
  190|  15.5M|    }
  191|       |    // 4 Octets of size
  192|   936k|    case 0xB:
  ------------------
  |  Branch (192:5): [True: 936k, False: 66.0M]
  ------------------
  193|  1.42M|    case 0xD:
  ------------------
  |  Branch (193:5): [True: 491k, False: 66.5M]
  ------------------
  194|  2.07M|    case 0xF: {
  ------------------
  |  Branch (194:5): [True: 651k, False: 66.3M]
  ------------------
  195|  2.07M|      uint32_t size;
  196|  2.07M|      if (!pni_consumer_readf32(consumer, &size)) return false;
  ------------------
  |  Branch (196:11): [True: 582k, False: 1.49M]
  ------------------
  197|  1.49M|      if (consumer->position+size > consumer->size) break;
  ------------------
  |  Branch (197:11): [True: 651k, False: 846k]
  ------------------
  198|   846k|      *value = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  199|   846k|      consumer->position += size;
  200|   846k|      return true;
  201|  1.49M|    }
  202|  1.86M|    default:
  ------------------
  |  Branch (202:5): [True: 1.86M, False: 65.1M]
  ------------------
  203|  1.86M|      break;
  204|  67.0M|  }
  205|  4.49M|  consumer->position = consumer->size;
  206|  4.49M|  return false;
  207|  67.0M|}
frame_consumers.c:pni_consumer_readf32:
   78|  2.14M|{
   79|  2.14M|  if (consumer->position+4 > consumer->size) {
  ------------------
  |  Branch (79:7): [True: 599k, False: 1.54M]
  ------------------
   80|   599k|    consumer->position = consumer->size;
   81|   599k|    return false;
   82|   599k|  }
   83|  1.54M|  uint32_t a = consumer->output_start[consumer->position+0];
   84|  1.54M|  uint32_t b = consumer->output_start[consumer->position+1];
   85|  1.54M|  uint32_t c = consumer->output_start[consumer->position+2];
   86|  1.54M|  uint32_t d = consumer->output_start[consumer->position+3];
   87|  1.54M|  uint32_t r = a << 24
   88|  1.54M|  | b << 16
   89|  1.54M|  | c <<  8
   90|  1.54M|  | d;
   91|  1.54M|  consumer->position += 4;
   92|  1.54M|  *result = r;
   93|  1.54M|  return true;
   94|  2.14M|}
frame_consumers.c:consume_list:
  595|  12.2M|static inline bool consume_list(pni_consumer_t* consumer, pni_consumer_t *subconsumer, uint32_t *count) {
  596|  12.2M|  *subconsumer = (pni_consumer_t){.output_start=NULL, .position=0, .size=0};
  597|  12.2M|  *count = 0;
  598|  12.2M|  uint8_t type;
  599|  12.2M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (599:7): [True: 3.03M, False: 9.17M]
  ------------------
  600|  9.17M|  switch (type) {
  601|  5.03k|    case PNE_LIST32: {
  ------------------
  |  |   40|  5.03k|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (601:5): [True: 5.03k, False: 9.17M]
  ------------------
  602|  5.03k|      uint32_t s;
  603|  5.03k|      if (!pni_consumer_readf32(consumer, &s)) return false;
  ------------------
  |  Branch (603:11): [True: 0, False: 5.03k]
  ------------------
  604|  5.03k|      size_t scsize = s < consumer->size-consumer->position ? s : consumer->size-consumer->position;
  ------------------
  |  Branch (604:23): [True: 0, False: 5.03k]
  ------------------
  605|  5.03k|      *subconsumer = (pni_consumer_t){.output_start=consumer->output_start+consumer->position, .position=0, .size=scsize};
  606|  5.03k|      consumer->position += scsize;
  607|  5.03k|      return pni_consumer_readf32(subconsumer, count);
  608|  5.03k|    }
  609|  7.70M|    case PNE_LIST8: {
  ------------------
  |  |   39|  7.70M|#define PNE_LIST8           (0xc0)
  ------------------
  |  Branch (609:5): [True: 7.70M, False: 1.47M]
  ------------------
  610|  7.70M|      uint8_t s;
  611|  7.70M|      if (!pni_consumer_readf8(consumer, &s)) return false;
  ------------------
  |  Branch (611:11): [True: 0, False: 7.70M]
  ------------------
  612|  7.70M|      size_t scsize = s < consumer->size-consumer->position ? s : consumer->size-consumer->position;
  ------------------
  |  Branch (612:23): [True: 0, False: 7.70M]
  ------------------
  613|  7.70M|      *subconsumer = (pni_consumer_t){.output_start=consumer->output_start+consumer->position, .position=0, .size=scsize};
  614|  7.70M|      consumer->position += scsize;
  615|  7.70M|      uint8_t c;
  616|  7.70M|      if (!pni_consumer_readf8(subconsumer, &c)) return false;
  ------------------
  |  Branch (616:11): [True: 36.1k, False: 7.67M]
  ------------------
  617|  7.67M|      *count = c;
  618|  7.67M|      return true;
  619|  7.70M|    }
  620|  1.00M|    case PNE_LIST0:
  ------------------
  |  |   38|  1.00M|#define PNE_LIST0           (0x45)
  ------------------
  |  Branch (620:5): [True: 1.00M, False: 8.17M]
  ------------------
  621|  1.00M|      return true;
  622|   463k|    default:
  ------------------
  |  Branch (622:5): [True: 463k, False: 8.71M]
  ------------------
  623|   463k|      pni_consumer_skip_value(consumer, type);
  624|   463k|      return false;
  625|  9.17M|  }
  626|  9.17M|}
frame_consumers.c:pni_consumer_skip_value:
  214|  12.6M|static inline bool pni_consumer_skip_value(pni_consumer_t* consumer, uint8_t type) {
  215|       |  // Check for described type
  216|  12.6M|  if (type==PNE_DESCRIPTOR) {
  ------------------
  |  |    5|  12.6M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (216:7): [True: 2.31M, False: 10.3M]
  ------------------
  217|       |    // Skip descriptor
  218|  2.31M|    if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (218:9): [True: 62.1k, False: 2.25M]
  ------------------
  219|  2.25M|    if (!pni_consumer_skip_value_not_described(consumer, type)) return false;
  ------------------
  |  Branch (219:9): [True: 386k, False: 1.86M]
  ------------------
  220|  1.86M|    if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (220:9): [True: 40.7k, False: 1.82M]
  ------------------
  221|  1.82M|    return pni_consumer_skip_value_not_described(consumer, type);
  222|  1.86M|  }
  223|  10.3M|  return pni_consumer_skip_value_not_described(consumer, type);
  224|  12.6M|}
frame_consumers.c:consume_anything:
  278|  45.1M|static inline bool consume_anything(pni_consumer_t* consumer) {
  279|  45.1M|  uint8_t dummy;
  280|  45.1M|  return consume_single_value(consumer, &dummy);
  281|  45.1M|}
frame_consumers.c:consume_described_anything:
  666|  2.44M|static inline bool consume_described_anything(pni_consumer_t* consumer) {
  667|  2.44M|  uint8_t type;
  668|  2.44M|  bool tq = consume_single_value(consumer, &type);
  669|  2.44M|  return tq && type==PNE_DESCRIPTOR;
  ------------------
  |  |    5|  4.32M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (669:10): [True: 1.87M, False: 567k]
  |  Branch (669:16): [True: 1.01M, False: 866k]
  ------------------
  670|  2.44M|}
frame_consumers.c:consume_copy:
  683|  9.17M|static inline bool consume_copy(pni_consumer_t *consumer, pn_data_t *data) {
  684|  9.17M|  size_t iposition = consumer->position;
  685|  9.17M|  uint8_t type;
  686|  9.17M|  bool tq = consume_single_value(consumer, &type);
  687|  9.17M|  if (!tq || type==PNE_NULL) return false;
  ------------------
  |  |    6|   419k|#define PNE_NULL            (0x40)
  ------------------
  |  Branch (687:7): [True: 8.75M, False: 419k]
  |  Branch (687:14): [True: 12.2k, False: 407k]
  ------------------
  688|       |
  689|   407k|  pn_bytes_t value = {.size = consumer->position-iposition, .start = (const char*)consumer->output_start+iposition};
  690|   407k|  ssize_t err = pn_data_decode(data, value.start, value.size);
  691|   407k|  return err>=0 && err==(ssize_t)value.size;
  ------------------
  |  Branch (691:10): [True: 140k, False: 267k]
  |  Branch (691:20): [True: 139k, False: 124]
  ------------------
  692|  9.17M|}
frame_consumers.c:consume_end_list:
  629|  12.2M|static inline bool consume_end_list(pni_consumer_t *consumer) {
  630|  12.2M|  return true;
  631|  12.2M|}
frame_consumers.c:consume_described_type_anything:
  672|  1.21M|static inline bool consume_described_type_anything(pni_consumer_t* consumer, uint64_t *type) {
  673|  1.21M|  pni_consumer_t subconsumer;
  674|  1.21M|  return consume_described_ulong_descriptor(consumer, &subconsumer, type);
  675|  1.21M|}
frame_consumers.c:consume_described_ulong_descriptor:
  548|  3.03M|static inline bool consume_described_ulong_descriptor(pni_consumer_t* consumer, pni_consumer_t *subconsumer, uint64_t *descriptor) {
  549|  3.03M|  *descriptor = 0;
  550|  3.03M|  *subconsumer = (pni_consumer_t){.output_start=NULL, .position=0, .size=0};
  551|  3.03M|  uint8_t type;
  552|  3.03M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (552:7): [True: 1.06M, False: 1.96M]
  ------------------
  553|  1.96M|  switch (type) {
  554|  1.08M|    case PNE_DESCRIPTOR: {
  ------------------
  |  |    5|  1.08M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (554:5): [True: 1.08M, False: 885k]
  ------------------
  555|  1.08M|      bool dq = consume_ulong(consumer, descriptor);
  556|  1.08M|      size_t sposition = consumer->position;
  557|  1.08M|      uint8_t dummy;
  558|  1.08M|      bool vq = consume_single_value(consumer, &dummy);
  559|  1.08M|      if (dq && vq) {
  ------------------
  |  Branch (559:11): [True: 548k, False: 533k]
  |  Branch (559:17): [True: 435k, False: 112k]
  ------------------
  560|   435k|        size_t scsize = consumer->position > sposition ? consumer->position-sposition : 0;
  ------------------
  |  Branch (560:25): [True: 435k, False: 0]
  ------------------
  561|   435k|        *subconsumer = (pni_consumer_t){.output_start=consumer->output_start+sposition, .position=0, .size=scsize};
  562|   435k|        return true;
  563|   435k|      }
  564|   645k|      return false;
  565|  1.08M|    }
  566|   885k|    default:
  ------------------
  |  Branch (566:5): [True: 885k, False: 1.08M]
  ------------------
  567|   885k|      pni_consumer_skip_value_not_described(consumer, type);
  568|   885k|      return false;
  569|  1.96M|  }
  570|  1.96M|}
frame_consumers.c:consume_ushort:
  337|   843k|static inline bool consume_ushort(pni_consumer_t* consumer, uint16_t *ushort) {
  338|   843k|  *ushort = 0;
  339|   843k|  uint8_t type;
  340|   843k|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (340:7): [True: 421k, False: 421k]
  ------------------
  341|   421k|  switch (type) {
  342|  96.1k|    case PNE_USHORT: {
  ------------------
  |  |   11|  96.1k|#define PNE_USHORT          (0x60)
  ------------------
  |  Branch (342:5): [True: 96.1k, False: 325k]
  ------------------
  343|  96.1k|      uint16_t us;
  344|  96.1k|      if (!pni_consumer_readf16(consumer, &us)) return false;
  ------------------
  |  Branch (344:11): [True: 398, False: 95.7k]
  ------------------
  345|  95.7k|      *ushort = us;
  346|  95.7k|      return true;
  347|  96.1k|    }
  348|   325k|    default:
  ------------------
  |  Branch (348:5): [True: 325k, False: 96.1k]
  ------------------
  349|   325k|      pni_consumer_skip_value(consumer, type);
  350|   325k|      return false;
  351|   421k|  }
  352|   421k|}
frame_consumers.c:pni_consumer_readf16:
   63|  96.2k|{
   64|  96.2k|  if (consumer->position+2 > consumer->size) {
  ------------------
  |  Branch (64:7): [True: 442, False: 95.8k]
  ------------------
   65|    442|    consumer->position = consumer->size;
   66|    442|    return false;
   67|    442|  }
   68|  95.8k|  uint16_t a = consumer->output_start[consumer->position+0];
   69|  95.8k|  uint16_t b = consumer->output_start[consumer->position+1];
   70|  95.8k|  uint16_t r = a << 8
   71|  95.8k|  | b;
   72|  95.8k|  consumer->position += 2;
   73|  95.8k|  *result = r;
   74|  95.8k|  return true;
   75|  96.2k|}
frame_consumers.c:consume_uint:
  310|  13.1M|static inline bool consume_uint(pni_consumer_t* consumer, uint32_t *uint) {
  311|  13.1M|  *uint = 0;
  312|  13.1M|  uint8_t type;
  313|  13.1M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (313:7): [True: 8.83M, False: 4.33M]
  ------------------
  314|  4.33M|  switch (type) {
  315|  80.8k|    case PNE_SMALLUINT: {
  ------------------
  |  |   13|  80.8k|#define PNE_SMALLUINT       (0x52)
  ------------------
  |  Branch (315:5): [True: 80.8k, False: 4.25M]
  ------------------
  316|  80.8k|      uint8_t ui;
  317|  80.8k|      if (!pni_consumer_readf8(consumer, &ui)) return false;
  ------------------
  |  Branch (317:11): [True: 94, False: 80.7k]
  ------------------
  318|  80.7k|      *uint = ui;
  319|  80.7k|      return true;
  320|  80.8k|    }
  321|  18.7k|    case PNE_UINT: {
  ------------------
  |  |   12|  18.7k|#define PNE_UINT            (0x70)
  ------------------
  |  Branch (321:5): [True: 18.7k, False: 4.31M]
  ------------------
  322|  18.7k|      uint32_t ui;
  323|  18.7k|      if (!pni_consumer_readf32(consumer, &ui)) return false;
  ------------------
  |  Branch (323:11): [True: 3.80k, False: 14.9k]
  ------------------
  324|  14.9k|      *uint = ui;
  325|  14.9k|      return true;
  326|  18.7k|    }
  327|   251k|    case PNE_UINT0: {
  ------------------
  |  |   14|   251k|#define PNE_UINT0           (0x43)
  ------------------
  |  Branch (327:5): [True: 251k, False: 4.08M]
  ------------------
  328|   251k|      *uint = 0;
  329|   251k|      return true;
  330|  18.7k|    }
  331|  3.98M|    default:
  ------------------
  |  Branch (331:5): [True: 3.98M, False: 351k]
  ------------------
  332|  3.98M|      pni_consumer_skip_value(consumer, type);
  333|  3.98M|      return false;
  334|  4.33M|  }
  335|  4.33M|}
frame_consumers.c:consume_ulong:
  283|  2.32M|static inline bool consume_ulong(pni_consumer_t* consumer, uint64_t *ulong) {
  284|  2.32M|  *ulong = 0;
  285|  2.32M|  uint8_t type;
  286|  2.32M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (286:7): [True: 1.08M, False: 1.23M]
  ------------------
  287|  1.23M|  switch (type) {
  288|   553k|    case PNE_SMALLULONG: {
  ------------------
  |  |   16|   553k|#define PNE_SMALLULONG      (0x53)
  ------------------
  |  Branch (288:5): [True: 553k, False: 682k]
  ------------------
  289|   553k|      uint8_t ul;
  290|   553k|      if (!pni_consumer_readf8(consumer, &ul)) return false;
  ------------------
  |  Branch (290:11): [True: 1.87k, False: 551k]
  ------------------
  291|   551k|      *ulong = ul;
  292|   551k|      return true;
  293|   553k|    }
  294|  12.2k|    case PNE_ULONG: {
  ------------------
  |  |   15|  12.2k|#define PNE_ULONG           (0x80)
  ------------------
  |  Branch (294:5): [True: 12.2k, False: 1.22M]
  ------------------
  295|  12.2k|      uint64_t ul;
  296|  12.2k|      if (!pni_consumer_readf64(consumer, &ul)) return false;
  ------------------
  |  Branch (296:11): [True: 10.2k, False: 2.01k]
  ------------------
  297|  2.01k|      *ulong = ul;
  298|  2.01k|      return true;
  299|  12.2k|    }
  300|  9.22k|    case PNE_ULONG0: {
  ------------------
  |  |   17|  9.22k|#define PNE_ULONG0          (0x44)
  ------------------
  |  Branch (300:5): [True: 9.22k, False: 1.22M]
  ------------------
  301|  9.22k|      *ulong = 0;
  302|  9.22k|      return true;
  303|  12.2k|    }
  304|   661k|    default:
  ------------------
  |  Branch (304:5): [True: 661k, False: 574k]
  ------------------
  305|   661k|      pni_consumer_skip_value(consumer, type);
  306|   661k|      return false;
  307|  1.23M|  }
  308|  1.23M|}
frame_consumers.c:pni_consumer_readf64:
   97|  15.8k|{
   98|  15.8k|  uint32_t a;
   99|  15.8k|  if (!pni_consumer_readf32(consumer, &a)) return false;
  ------------------
  |  Branch (99:7): [True: 10.6k, False: 5.14k]
  ------------------
  100|  5.14k|  uint32_t b;
  101|  5.14k|  if (!pni_consumer_readf32(consumer, &b)) return false;
  ------------------
  |  Branch (101:7): [True: 530, False: 4.61k]
  ------------------
  102|  4.61k|  *result = (uint64_t)a << 32 | (uint64_t)b;
  103|  4.61k|  return true;
  104|  5.14k|}
frame_consumers.c:consume_bool:
  371|  9.65M|static inline bool consume_bool(pni_consumer_t* consumer, bool *b) {
  372|  9.65M|  *b = false;
  373|  9.65M|  uint8_t type;
  374|  9.65M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (374:7): [True: 6.19M, False: 3.45M]
  ------------------
  375|  3.45M|  switch (type) {
  376|   466k|    case PNE_BOOLEAN: {
  ------------------
  |  |    7|   466k|#define PNE_BOOLEAN         (0x56)
  ------------------
  |  Branch (376:5): [True: 466k, False: 2.99M]
  ------------------
  377|   466k|      uint8_t ub;
  378|   466k|      if (!pni_consumer_readf8(consumer, &ub)) return false;
  ------------------
  |  Branch (378:11): [True: 3.79k, False: 463k]
  ------------------
  379|   463k|      *b = ub;
  380|   463k|      return true;
  381|   466k|    }
  382|  64.8k|    case PNE_FALSE:
  ------------------
  |  |    9|  64.8k|#define PNE_FALSE           (0x42)
  ------------------
  |  Branch (382:5): [True: 64.8k, False: 3.39M]
  ------------------
  383|  64.8k|      *b = false;
  384|  64.8k|      return true;
  385|   383k|    case PNE_TRUE:
  ------------------
  |  |    8|   383k|#define PNE_TRUE            (0x41)
  ------------------
  |  Branch (385:5): [True: 383k, False: 3.07M]
  ------------------
  386|   383k|      *b = true;
  387|   383k|      return true;
  388|  2.54M|    default:
  ------------------
  |  Branch (388:5): [True: 2.54M, False: 915k]
  ------------------
  389|  2.54M|      pni_consumer_skip_value(consumer, type);
  390|  2.54M|      return false;
  391|  3.45M|  }
  392|  3.45M|}
frame_consumers.c:consume_string:
  712|  4.20M|static inline bool consume_string(pni_consumer_t *consumer, pn_bytes_t *string) {
  713|  4.20M|  uint8_t type;
  714|  4.20M|  *string = (pn_bytes_t){.size=0, .start=0};
  715|  4.20M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (715:7): [True: 1.90M, False: 2.29M]
  ------------------
  716|  2.29M|  switch (type) {
  717|  2.56k|    case PNE_STR32_UTF8: {
  ------------------
  |  |   35|  2.56k|#define PNE_STR32_UTF8      (0xb1)
  ------------------
  |  Branch (717:5): [True: 2.56k, False: 2.29M]
  ------------------
  718|  2.56k|      return pni_consumer_readv32(consumer, string);
  719|      0|    }
  720|   921k|    case PNE_STR8_UTF8: {
  ------------------
  |  |   34|   921k|#define PNE_STR8_UTF8       (0xa1)
  ------------------
  |  Branch (720:5): [True: 921k, False: 1.37M]
  ------------------
  721|   921k|      return pni_consumer_readv8(consumer, string);
  722|      0|    }
  723|  1.37M|    default:
  ------------------
  |  Branch (723:5): [True: 1.37M, False: 924k]
  ------------------
  724|  1.37M|      pni_consumer_skip_value(consumer, type);
  725|  1.37M|      return false;
  726|  2.29M|  }
  727|  2.29M|}
frame_consumers.c:pni_consumer_readv32:
  129|  13.5k|static inline bool pni_consumer_readv32(pni_consumer_t *consumer, pn_bytes_t* bytes){
  130|  13.5k|  uint32_t size;
  131|  13.5k|  if (!pni_consumer_readf32(consumer, &size)) return false;
  ------------------
  |  Branch (131:7): [True: 2.20k, False: 11.3k]
  ------------------
  132|  11.3k|  if (consumer->position+size > consumer->size) {
  ------------------
  |  Branch (132:7): [True: 3.83k, False: 7.46k]
  ------------------
  133|  3.83k|    consumer->position = consumer->size;
  134|  3.83k|    return false;
  135|  3.83k|  }
  136|  7.46k|  *bytes = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  137|  7.46k|  consumer->position += size;
  138|  7.46k|  return true;
  139|  11.3k|}
frame_consumers.c:pni_consumer_readv8:
  117|   947k|static inline bool pni_consumer_readv8(pni_consumer_t *consumer, pn_bytes_t* bytes){
  118|   947k|  uint8_t size;
  119|   947k|  if (!pni_consumer_readf8(consumer, &size)) return false;
  ------------------
  |  Branch (119:7): [True: 9.80k, False: 937k]
  ------------------
  120|   937k|  if (consumer->position+size > consumer->size) {
  ------------------
  |  Branch (120:7): [True: 5.25k, False: 932k]
  ------------------
  121|  5.25k|    consumer->position = consumer->size;
  122|  5.25k|    return false;
  123|  5.25k|  }
  124|   932k|  *bytes = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  125|   932k|  consumer->position += size;
  126|   932k|  return true;
  127|   937k|}
frame_consumers.c:consume_ubyte:
  354|  2.47M|static inline bool consume_ubyte(pni_consumer_t* consumer, uint8_t *ubyte) {
  355|  2.47M|  *ubyte = 0;
  356|  2.47M|  uint8_t type;
  357|  2.47M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (357:7): [True: 296k, False: 2.17M]
  ------------------
  358|  2.17M|  switch (type) {
  359|   106k|    case PNE_UBYTE: {
  ------------------
  |  |   10|   106k|#define PNE_UBYTE           (0x50)
  ------------------
  |  Branch (359:5): [True: 106k, False: 2.06M]
  ------------------
  360|   106k|      uint8_t ub;
  361|   106k|      if (!pni_consumer_readf8(consumer, &ub)) return false;
  ------------------
  |  Branch (361:11): [True: 2.67k, False: 103k]
  ------------------
  362|   103k|      *ubyte = ub;
  363|   103k|      return true;
  364|   106k|    }
  365|  2.06M|    default:
  ------------------
  |  Branch (365:5): [True: 2.06M, False: 106k]
  ------------------
  366|  2.06M|      pni_consumer_skip_value(consumer, type);
  367|  2.06M|      return false;
  368|  2.17M|  }
  369|  2.17M|}
frame_consumers.c:consume_binaryornull:
  746|  1.09M|static inline bool consume_binaryornull(pni_consumer_t *consumer, pn_bytes_t *binary) {
  747|  1.09M|  uint8_t type;
  748|  1.09M|  *binary  = (pn_bytes_t){.size=0, .start=0};
  749|  1.09M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (749:7): [True: 535k, False: 563k]
  ------------------
  750|   563k|  switch (type) {
  751|  9.23k|    case PNE_NULL:{
  ------------------
  |  |    6|  9.23k|#define PNE_NULL            (0x40)
  ------------------
  |  Branch (751:5): [True: 9.23k, False: 554k]
  ------------------
  752|  9.23k|      return true;
  753|      0|    }
  754|    877|    case PNE_VBIN32:{
  ------------------
  |  |   33|    877|#define PNE_VBIN32          (0xb0)
  ------------------
  |  Branch (754:5): [True: 877, False: 562k]
  ------------------
  755|    877|      return pni_consumer_readv32(consumer, binary);
  756|      0|    }
  757|  4.22k|    case PNE_VBIN8:{
  ------------------
  |  |   32|  4.22k|#define PNE_VBIN8           (0xa0)
  ------------------
  |  Branch (757:5): [True: 4.22k, False: 559k]
  ------------------
  758|  4.22k|      return pni_consumer_readv8(consumer, binary);
  759|      0|    }
  760|   548k|    default:
  ------------------
  |  Branch (760:5): [True: 548k, False: 14.3k]
  ------------------
  761|   548k|      pni_consumer_skip_value(consumer, type);
  762|   548k|      return false;
  763|   563k|  }
  764|   563k|}
frame_consumers.c:consume_symbol:
  729|  3.81M|static inline bool consume_symbol(pni_consumer_t *consumer, pn_bytes_t *symbol) {
  730|  3.81M|  uint8_t type;
  731|  3.81M|  *symbol = (pn_bytes_t){.size=0, .start=0};
  732|  3.81M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (732:7): [True: 3.14M, False: 669k]
  ------------------
  733|   669k|  switch (type) {
  734|  5.38k|    case PNE_SYM32:{
  ------------------
  |  |   37|  5.38k|#define PNE_SYM32           (0xb3)
  ------------------
  |  Branch (734:5): [True: 5.38k, False: 664k]
  ------------------
  735|  5.38k|      return pni_consumer_readv32(consumer, symbol);
  736|      0|    }
  737|  12.5k|    case PNE_SYM8:{
  ------------------
  |  |   36|  12.5k|#define PNE_SYM8            (0xa3)
  ------------------
  |  Branch (737:5): [True: 12.5k, False: 657k]
  ------------------
  738|  12.5k|      return pni_consumer_readv8(consumer, symbol);
  739|      0|    }
  740|   651k|    default:
  ------------------
  |  Branch (740:5): [True: 651k, False: 17.9k]
  ------------------
  741|   651k|      pni_consumer_skip_value(consumer, type);
  742|   651k|      return false;
  743|   669k|  }
  744|   669k|}
frame_consumers.c:consume_described_maybe_type_raw:
  694|  1.07M|static inline bool consume_described_maybe_type_raw(pni_consumer_t *consumer, bool *qtype, uint64_t *type, pn_bytes_t *raw) {
  695|  1.07M|  pni_consumer_t subconsumer;
  696|  1.07M|  *qtype = consume_described_ulong_descriptor(consumer, &subconsumer, type);
  697|  1.07M|  return *qtype && consume_raw(&subconsumer, raw);
  ------------------
  |  Branch (697:10): [True: 9.11k, False: 1.06M]
  |  Branch (697:20): [True: 9.11k, False: 0]
  ------------------
  698|  1.07M|}
frame_consumers.c:consume_raw:
  266|   122k|static inline bool consume_raw(pni_consumer_t* consumer, pn_bytes_t* raw) {
  267|   122k|  size_t start = consumer->position;
  268|   122k|  uint8_t dummy;
  269|   122k|  bool succeed = consume_single_value(consumer, &dummy);
  270|   122k|  if (succeed) {
  ------------------
  |  Branch (270:7): [True: 42.5k, False: 79.8k]
  ------------------
  271|  42.5k|    *raw = (pn_bytes_t){.size=consumer->position-start, .start=(const char*)consumer->output_start+start};
  272|  79.8k|  } else {
  273|  79.8k|    *raw = (pn_bytes_t) {0, NULL};
  274|  79.8k|  }
  275|   122k|  return succeed;
  276|   122k|}
frame_consumers.c:consume_atom:
  407|  49.0k|static inline bool consume_atom(pni_consumer_t* consumer, pn_atom_t *atom) {
  408|  49.0k|  uint8_t type;
  409|  49.0k|  if (pni_consumer_readf8(consumer, &type)) {
  ------------------
  |  Branch (409:7): [True: 35.0k, False: 14.0k]
  ------------------
  410|  35.0k|    switch (type) {
  411|    395|    case PNE_SMALLULONG: {
  ------------------
  |  |   16|    395|#define PNE_SMALLULONG      (0x53)
  ------------------
  |  Branch (411:5): [True: 395, False: 34.6k]
  ------------------
  412|    395|      uint8_t ul;
  413|    395|      if (!pni_consumer_readf8(consumer, &ul)) break;
  ------------------
  |  Branch (413:11): [True: 70, False: 325]
  ------------------
  414|    325|      atom->type = PN_ULONG;
  415|    325|      atom->u.as_ulong = ul;
  416|    325|      return true;
  417|    395|    }
  418|    220|    case PNE_ULONG: {
  ------------------
  |  |   15|    220|#define PNE_ULONG           (0x80)
  ------------------
  |  Branch (418:5): [True: 220, False: 34.7k]
  ------------------
  419|    220|      uint64_t ul;
  420|    220|      if (!pni_consumer_readf64(consumer, &ul)) break;
  ------------------
  |  Branch (420:11): [True: 85, False: 135]
  ------------------
  421|    135|      atom->type = PN_ULONG;
  422|    135|      atom->u.as_ulong = ul;
  423|    135|      return true;
  424|    220|    }
  425|  1.42k|    case PNE_ULONG0: {
  ------------------
  |  |   17|  1.42k|#define PNE_ULONG0          (0x44)
  ------------------
  |  Branch (425:5): [True: 1.42k, False: 33.5k]
  ------------------
  426|  1.42k|      atom->type = PN_ULONG;
  427|  1.42k|      atom->u.as_ulong = 0;
  428|  1.42k|      return true;
  429|    220|    }
  430|    481|    case PNE_SMALLUINT: {
  ------------------
  |  |   13|    481|#define PNE_SMALLUINT       (0x52)
  ------------------
  |  Branch (430:5): [True: 481, False: 34.5k]
  ------------------
  431|    481|      uint8_t ui;
  432|    481|      if (!pni_consumer_readf8(consumer, &ui)) break;
  ------------------
  |  Branch (432:11): [True: 70, False: 411]
  ------------------
  433|    411|      atom->type = PN_UINT;
  434|    411|      atom->u.as_uint = ui;
  435|    411|      return true;
  436|    481|    }
  437|    392|    case PNE_UINT: {
  ------------------
  |  |   12|    392|#define PNE_UINT            (0x70)
  ------------------
  |  Branch (437:5): [True: 392, False: 34.6k]
  ------------------
  438|    392|      uint32_t ui;
  439|    392|      if (!pni_consumer_readf32(consumer, &ui)) break;
  ------------------
  |  Branch (439:11): [True: 282, False: 110]
  ------------------
  440|    110|      atom->type = PN_UINT;
  441|    110|      atom->u.as_uint = ui;
  442|    110|      return true;
  443|    392|    }
  444|  5.49k|    case PNE_UINT0: {
  ------------------
  |  |   14|  5.49k|#define PNE_UINT0           (0x43)
  ------------------
  |  Branch (444:5): [True: 5.49k, False: 29.5k]
  ------------------
  445|  5.49k|      atom->type = PN_UINT;
  446|  5.49k|      atom->u.as_uint = 0;
  447|  5.49k|      return true;
  448|    392|    }
  449|    165|    case PNE_USHORT: {
  ------------------
  |  |   11|    165|#define PNE_USHORT          (0x60)
  ------------------
  |  Branch (449:5): [True: 165, False: 34.8k]
  ------------------
  450|    165|      uint16_t us;
  451|    165|      if (!pni_consumer_readf16(consumer, &us)) break;
  ------------------
  |  Branch (451:11): [True: 44, False: 121]
  ------------------
  452|    121|      atom->type = PN_USHORT;
  453|    121|      atom->u.as_ushort = us;
  454|    121|      return true;
  455|    165|    }
  456|    282|    case PNE_UBYTE: {
  ------------------
  |  |   10|    282|#define PNE_UBYTE           (0x50)
  ------------------
  |  Branch (456:5): [True: 282, False: 34.7k]
  ------------------
  457|    282|      uint8_t ub;
  458|    282|      if (!pni_consumer_readf8(consumer, &ub)) break;
  ------------------
  |  Branch (458:11): [True: 106, False: 176]
  ------------------
  459|    176|      atom->type = PN_UBYTE;
  460|    176|      atom->u.as_ubyte = ub;
  461|    176|      return true;
  462|    282|    }
  463|    811|    case PNE_BOOLEAN: {
  ------------------
  |  |    7|    811|#define PNE_BOOLEAN         (0x56)
  ------------------
  |  Branch (463:5): [True: 811, False: 34.2k]
  ------------------
  464|    811|      uint8_t ub;
  465|    811|      if (!pni_consumer_readf8(consumer, &ub)) break;
  ------------------
  |  Branch (465:11): [True: 89, False: 722]
  ------------------
  466|    722|      atom->type = PN_BOOL;
  467|    722|      atom->u.as_bool = ub;
  468|    722|      return true;
  469|    811|    }
  470|  1.67k|    case PNE_FALSE:
  ------------------
  |  |    9|  1.67k|#define PNE_FALSE           (0x42)
  ------------------
  |  Branch (470:5): [True: 1.67k, False: 33.3k]
  ------------------
  471|  1.67k|      atom->type = PN_BOOL;
  472|  1.67k|      atom->u.as_bool = false;
  473|  1.67k|      return true;
  474|  1.64k|    case PNE_TRUE:
  ------------------
  |  |    8|  1.64k|#define PNE_TRUE            (0x41)
  ------------------
  |  Branch (474:5): [True: 1.64k, False: 33.3k]
  ------------------
  475|  1.64k|      atom->type = PN_BOOL;
  476|  1.64k|      atom->u.as_bool = true;
  477|  1.64k|      return true;
  478|    242|    case PNE_MS64: {
  ------------------
  |  |   30|    242|#define PNE_MS64            (0x83)
  ------------------
  |  Branch (478:5): [True: 242, False: 34.7k]
  ------------------
  479|    242|      uint64_t timestamp;
  480|    242|      if (!pni_consumer_readf64(consumer, &timestamp)) break;
  ------------------
  |  Branch (480:11): [True: 112, False: 130]
  ------------------
  481|    130|      atom->type = PN_TIMESTAMP;
  482|    130|      atom->u.as_timestamp = timestamp;
  483|    130|      return true;
  484|    242|    }
  485|  2.84k|    case PNE_VBIN32:{
  ------------------
  |  |   33|  2.84k|#define PNE_VBIN32          (0xb0)
  ------------------
  |  Branch (485:5): [True: 2.84k, False: 32.1k]
  ------------------
  486|  2.84k|      pn_bytes_t binary;
  487|  2.84k|      if (!pni_consumer_readv32(consumer, &binary)) break;
  ------------------
  |  Branch (487:11): [True: 806, False: 2.03k]
  ------------------
  488|  2.03k|      atom->type = PN_BINARY;
  489|  2.03k|      atom->u.as_bytes = binary;
  490|  2.03k|      return true;
  491|  2.84k|    }
  492|  7.26k|    case PNE_VBIN8:{
  ------------------
  |  |   32|  7.26k|#define PNE_VBIN8           (0xa0)
  ------------------
  |  Branch (492:5): [True: 7.26k, False: 27.7k]
  ------------------
  493|  7.26k|      pn_bytes_t binary;
  494|  7.26k|      if (!pni_consumer_readv8(consumer, &binary)) break;
  ------------------
  |  Branch (494:11): [True: 1.19k, False: 6.06k]
  ------------------
  495|  6.06k|      atom->type = PN_BINARY;
  496|  6.06k|      atom->u.as_bytes = binary;
  497|  6.06k|      return true;
  498|  7.26k|    }
  499|    776|    case PNE_STR32_UTF8: {
  ------------------
  |  |   35|    776|#define PNE_STR32_UTF8      (0xb1)
  ------------------
  |  Branch (499:5): [True: 776, False: 34.2k]
  ------------------
  500|    776|      pn_bytes_t string;
  501|    776|      if (!pni_consumer_readv32(consumer, &string)) break;
  ------------------
  |  Branch (501:11): [True: 274, False: 502]
  ------------------
  502|    502|      atom->type = PN_STRING;
  503|    502|      atom->u.as_bytes = string;
  504|    502|      return true;
  505|    776|    }
  506|  1.45k|    case PNE_STR8_UTF8: {
  ------------------
  |  |   34|  1.45k|#define PNE_STR8_UTF8       (0xa1)
  ------------------
  |  Branch (506:5): [True: 1.45k, False: 33.5k]
  ------------------
  507|  1.45k|      pn_bytes_t string;
  508|  1.45k|      if (!pni_consumer_readv8(consumer, &string)) break;
  ------------------
  |  Branch (508:11): [True: 413, False: 1.03k]
  ------------------
  509|  1.03k|      atom->type = PN_STRING;
  510|  1.03k|      atom->u.as_bytes = string;
  511|  1.03k|      return true;
  512|  1.45k|    }
  513|  1.06k|    case PNE_SYM32:{
  ------------------
  |  |   37|  1.06k|#define PNE_SYM32           (0xb3)
  ------------------
  |  Branch (513:5): [True: 1.06k, False: 33.9k]
  ------------------
  514|  1.06k|      pn_bytes_t symbol;
  515|  1.06k|      if (!pni_consumer_readv32(consumer, &symbol)) break;
  ------------------
  |  Branch (515:11): [True: 598, False: 469]
  ------------------
  516|    469|      atom->type = PN_SYMBOL;
  517|    469|      atom->u.as_bytes = symbol;
  518|    469|      return true;
  519|  1.06k|    }
  520|    636|    case PNE_SYM8:{
  ------------------
  |  |   36|    636|#define PNE_SYM8            (0xa3)
  ------------------
  |  Branch (520:5): [True: 636, False: 34.3k]
  ------------------
  521|    636|      pn_bytes_t symbol;
  522|    636|      if (!pni_consumer_readv8(consumer, &symbol)) break;
  ------------------
  |  Branch (522:11): [True: 56, False: 580]
  ------------------
  523|    580|      atom->type = PN_SYMBOL;
  524|    580|      atom->u.as_bytes = symbol;
  525|    580|      return true;
  526|    636|    }
  527|  1.11k|    case PNE_UUID: {
  ------------------
  |  |   31|  1.11k|#define PNE_UUID            (0x98)
  ------------------
  |  Branch (527:5): [True: 1.11k, False: 33.9k]
  ------------------
  528|  1.11k|      pn_uuid_t uuid;
  529|  1.11k|      if (!pni_consumer_readf128(consumer, &uuid)) break;
  ------------------
  |  Branch (529:11): [True: 78, False: 1.03k]
  ------------------
  530|  1.03k|      atom->type = PN_UUID;
  531|  1.03k|      atom->u.as_uuid = uuid;
  532|  1.03k|      return true;
  533|  1.11k|    }
  534|    433|    case PNE_NULL:
  ------------------
  |  |    6|    433|#define PNE_NULL            (0x40)
  ------------------
  |  Branch (534:5): [True: 433, False: 34.5k]
  ------------------
  535|    433|      atom->type = PN_NULL;
  536|    433|      return true;
  537|  6.20k|    default:
  ------------------
  |  Branch (537:5): [True: 6.20k, False: 28.8k]
  ------------------
  538|  6.20k|      pni_consumer_skip_value(consumer, type);
  539|  6.20k|      break;
  540|  35.0k|    }
  541|  35.0k|  }
  542|  24.5k|  atom->type = PN_NULL;
  543|  24.5k|  return false;
  544|  49.0k|}
frame_consumers.c:pni_consumer_readf128:
  107|  1.11k|{
  108|  1.11k|  if (consumer->position+16 > consumer->size) {
  ------------------
  |  Branch (108:7): [True: 78, False: 1.03k]
  ------------------
  109|     78|    consumer->position = consumer->size;
  110|     78|    return false;
  111|     78|  }
  112|  1.03k|  memcpy(dst, &consumer->output_start[consumer->position], 16);
  113|  1.03k|  consumer->position += 16;
  114|  1.03k|  return true;
  115|  1.11k|}
frame_consumers.c:consume_timestamp:
  394|  49.0k|static inline bool consume_timestamp(pni_consumer_t* consumer, pn_timestamp_t *timestamp) {
  395|  49.0k|  *timestamp = 0;
  396|  49.0k|  uint8_t type;
  397|  49.0k|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (397:7): [True: 41.3k, False: 7.67k]
  ------------------
  398|  7.67k|  switch (type) {
  399|  3.07k|    case PNE_MS64: {
  ------------------
  |  |   30|  3.07k|#define PNE_MS64            (0x83)
  ------------------
  |  Branch (399:5): [True: 3.07k, False: 4.60k]
  ------------------
  400|  3.07k|      return pni_consumer_readf64(consumer, (uint64_t*)timestamp);
  401|      0|    }
  402|  4.60k|    default:
  ------------------
  |  Branch (402:5): [True: 4.60k, False: 3.07k]
  ------------------
  403|  4.60k|      return false;
  404|  7.67k|  }
  405|  7.67k|}
frame_consumers.c:consume_described_maybe_type_anything:
  677|   675k|static inline bool consume_described_maybe_type_anything(pni_consumer_t* consumer, bool *qtype, uint64_t *type) {
  678|   675k|  pni_consumer_t subconsumer;
  679|   675k|  *qtype = consume_described_ulong_descriptor(consumer, &subconsumer, type);
  680|   675k|  return *qtype;
  681|   675k|}
frame_consumers.c:consume_described_maybe_type_maybe_anything:
  700|  68.8k|static inline bool consume_described_maybe_type_maybe_anything(pni_consumer_t *consumer, bool *qtype, uint64_t *type, bool *qanything) {
  701|  68.8k|  pni_consumer_t subconsumer;
  702|  68.8k|  *qtype = consume_described_ulong_descriptor(consumer, &subconsumer, type);
  703|  68.8k|  *qanything = consume_anything(&subconsumer);
  704|  68.8k|  return *qtype && *qanything;
  ------------------
  |  Branch (704:10): [True: 10.2k, False: 58.6k]
  |  Branch (704:20): [True: 10.2k, False: 0]
  ------------------
  705|  68.8k|}
dispatcher.c:make_consumer_from_bytes:
   42|  3.31M|static inline pni_consumer_t make_consumer_from_bytes(pn_bytes_t output_bytes) {
   43|  3.31M|  return (pni_consumer_t){
   44|  3.31M|    .output_start = (const uint8_t*) output_bytes.start,
   45|  3.31M|    .size = output_bytes.size,
   46|  3.31M|    .position = 0
   47|  3.31M|  };
   48|  3.31M|}
dispatcher.c:consume_described_ulong_descriptor:
  548|  3.31M|static inline bool consume_described_ulong_descriptor(pni_consumer_t* consumer, pni_consumer_t *subconsumer, uint64_t *descriptor) {
  549|  3.31M|  *descriptor = 0;
  550|  3.31M|  *subconsumer = (pni_consumer_t){.output_start=NULL, .position=0, .size=0};
  551|  3.31M|  uint8_t type;
  552|  3.31M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (552:7): [True: 0, False: 3.31M]
  ------------------
  553|  3.31M|  switch (type) {
  554|  3.31M|    case PNE_DESCRIPTOR: {
  ------------------
  |  |    5|  3.31M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (554:5): [True: 3.31M, False: 337]
  ------------------
  555|  3.31M|      bool dq = consume_ulong(consumer, descriptor);
  556|  3.31M|      size_t sposition = consumer->position;
  557|  3.31M|      uint8_t dummy;
  558|  3.31M|      bool vq = consume_single_value(consumer, &dummy);
  559|  3.31M|      if (dq && vq) {
  ------------------
  |  Branch (559:11): [True: 3.31M, False: 910]
  |  Branch (559:17): [True: 3.31M, False: 303]
  ------------------
  560|  3.31M|        size_t scsize = consumer->position > sposition ? consumer->position-sposition : 0;
  ------------------
  |  Branch (560:25): [True: 3.31M, False: 0]
  ------------------
  561|  3.31M|        *subconsumer = (pni_consumer_t){.output_start=consumer->output_start+sposition, .position=0, .size=scsize};
  562|  3.31M|        return true;
  563|  3.31M|      }
  564|  1.21k|      return false;
  565|  3.31M|    }
  566|    337|    default:
  ------------------
  |  Branch (566:5): [True: 337, False: 3.31M]
  ------------------
  567|    337|      pni_consumer_skip_value_not_described(consumer, type);
  568|    337|      return false;
  569|  3.31M|  }
  570|  3.31M|}
dispatcher.c:pni_consumer_readf8:
   51|  18.9M|{
   52|  18.9M|  if (consumer->position+1 > consumer->size) {
  ------------------
  |  Branch (52:7): [True: 814, False: 18.9M]
  ------------------
   53|    814|    consumer->position = consumer->size;
   54|    814|    return false;
   55|    814|  }
   56|  18.9M|  uint8_t r = consumer->output_start[consumer->position+0];
   57|  18.9M|  consumer->position++;
   58|  18.9M|  *result = r;
   59|  18.9M|  return true;
   60|  18.9M|}
dispatcher.c:consume_ulong:
  283|  3.31M|static inline bool consume_ulong(pni_consumer_t* consumer, uint64_t *ulong) {
  284|  3.31M|  *ulong = 0;
  285|  3.31M|  uint8_t type;
  286|  3.31M|  if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (286:7): [True: 1, False: 3.31M]
  ------------------
  287|  3.31M|  switch (type) {
  288|  3.31M|    case PNE_SMALLULONG: {
  ------------------
  |  |   16|  3.31M|#define PNE_SMALLULONG      (0x53)
  ------------------
  |  Branch (288:5): [True: 3.31M, False: 1.30k]
  ------------------
  289|  3.31M|      uint8_t ul;
  290|  3.31M|      if (!pni_consumer_readf8(consumer, &ul)) return false;
  ------------------
  |  Branch (290:11): [True: 2, False: 3.31M]
  ------------------
  291|  3.31M|      *ulong = ul;
  292|  3.31M|      return true;
  293|  3.31M|    }
  294|    382|    case PNE_ULONG: {
  ------------------
  |  |   15|    382|#define PNE_ULONG           (0x80)
  ------------------
  |  Branch (294:5): [True: 382, False: 3.31M]
  ------------------
  295|    382|      uint64_t ul;
  296|    382|      if (!pni_consumer_readf64(consumer, &ul)) return false;
  ------------------
  |  Branch (296:11): [True: 6, False: 376]
  ------------------
  297|    376|      *ulong = ul;
  298|    376|      return true;
  299|    382|    }
  300|     18|    case PNE_ULONG0: {
  ------------------
  |  |   17|     18|#define PNE_ULONG0          (0x44)
  ------------------
  |  Branch (300:5): [True: 18, False: 3.31M]
  ------------------
  301|     18|      *ulong = 0;
  302|     18|      return true;
  303|    382|    }
  304|    901|    default:
  ------------------
  |  Branch (304:5): [True: 901, False: 3.31M]
  ------------------
  305|    901|      pni_consumer_skip_value(consumer, type);
  306|    901|      return false;
  307|  3.31M|  }
  308|  3.31M|}
dispatcher.c:pni_consumer_readf64:
   97|    382|{
   98|    382|  uint32_t a;
   99|    382|  if (!pni_consumer_readf32(consumer, &a)) return false;
  ------------------
  |  Branch (99:7): [True: 2, False: 380]
  ------------------
  100|    380|  uint32_t b;
  101|    380|  if (!pni_consumer_readf32(consumer, &b)) return false;
  ------------------
  |  Branch (101:7): [True: 4, False: 376]
  ------------------
  102|    376|  *result = (uint64_t)a << 32 | (uint64_t)b;
  103|    376|  return true;
  104|    380|}
dispatcher.c:pni_consumer_readf32:
   78|  1.97k|{
   79|  1.97k|  if (consumer->position+4 > consumer->size) {
  ------------------
  |  Branch (79:7): [True: 73, False: 1.90k]
  ------------------
   80|     73|    consumer->position = consumer->size;
   81|     73|    return false;
   82|     73|  }
   83|  1.90k|  uint32_t a = consumer->output_start[consumer->position+0];
   84|  1.90k|  uint32_t b = consumer->output_start[consumer->position+1];
   85|  1.90k|  uint32_t c = consumer->output_start[consumer->position+2];
   86|  1.90k|  uint32_t d = consumer->output_start[consumer->position+3];
   87|  1.90k|  uint32_t r = a << 24
   88|  1.90k|  | b << 16
   89|  1.90k|  | c <<  8
   90|  1.90k|  | d;
   91|  1.90k|  consumer->position += 4;
   92|  1.90k|  *result = r;
   93|  1.90k|  return true;
   94|  1.97k|}
dispatcher.c:pni_consumer_skip_value:
  214|    901|static inline bool pni_consumer_skip_value(pni_consumer_t* consumer, uint8_t type) {
  215|       |  // Check for described type
  216|    901|  if (type==PNE_DESCRIPTOR) {
  ------------------
  |  |    5|    901|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (216:7): [True: 401, False: 500]
  ------------------
  217|       |    // Skip descriptor
  218|    401|    if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (218:9): [True: 1, False: 400]
  ------------------
  219|    400|    if (!pni_consumer_skip_value_not_described(consumer, type)) return false;
  ------------------
  |  Branch (219:9): [True: 186, False: 214]
  ------------------
  220|    214|    if (!pni_consumer_readf8(consumer, &type)) return false;
  ------------------
  |  Branch (220:9): [True: 21, False: 193]
  ------------------
  221|    193|    return pni_consumer_skip_value_not_described(consumer, type);
  222|    214|  }
  223|    500|  return pni_consumer_skip_value_not_described(consumer, type);
  224|    901|}
dispatcher.c:consume_single_value:
  250|  3.31M|static inline bool consume_single_value(pni_consumer_t* consumer, uint8_t* type) {
  251|  3.31M|  uint8_t t;
  252|  3.31M|  if (!pni_consumer_readf8(consumer, &t)) return false;
  ------------------
  |  Branch (252:7): [True: 520, False: 3.31M]
  ------------------
  253|  3.31M|  *type = t;
  254|  3.31M|  if (t==PNE_DESCRIPTOR) {
  ------------------
  |  |    5|  3.31M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (254:7): [True: 353, False: 3.31M]
  ------------------
  255|    353|    uint8_t dummy;
  256|       |    // Descriptor
  257|    353|    bool dq = consume_single_value_not_described(consumer, &dummy);
  258|       |    // Value
  259|    353|    bool vq = consume_single_value_not_described(consumer, &dummy);
  260|    353|    return dq && vq;
  ------------------
  |  Branch (260:12): [True: 163, False: 190]
  |  Branch (260:18): [True: 48, False: 115]
  ------------------
  261|  3.31M|  } else {
  262|  3.31M|    return pni_consumer_skip_value_not_described(consumer, t);
  263|  3.31M|  }
  264|  3.31M|}
dispatcher.c:consume_single_value_not_described:
  241|    706|static inline bool consume_single_value_not_described(pni_consumer_t* consumer, uint8_t* type) {
  242|    706|  uint8_t t;
  243|    706|  if (!pni_consumer_readf8(consumer, &t)) return false;
  ------------------
  |  Branch (243:7): [True: 229, False: 477]
  ------------------
  244|    477|  if (!pni_consumer_skip_value_not_described(consumer, t)) return false;
  ------------------
  |  Branch (244:7): [True: 266, False: 211]
  ------------------
  245|    211|  if (t==0) return false;
  ------------------
  |  Branch (245:7): [True: 0, False: 211]
  ------------------
  246|    211|  *type = t;
  247|    211|  return true;
  248|    211|}
dispatcher.c:pni_consumer_skip_value_not_described:
  209|  3.32M|static inline bool pni_consumer_skip_value_not_described(pni_consumer_t* consumer, uint8_t type) {
  210|  3.32M|  pn_bytes_t value;
  211|  3.32M|  return pni_consumer_read_value_not_described(consumer, type, &value);
  212|  3.32M|}
dispatcher.c:pni_consumer_read_value_not_described:
  141|  3.32M|static inline bool pni_consumer_read_value_not_described(pni_consumer_t* consumer, uint8_t type, pn_bytes_t *value) {
  142|  3.32M|  uint8_t subcategory = type >> 4;
  143|  3.32M|  switch (subcategory) {
  144|       |    // Fixed width types:
  145|       |    // No data
  146|   923k|    case 0x4:
  ------------------
  |  Branch (146:5): [True: 923k, False: 2.39M]
  ------------------
  147|   923k|      *value = (pn_bytes_t){.size=0,.start=NULL};
  148|   923k|      return true;
  149|       |      // 1 Octet
  150|    285|    case 0x5:
  ------------------
  |  Branch (150:5): [True: 285, False: 3.31M]
  ------------------
  151|    285|      if (consumer->position+1 > consumer->size) break;
  ------------------
  |  Branch (151:11): [True: 21, False: 264]
  ------------------
  152|    264|      *value = (pn_bytes_t){.size=1,.start=(const char *)consumer->output_start+consumer->position};
  153|    264|      consumer->position += 1;
  154|    264|      return true;
  155|       |      // 2 Octets
  156|     92|    case 0x6:
  ------------------
  |  Branch (156:5): [True: 92, False: 3.32M]
  ------------------
  157|     92|      if (consumer->position+2 > consumer->size) break;
  ------------------
  |  Branch (157:11): [True: 17, False: 75]
  ------------------
  158|     75|      *value = (pn_bytes_t){.size=2,.start=(const char *)consumer->output_start+consumer->position};
  159|     75|      consumer->position += 2;
  160|     75|      return true;
  161|       |      // 4 Octets
  162|     87|    case 0x7:
  ------------------
  |  Branch (162:5): [True: 87, False: 3.32M]
  ------------------
  163|     87|      if (consumer->position+4 > consumer->size) break;
  ------------------
  |  Branch (163:11): [True: 24, False: 63]
  ------------------
  164|     63|      *value = (pn_bytes_t){.size=4,.start=(const char *)consumer->output_start+consumer->position};
  165|     63|      consumer->position += 4;
  166|     63|      return true;
  167|       |      // 8 Octets
  168|     75|    case 0x8:
  ------------------
  |  Branch (168:5): [True: 75, False: 3.32M]
  ------------------
  169|     75|      if (consumer->position+8 > consumer->size) break;
  ------------------
  |  Branch (169:11): [True: 41, False: 34]
  ------------------
  170|     34|      *value = (pn_bytes_t){.size=8,.start=(const char *)consumer->output_start+consumer->position};
  171|     34|      consumer->position += 8;
  172|     34|      return true;
  173|       |      // 16 Octets
  174|     76|    case 0x9:
  ------------------
  |  Branch (174:5): [True: 76, False: 3.32M]
  ------------------
  175|     76|      if (consumer->position+16 > consumer->size) break;
  ------------------
  |  Branch (175:11): [True: 47, False: 29]
  ------------------
  176|     29|      *value = (pn_bytes_t){.size=16,.start=(const char *)consumer->output_start+consumer->position};
  177|     29|      consumer->position += 16;
  178|     29|      return true;
  179|       |      // Variable width types:
  180|       |      // One Octet of size
  181|     78|    case 0xA:
  ------------------
  |  Branch (181:5): [True: 78, False: 3.32M]
  ------------------
  182|  2.39M|    case 0xC:
  ------------------
  |  Branch (182:5): [True: 2.39M, False: 925k]
  ------------------
  183|  2.39M|    case 0xE: {
  ------------------
  |  Branch (183:5): [True: 57, False: 3.32M]
  ------------------
  184|  2.39M|      uint8_t size;
  185|  2.39M|      if (!pni_consumer_readf8(consumer, &size)) return false;
  ------------------
  |  Branch (185:11): [True: 40, False: 2.39M]
  ------------------
  186|  2.39M|      if (consumer->position+size > consumer->size) break;
  ------------------
  |  Branch (186:11): [True: 163, False: 2.39M]
  ------------------
  187|  2.39M|      *value = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  188|  2.39M|      consumer->position += size;
  189|  2.39M|      return true;
  190|  2.39M|    }
  191|       |    // 4 Octets of size
  192|    101|    case 0xB:
  ------------------
  |  Branch (192:5): [True: 101, False: 3.32M]
  ------------------
  193|    943|    case 0xD:
  ------------------
  |  Branch (193:5): [True: 842, False: 3.31M]
  ------------------
  194|  1.21k|    case 0xF: {
  ------------------
  |  Branch (194:5): [True: 274, False: 3.32M]
  ------------------
  195|  1.21k|      uint32_t size;
  196|  1.21k|      if (!pni_consumer_readf32(consumer, &size)) return false;
  ------------------
  |  Branch (196:11): [True: 67, False: 1.15k]
  ------------------
  197|  1.15k|      if (consumer->position+size > consumer->size) break;
  ------------------
  |  Branch (197:11): [True: 328, False: 822]
  ------------------
  198|    822|      *value = (pn_bytes_t){.size=size,.start=(const char *)consumer->output_start+consumer->position};
  199|    822|      consumer->position += size;
  200|    822|      return true;
  201|  1.15k|    }
  202|    431|    default:
  ------------------
  |  Branch (202:5): [True: 431, False: 3.31M]
  ------------------
  203|    431|      break;
  204|  3.32M|  }
  205|  1.07k|  consumer->position = consumer->size;
  206|  1.07k|  return false;
  207|  3.32M|}
dispatcher.c:pni_islist:
  226|  3.31M|static inline bool pni_islist(pni_consumer_t* consumer) {
  227|  3.31M|  uint8_t t;
  228|  3.31M|  if (!pni_consumer_readf8(consumer, &t)) return false;
  ------------------
  |  Branch (228:7): [True: 0, False: 3.31M]
  ------------------
  229|  3.31M|  switch (t) {
  230|   922k|    case PNE_LIST0:
  ------------------
  |  |   38|   922k|#define PNE_LIST0           (0x45)
  ------------------
  |  Branch (230:5): [True: 922k, False: 2.39M]
  ------------------
  231|  3.31M|    case PNE_LIST8:
  ------------------
  |  |   39|  3.31M|#define PNE_LIST8           (0xc0)
  ------------------
  |  Branch (231:5): [True: 2.39M, False: 923k]
  ------------------
  232|  3.31M|    case PNE_LIST32:
  ------------------
  |  |   40|  3.31M|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (232:5): [True: 767, False: 3.31M]
  ------------------
  233|  3.31M|      return true;
  234|     93|    default:
  ------------------
  |  Branch (234:5): [True: 93, False: 3.31M]
  ------------------
  235|     93|      return false;
  236|  3.31M|  }
  237|  3.31M|}

codec.c:pn_data_node:
   64|  2.88G|{
   65|  2.88G|  return nd ? (data->nodes + nd - 1) : NULL;
  ------------------
  |  Branch (65:10): [True: 2.88G, False: 5.78M]
  ------------------
   66|  2.88G|}

pn_decoder_initialize:
   36|  1.05M|{
   37|  1.05M|  decoder->input = NULL;
   38|  1.05M|  decoder->size = 0;
   39|  1.05M|  decoder->position = NULL;
   40|  1.05M|  decoder->error = NULL;
   41|  1.05M|}
pn_decoder_finalize:
   44|  1.05M|{
   45|  1.05M|  pn_error_free(decoder->error);
   46|  1.05M|}
pn_decoder_decode:
  522|  1.05M|{
  523|  1.05M|  decoder->input = src;
  524|  1.05M|  decoder->size = size;
  525|  1.05M|  decoder->position = src;
  526|       |
  527|  1.05M|  int err = pni_decoder_single(decoder, dst);
  528|       |
  529|  1.05M|  if (err == PN_UNDERFLOW) 
  ------------------
  |  |   50|  1.05M|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (529:7): [True: 367k, False: 689k]
  ------------------
  530|   367k|      return pn_error_format(pn_data_error(dst), PN_UNDERFLOW, "not enough data to decode");
  ------------------
  |  |   50|   367k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  531|   689k|  if (err) return err;
  ------------------
  |  Branch (531:7): [True: 449k, False: 239k]
  ------------------
  532|       |
  533|   239k|  return decoder->position - decoder->input;
  534|   689k|}
decoder.c:pni_decoder_single:
  509|  1.88M|{
  510|  1.88M|  uint8_t code;
  511|  1.88M|  int err = pni_decoder_decode_type(decoder, data, &code);
  512|  1.88M|  if (err) return err;
  ------------------
  |  Branch (512:7): [True: 405k, False: 1.48M]
  ------------------
  513|  1.48M|  err = pni_decoder_decode_value(decoder, data, code);
  514|  1.48M|  if (err) return err;
  ------------------
  |  Branch (514:7): [True: 1.16M, False: 321k]
  ------------------
  515|   321k|  if (pni_data_parent_type(data) == PN_DESCRIBED && pn_data_siblings(data) > 1) {
  ------------------
  |  Branch (515:7): [True: 35.8k, False: 285k]
  |  Branch (515:53): [True: 35.8k, False: 0]
  ------------------
  516|  35.8k|    pn_data_exit(data);
  517|  35.8k|  }
  518|   321k|  return 0;
  519|  1.48M|}
decoder.c:pni_decoder_decode_type:
  442|  2.01M|{
  443|  2.01M|  int err;
  444|       |
  445|  2.01M|  if (!pn_decoder_remaining(decoder)) {
  ------------------
  |  Branch (445:7): [True: 3.27k, False: 2.01M]
  ------------------
  446|  3.27k|    return PN_UNDERFLOW;
  ------------------
  |  |   50|  3.27k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  447|  3.27k|  }
  448|       |
  449|  2.01M|  uint8_t next = *decoder->position++;
  450|       |
  451|  2.01M|  if (next != PNE_DESCRIPTOR) {
  ------------------
  |  |    5|  2.01M|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (451:7): [True: 1.51M, False: 499k]
  ------------------
  452|  1.51M|    *code = next;
  453|  1.51M|    return 0;
  454|  1.51M|  }
  455|       |
  456|   499k|  if (pni_data_parent_type(data) != PN_ARRAY) {
  ------------------
  |  Branch (456:7): [True: 496k, False: 2.88k]
  ------------------
  457|   496k|    err = pn_data_put_described(data);
  458|   496k|    if (err) return err;
  ------------------
  |  Branch (458:9): [True: 89, False: 496k]
  ------------------
  459|       |
  460|       |    // pni_decoder_single has the corresponding exit
  461|   496k|    pn_data_enter(data);
  462|   496k|  }
  463|       |
  464|   499k|  err = pni_decoder_single_described(decoder, data);
  465|   499k|  if (err) return err;
  ------------------
  |  Branch (465:7): [True: 402k, False: 96.5k]
  ------------------
  466|       |
  467|  96.5k|  err = pni_decoder_decode_type(decoder, data, code);
  468|  96.5k|  if (err) return err;
  ------------------
  |  Branch (468:7): [True: 7.80k, False: 88.7k]
  ------------------
  469|       |
  470|  88.7k|  return 0;
  471|  96.5k|}
decoder.c:pn_decoder_remaining:
   93|  4.89M|{
   94|  4.89M|  return decoder->input + decoder->size - decoder->position;
   95|  4.89M|}
decoder.c:pni_decoder_single_described:
  488|   499k|{
  489|   499k|  if (!pn_decoder_remaining(decoder)) {
  ------------------
  |  Branch (489:7): [True: 4.24k, False: 494k]
  ------------------
  490|  4.24k|    return PN_UNDERFLOW;
  ------------------
  |  |   50|  4.24k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  491|  4.24k|  }
  492|       |
  493|   494k|  uint8_t code = *decoder->position++;;
  494|       |
  495|   494k|  if (!pni_allowed_descriptor_code(code)) {
  ------------------
  |  Branch (495:7): [True: 35.2k, False: 459k]
  ------------------
  496|  35.2k|    return PN_ARG_ERR;
  ------------------
  |  |   52|  35.2k|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  497|  35.2k|  }
  498|       |
  499|   459k|  int err = pni_decoder_decode_value(decoder, data, code);
  500|   459k|  if (err) return err;
  ------------------
  |  Branch (500:7): [True: 363k, False: 96.5k]
  ------------------
  501|       |
  502|  96.5k|  if (pni_data_parent_type(data) == PN_DESCRIBED && pn_data_siblings(data) > 1) {
  ------------------
  |  Branch (502:7): [True: 94.0k, False: 2.50k]
  |  Branch (502:53): [True: 0, False: 94.0k]
  ------------------
  503|      0|    pn_data_exit(data);
  504|      0|  }
  505|  96.5k|  return 0;
  506|   459k|}
decoder.c:pni_allowed_descriptor_code:
  479|   494k|{
  480|   494k|  return
  481|   494k|    code != PNE_DESCRIPTOR &&
  ------------------
  |  |    5|   989k|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (481:5): [True: 466k, False: 28.6k]
  ------------------
  482|   494k|    code != PNE_ARRAY8 && code != PNE_ARRAY32 &&
  ------------------
  |  |   43|   961k|#define PNE_ARRAY8          (0xe0)
  ------------------
                  code != PNE_ARRAY8 && code != PNE_ARRAY32 &&
  ------------------
  |  |   44|   956k|#define PNE_ARRAY32         (0xf0)
  ------------------
  |  Branch (482:5): [True: 461k, False: 4.62k]
  |  Branch (482:27): [True: 461k, False: 201]
  ------------------
  483|   494k|    code != PNE_LIST8 && code != PNE_LIST32 &&
  ------------------
  |  |   39|   956k|#define PNE_LIST8           (0xc0)
  ------------------
                  code != PNE_LIST8 && code != PNE_LIST32 &&
  ------------------
  |  |   40|   955k|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (483:5): [True: 460k, False: 613]
  |  Branch (483:26): [True: 460k, False: 596]
  ------------------
  484|   494k|    code != PNE_MAP8 && code != PNE_MAP32;
  ------------------
  |  |   41|   955k|#define PNE_MAP8            (0xc1)
  ------------------
                  code != PNE_MAP8 && code != PNE_MAP32;
  ------------------
  |  |   42|   954k|#define PNE_MAP32           (0xd1)
  ------------------
  |  Branch (484:5): [True: 460k, False: 211]
  |  Branch (484:25): [True: 459k, False: 319]
  ------------------
  485|   494k|}
decoder.c:pni_decoder_decode_value:
  185|   329M|{
  186|   329M|  int err;
  187|   329M|  conv_t conv;
  188|   329M|  pn_decimal128_t dec128;
  189|   329M|  pn_uuid_t uuid;
  190|   329M|  size_t size;
  191|   329M|  size_t count;
  192|       |
  193|   329M|  switch (code)
  194|   329M|  {
  195|  25.2M|  case PNE_NULL:
  ------------------
  |  |    6|  25.2M|#define PNE_NULL            (0x40)
  ------------------
  |  Branch (195:3): [True: 25.2M, False: 304M]
  ------------------
  196|  25.2M|    err = pn_data_put_null(data);
  197|  25.2M|    break;
  198|  22.3M|  case PNE_TRUE:
  ------------------
  |  |    8|  22.3M|#define PNE_TRUE            (0x41)
  ------------------
  |  Branch (198:3): [True: 22.3M, False: 307M]
  ------------------
  199|  22.3M|    err = pn_data_put_bool(data, true);
  200|  22.3M|    break;
  201|  17.3M|  case PNE_FALSE:
  ------------------
  |  |    9|  17.3M|#define PNE_FALSE           (0x42)
  ------------------
  |  Branch (201:3): [True: 17.3M, False: 312M]
  ------------------
  202|  17.3M|    err = pn_data_put_bool(data, false);
  203|  17.3M|    break;
  204|  39.0k|  case PNE_BOOLEAN:
  ------------------
  |  |    7|  39.0k|#define PNE_BOOLEAN         (0x56)
  ------------------
  |  Branch (204:3): [True: 39.0k, False: 329M]
  ------------------
  205|  39.0k|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   50|  1.87k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (205:9): [True: 1.87k, False: 37.1k]
  ------------------
  206|  37.1k|    err = pn_data_put_bool(data, pn_decoder_readf8(decoder) != 0);
  207|  37.1k|    break;
  208|  31.0k|  case PNE_UBYTE:
  ------------------
  |  |   10|  31.0k|#define PNE_UBYTE           (0x50)
  ------------------
  |  Branch (208:3): [True: 31.0k, False: 329M]
  ------------------
  209|  31.0k|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   50|    244|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (209:9): [True: 244, False: 30.7k]
  ------------------
  210|  30.7k|    err = pn_data_put_ubyte(data, pn_decoder_readf8(decoder));
  211|  30.7k|    break;
  212|  39.7k|  case PNE_BYTE:
  ------------------
  |  |   18|  39.7k|#define PNE_BYTE            (0x51)
  ------------------
  |  Branch (212:3): [True: 39.7k, False: 329M]
  ------------------
  213|  39.7k|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   50|    265|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (213:9): [True: 265, False: 39.4k]
  ------------------
  214|  39.4k|    err = pn_data_put_byte(data, pn_decoder_readf8(decoder));
  215|  39.4k|    break;
  216|  35.6k|  case PNE_USHORT:
  ------------------
  |  |   11|  35.6k|#define PNE_USHORT          (0x60)
  ------------------
  |  Branch (216:3): [True: 35.6k, False: 329M]
  ------------------
  217|  35.6k|    if (pn_decoder_remaining(decoder) < 2) return PN_UNDERFLOW;
  ------------------
  |  |   50|  21.4k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (217:9): [True: 21.4k, False: 14.1k]
  ------------------
  218|  14.1k|    err = pn_data_put_ushort(data, pn_decoder_readf16(decoder));
  219|  14.1k|    break;
  220|  7.10k|  case PNE_SHORT:
  ------------------
  |  |   19|  7.10k|#define PNE_SHORT           (0x61)
  ------------------
  |  Branch (220:3): [True: 7.10k, False: 329M]
  ------------------
  221|  7.10k|    if (pn_decoder_remaining(decoder) < 2) return PN_UNDERFLOW;
  ------------------
  |  |   50|    607|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (221:9): [True: 607, False: 6.49k]
  ------------------
  222|  6.49k|    err = pn_data_put_short(data, pn_decoder_readf16(decoder));
  223|  6.49k|    break;
  224|  4.29k|  case PNE_UINT:
  ------------------
  |  |   12|  4.29k|#define PNE_UINT            (0x70)
  ------------------
  |  Branch (224:3): [True: 4.29k, False: 329M]
  ------------------
  225|  4.29k|    if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   50|    279|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (225:9): [True: 279, False: 4.02k]
  ------------------
  226|  4.02k|    err = pn_data_put_uint(data, pn_decoder_readf32(decoder));
  227|  4.02k|    break;
  228|   174M|  case PNE_UINT0:
  ------------------
  |  |   14|   174M|#define PNE_UINT0           (0x43)
  ------------------
  |  Branch (228:3): [True: 174M, False: 154M]
  ------------------
  229|   174M|    err = pn_data_put_uint(data, 0);
  230|   174M|    break;
  231|  5.53k|  case PNE_SMALLUINT:
  ------------------
  |  |   13|  5.53k|#define PNE_SMALLUINT       (0x52)
  ------------------
  |  Branch (231:3): [True: 5.53k, False: 329M]
  ------------------
  232|  5.53k|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   50|    234|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (232:9): [True: 234, False: 5.29k]
  ------------------
  233|  5.29k|    err = pn_data_put_uint(data, pn_decoder_readf8(decoder));
  234|  5.29k|    break;
  235|  15.1k|  case PNE_SMALLINT:
  ------------------
  |  |   21|  15.1k|#define PNE_SMALLINT        (0x54)
  ------------------
  |  Branch (235:3): [True: 15.1k, False: 329M]
  ------------------
  236|  15.1k|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   50|    364|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (236:9): [True: 364, False: 14.7k]
  ------------------
  237|  14.7k|    err = pn_data_put_int(data, (int8_t)pn_decoder_readf8(decoder));
  238|  14.7k|    break;
  239|  1.86k|  case PNE_INT:
  ------------------
  |  |   20|  1.86k|#define PNE_INT             (0x71)
  ------------------
  |  Branch (239:3): [True: 1.86k, False: 329M]
  ------------------
  240|  1.86k|    if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   50|    298|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (240:9): [True: 298, False: 1.56k]
  ------------------
  241|  1.56k|    err = pn_data_put_int(data, pn_decoder_readf32(decoder));
  242|  1.56k|    break;
  243|  8.67k|  case PNE_UTF32:
  ------------------
  |  |   29|  8.67k|#define PNE_UTF32           (0x73)
  ------------------
  |  Branch (243:3): [True: 8.67k, False: 329M]
  ------------------
  244|  8.67k|    if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   50|    413|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (244:9): [True: 413, False: 8.25k]
  ------------------
  245|  8.25k|    err = pn_data_put_char(data, pn_decoder_readf32(decoder));
  246|  8.25k|    break;
  247|  5.54k|  case PNE_FLOAT:
  ------------------
  |  |   24|  5.54k|#define PNE_FLOAT           (0x72)
  ------------------
  |  Branch (247:3): [True: 5.54k, False: 329M]
  ------------------
  248|  5.54k|    if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   50|    725|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (248:9): [True: 725, False: 4.82k]
  ------------------
  249|       |    // XXX: this assumes the platform uses IEEE floats
  250|  4.82k|    conv.i = pn_decoder_readf32(decoder);
  251|  4.82k|    err = pn_data_put_float(data, conv.f);
  252|  4.82k|    break;
  253|  2.96k|  case PNE_DECIMAL32:
  ------------------
  |  |   26|  2.96k|#define PNE_DECIMAL32       (0x74)
  ------------------
  |  Branch (253:3): [True: 2.96k, False: 329M]
  ------------------
  254|  2.96k|    if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   50|    278|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (254:9): [True: 278, False: 2.68k]
  ------------------
  255|  2.68k|    err = pn_data_put_decimal32(data, pn_decoder_readf32(decoder));
  256|  2.68k|    break;
  257|  7.46k|  case PNE_ULONG:
  ------------------
  |  |   15|  7.46k|#define PNE_ULONG           (0x80)
  ------------------
  |  Branch (257:3): [True: 7.46k, False: 329M]
  ------------------
  258|  7.46k|    if (pn_decoder_remaining(decoder) < 8) return PN_UNDERFLOW;
  ------------------
  |  |   50|    661|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (258:9): [True: 661, False: 6.79k]
  ------------------
  259|  6.79k|    err = pn_data_put_ulong(data, pn_decoder_readf64(decoder));
  260|  6.79k|    break;
  261|  5.17k|  case PNE_LONG:
  ------------------
  |  |   22|  5.17k|#define PNE_LONG            (0x81)
  ------------------
  |  Branch (261:3): [True: 5.17k, False: 329M]
  ------------------
  262|  5.17k|    if (pn_decoder_remaining(decoder) < 8) return PN_UNDERFLOW;
  ------------------
  |  |   50|    277|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (262:9): [True: 277, False: 4.89k]
  ------------------
  263|  4.89k|    err = pn_data_put_long(data, pn_decoder_readf64(decoder));
  264|  4.89k|    break;
  265|  5.34k|  case PNE_MS64:
  ------------------
  |  |   30|  5.34k|#define PNE_MS64            (0x83)
  ------------------
  |  Branch (265:3): [True: 5.34k, False: 329M]
  ------------------
  266|  5.34k|    if (pn_decoder_remaining(decoder) < 8) return PN_UNDERFLOW;
  ------------------
  |  |   50|    529|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (266:9): [True: 529, False: 4.81k]
  ------------------
  267|  4.81k|    err = pn_data_put_timestamp(data, pn_decoder_readf64(decoder));
  268|  4.81k|    break;
  269|  3.04k|  case PNE_DOUBLE:
  ------------------
  |  |   25|  3.04k|#define PNE_DOUBLE          (0x82)
  ------------------
  |  Branch (269:3): [True: 3.04k, False: 329M]
  ------------------
  270|       |    // XXX: this assumes the platform uses IEEE floats
  271|  3.04k|    if (pn_decoder_remaining(decoder) < 8) return PN_UNDERFLOW;
  ------------------
  |  |   50|    255|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (271:9): [True: 255, False: 2.79k]
  ------------------
  272|  2.79k|    conv.l = pn_decoder_readf64(decoder);
  273|  2.79k|    err = pn_data_put_double(data, conv.d);
  274|  2.79k|    break;
  275|  2.34k|  case PNE_DECIMAL64:
  ------------------
  |  |   27|  2.34k|#define PNE_DECIMAL64       (0x84)
  ------------------
  |  Branch (275:3): [True: 2.34k, False: 329M]
  ------------------
  276|  2.34k|    if (pn_decoder_remaining(decoder) < 8) return PN_UNDERFLOW;
  ------------------
  |  |   50|    288|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (276:9): [True: 288, False: 2.05k]
  ------------------
  277|  2.05k|    err = pn_data_put_decimal64(data, pn_decoder_readf64(decoder));
  278|  2.05k|    break;
  279|  27.0M|  case PNE_ULONG0:
  ------------------
  |  |   17|  27.0M|#define PNE_ULONG0          (0x44)
  ------------------
  |  Branch (279:3): [True: 27.0M, False: 302M]
  ------------------
  280|  27.0M|    err = pn_data_put_ulong(data, 0);
  281|  27.0M|    break;
  282|  83.0k|  case PNE_SMALLULONG:
  ------------------
  |  |   16|  83.0k|#define PNE_SMALLULONG      (0x53)
  ------------------
  |  Branch (282:3): [True: 83.0k, False: 329M]
  ------------------
  283|  83.0k|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   50|    518|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (283:9): [True: 518, False: 82.5k]
  ------------------
  284|  82.5k|    err = pn_data_put_ulong(data, pn_decoder_readf8(decoder));
  285|  82.5k|    break;
  286|  18.5k|  case PNE_SMALLLONG:
  ------------------
  |  |   23|  18.5k|#define PNE_SMALLLONG       (0x55)
  ------------------
  |  Branch (286:3): [True: 18.5k, False: 329M]
  ------------------
  287|  18.5k|    if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   50|    275|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (287:9): [True: 275, False: 18.2k]
  ------------------
  288|  18.2k|    err = pn_data_put_long(data, (int8_t)pn_decoder_readf8(decoder));
  289|  18.2k|    break;
  290|  2.24k|  case PNE_DECIMAL128:
  ------------------
  |  |   28|  2.24k|#define PNE_DECIMAL128      (0x94)
  ------------------
  |  Branch (290:3): [True: 2.24k, False: 329M]
  ------------------
  291|  2.24k|    if (pn_decoder_remaining(decoder) < 16) return PN_UNDERFLOW;
  ------------------
  |  |   50|    313|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (291:9): [True: 313, False: 1.92k]
  ------------------
  292|  1.92k|    pn_decoder_readf128(decoder, &dec128);
  293|  1.92k|    err = pn_data_put_decimal128(data, dec128);
  294|  1.92k|    break;
  295|  2.89k|  case PNE_UUID:
  ------------------
  |  |   31|  2.89k|#define PNE_UUID            (0x98)
  ------------------
  |  Branch (295:3): [True: 2.89k, False: 329M]
  ------------------
  296|  2.89k|    if (pn_decoder_remaining(decoder) < 16) return PN_UNDERFLOW;
  ------------------
  |  |   50|    488|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (296:9): [True: 488, False: 2.41k]
  ------------------
  297|  2.41k|    pn_decoder_readf128(decoder, &uuid);
  298|  2.41k|    err = pn_data_put_uuid(data, uuid);
  299|  2.41k|    break;
  300|  38.6k|  case PNE_VBIN8:
  ------------------
  |  |   32|  38.6k|#define PNE_VBIN8           (0xa0)
  ------------------
  |  Branch (300:3): [True: 38.6k, False: 329M]
  ------------------
  301|  60.4k|  case PNE_STR8_UTF8:
  ------------------
  |  |   34|  60.4k|#define PNE_STR8_UTF8       (0xa1)
  ------------------
  |  Branch (301:3): [True: 21.7k, False: 329M]
  ------------------
  302|  69.7k|  case PNE_SYM8:
  ------------------
  |  |   36|  69.7k|#define PNE_SYM8            (0xa3)
  ------------------
  |  Branch (302:3): [True: 9.27k, False: 329M]
  ------------------
  303|  70.2k|  case PNE_VBIN32:
  ------------------
  |  |   33|  70.2k|#define PNE_VBIN32          (0xb0)
  ------------------
  |  Branch (303:3): [True: 519, False: 329M]
  ------------------
  304|   378k|  case PNE_STR32_UTF8:
  ------------------
  |  |   35|   378k|#define PNE_STR32_UTF8      (0xb1)
  ------------------
  |  Branch (304:3): [True: 308k, False: 329M]
  ------------------
  305|   381k|  case PNE_SYM32:
  ------------------
  |  |   37|   381k|#define PNE_SYM32           (0xb3)
  ------------------
  |  Branch (305:3): [True: 3.34k, False: 329M]
  ------------------
  306|   381k|    switch (code & 0xF0)
  307|   381k|    {
  308|  69.7k|    case 0xA0:
  ------------------
  |  Branch (308:5): [True: 69.7k, False: 312k]
  ------------------
  309|  69.7k|      if (!pn_decoder_remaining(decoder)) return PN_UNDERFLOW;
  ------------------
  |  |   50|    393|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (309:11): [True: 393, False: 69.3k]
  ------------------
  310|  69.3k|      size = pn_decoder_readf8(decoder);
  311|  69.3k|      break;
  312|   312k|    case 0xB0:
  ------------------
  |  Branch (312:5): [True: 312k, False: 69.7k]
  ------------------
  313|   312k|      if (pn_decoder_remaining(decoder) < 4) return PN_UNDERFLOW;
  ------------------
  |  |   50|   307k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (313:11): [True: 307k, False: 4.68k]
  ------------------
  314|  4.68k|      size = pn_decoder_readf32(decoder);
  315|  4.68k|      break;
  316|      0|    default:
  ------------------
  |  Branch (316:5): [True: 0, False: 381k]
  ------------------
  317|      0|      return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  318|   381k|    }
  319|       |
  320|  74.0k|    if (pn_decoder_remaining(decoder) < size) return PN_UNDERFLOW;
  ------------------
  |  |   50|  2.64k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (320:9): [True: 2.64k, False: 71.3k]
  ------------------
  321|       |
  322|  71.3k|    {
  323|  71.3k|      char *start = (char *) decoder->position;
  324|  71.3k|      pn_bytes_t bytes = {size, start};
  325|  71.3k|      switch (code & 0x0F)
  326|  71.3k|      {
  327|  37.6k|      case 0x0:
  ------------------
  |  Branch (327:7): [True: 37.6k, False: 33.7k]
  ------------------
  328|  37.6k|        err = pn_data_put_binary(data, bytes);
  329|  37.6k|        break;
  330|  22.4k|      case 0x1:
  ------------------
  |  Branch (330:7): [True: 22.4k, False: 48.9k]
  ------------------
  331|  22.4k|        err = pn_data_put_string(data, bytes);
  332|  22.4k|        break;
  333|  11.2k|      case 0x3:
  ------------------
  |  Branch (333:7): [True: 11.2k, False: 60.1k]
  ------------------
  334|  11.2k|        err = pn_data_put_symbol(data, bytes);
  335|  11.2k|        break;
  336|      0|      default:
  ------------------
  |  Branch (336:7): [True: 0, False: 71.3k]
  ------------------
  337|      0|        return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  338|  71.3k|      }
  339|  71.3k|    }
  340|       |
  341|  71.3k|    decoder->position += size;
  342|  71.3k|    break;
  343|  60.7M|  case PNE_LIST0:
  ------------------
  |  |   38|  60.7M|#define PNE_LIST0           (0x45)
  ------------------
  |  Branch (343:3): [True: 60.7M, False: 268M]
  ------------------
  344|  60.7M|    err = pn_data_put_list(data);
  345|  60.7M|    break;
  346|  31.7k|  case PNE_ARRAY8:
  ------------------
  |  |   43|  31.7k|#define PNE_ARRAY8          (0xe0)
  ------------------
  |  Branch (346:3): [True: 31.7k, False: 329M]
  ------------------
  347|  41.4k|  case PNE_ARRAY32:
  ------------------
  |  |   44|  41.4k|#define PNE_ARRAY32         (0xf0)
  ------------------
  |  Branch (347:3): [True: 9.67k, False: 329M]
  ------------------
  348|   554k|  case PNE_LIST8:
  ------------------
  |  |   39|   554k|#define PNE_LIST8           (0xc0)
  ------------------
  |  Branch (348:3): [True: 513k, False: 328M]
  ------------------
  349|   559k|  case PNE_LIST32:
  ------------------
  |  |   40|   559k|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (349:3): [True: 5.34k, False: 329M]
  ------------------
  350|   807k|  case PNE_MAP8:
  ------------------
  |  |   41|   807k|#define PNE_MAP8            (0xc1)
  ------------------
  |  Branch (350:3): [True: 247k, False: 329M]
  ------------------
  351|   807k|  case PNE_MAP32: {
  ------------------
  |  |   42|   807k|#define PNE_MAP32           (0xd1)
  ------------------
  |  Branch (351:3): [True: 653, False: 329M]
  ------------------
  352|   807k|    size_t min_expected_size = 0;
  353|   807k|    switch (code)
  354|   807k|    {
  355|  31.7k|    case PNE_ARRAY8:
  ------------------
  |  |   43|  31.7k|#define PNE_ARRAY8          (0xe0)
  ------------------
  |  Branch (355:5): [True: 31.7k, False: 775k]
  ------------------
  356|  31.7k|      min_expected_size += 1; // Array has a constructor of at least 1 byte
  357|   544k|    case PNE_LIST8:
  ------------------
  |  |   39|   544k|#define PNE_LIST8           (0xc0)
  ------------------
  |  Branch (357:5): [True: 513k, False: 294k]
  ------------------
  358|   792k|    case PNE_MAP8:
  ------------------
  |  |   41|   792k|#define PNE_MAP8            (0xc1)
  ------------------
  |  Branch (358:5): [True: 247k, False: 560k]
  ------------------
  359|   792k|      min_expected_size += 1; // All these types have a count
  360|   792k|      if (pn_decoder_remaining(decoder) < min_expected_size+1) return PN_UNDERFLOW;
  ------------------
  |  |   50|  11.8k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (360:11): [True: 11.8k, False: 780k]
  ------------------
  361|   780k|      size = pn_decoder_readf8(decoder);
  362|       |      // size must be at least big enough for count or count+constructor
  363|   780k|      if (size < min_expected_size) return PN_ARG_ERR;
  ------------------
  |  |   52|  1.59k|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (363:11): [True: 1.59k, False: 778k]
  ------------------
  364|   778k|      if (pn_decoder_remaining(decoder) < size) return PN_UNDERFLOW;
  ------------------
  |  |   50|  2.04k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (364:11): [True: 2.04k, False: 776k]
  ------------------
  365|   776k|      count = pn_decoder_readf8(decoder);
  366|   776k|      break;
  367|  9.67k|    case PNE_ARRAY32:
  ------------------
  |  |   44|  9.67k|#define PNE_ARRAY32         (0xf0)
  ------------------
  |  Branch (367:5): [True: 9.67k, False: 798k]
  ------------------
  368|  9.67k|      min_expected_size += 1; // Array has a constructor of at least 1 byte
  369|  15.0k|    case PNE_LIST32:
  ------------------
  |  |   40|  15.0k|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (369:5): [True: 5.34k, False: 802k]
  ------------------
  370|  15.6k|    case PNE_MAP32:
  ------------------
  |  |   42|  15.6k|#define PNE_MAP32           (0xd1)
  ------------------
  |  Branch (370:5): [True: 653, False: 807k]
  ------------------
  371|  15.6k|      min_expected_size += 4; // All these types have a count
  372|  15.6k|      if (pn_decoder_remaining(decoder) < min_expected_size+4) return PN_UNDERFLOW;
  ------------------
  |  |   50|  5.05k|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (372:11): [True: 5.05k, False: 10.6k]
  ------------------
  373|  10.6k|      size = pn_decoder_readf32(decoder);
  374|       |      // size must be at least big enough for count or count+constructor
  375|  10.6k|      if (size < min_expected_size) return PN_ARG_ERR;
  ------------------
  |  |   52|    195|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (375:11): [True: 195, False: 10.4k]
  ------------------
  376|  10.4k|      if (pn_decoder_remaining(decoder) < size) return PN_UNDERFLOW;
  ------------------
  |  |   50|    533|#define PN_UNDERFLOW (-4)      /**< Underflow error */
  ------------------
  |  Branch (376:11): [True: 533, False: 9.89k]
  ------------------
  377|  9.89k|      count = pn_decoder_readf32(decoder);
  378|  9.89k|      break;
  379|      0|    default:
  ------------------
  |  Branch (379:5): [True: 0, False: 807k]
  ------------------
  380|      0|      return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  381|   807k|    }
  382|       |
  383|   786k|    switch (code)
  384|   786k|    {
  385|  20.1k|    case PNE_ARRAY8:
  ------------------
  |  |   43|  20.1k|#define PNE_ARRAY8          (0xe0)
  ------------------
  |  Branch (385:5): [True: 20.1k, False: 766k]
  ------------------
  386|  29.3k|    case PNE_ARRAY32:
  ------------------
  |  |   44|  29.3k|#define PNE_ARRAY32         (0xf0)
  ------------------
  |  Branch (386:5): [True: 9.22k, False: 777k]
  ------------------
  387|  29.3k|      {
  388|  29.3k|        uint8_t next = *decoder->position;
  389|  29.3k|        bool described = (next == PNE_DESCRIPTOR);
  ------------------
  |  |    5|  29.3k|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  390|  29.3k|        err = pn_data_put_array(data, described, (pn_type_t) 0);
  391|  29.3k|        if (err) return err;
  ------------------
  |  Branch (391:13): [True: 95, False: 29.2k]
  ------------------
  392|       |
  393|  29.2k|        pn_data_enter(data);
  394|  29.2k|        uint8_t acode;
  395|  29.2k|        int e = pni_decoder_decode_type(decoder, data, &acode);
  396|  29.2k|        if (e) return e;
  ------------------
  |  Branch (396:13): [True: 383, False: 28.8k]
  ------------------
  397|  28.8k|        pn_type_t type = pn_code2type(acode);
  398|  28.8k|        if ((int)type < 0) return (int)type;
  ------------------
  |  Branch (398:13): [True: 429, False: 28.4k]
  ------------------
  399|   327M|        for (size_t i = 0; i < count; i++)
  ------------------
  |  Branch (399:28): [True: 327M, False: 12.4k]
  ------------------
  400|   327M|        {
  401|   327M|          e = pni_decoder_decode_value(decoder, data, acode);
  402|   327M|          if (e) return e;
  ------------------
  |  Branch (402:15): [True: 16.0k, False: 327M]
  ------------------
  403|   327M|        }
  404|  12.4k|        pn_data_exit(data);
  405|       |
  406|  12.4k|        pni_data_set_array_type(data, type);
  407|  12.4k|      }
  408|      0|      return 0;
  409|   510k|    case PNE_LIST8:
  ------------------
  |  |   39|   510k|#define PNE_LIST8           (0xc0)
  ------------------
  |  Branch (409:5): [True: 510k, False: 275k]
  ------------------
  410|   511k|    case PNE_LIST32:
  ------------------
  |  |   40|   511k|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (410:5): [True: 360, False: 786k]
  ------------------
  411|   511k|      err = pn_data_put_list(data);
  412|   511k|      if (err) return err;
  ------------------
  |  Branch (412:11): [True: 503, False: 510k]
  ------------------
  413|   510k|      break;
  414|   510k|    case PNE_MAP8:
  ------------------
  |  |   41|   245k|#define PNE_MAP8            (0xc1)
  ------------------
  |  Branch (414:5): [True: 245k, False: 540k]
  ------------------
  415|   245k|    case PNE_MAP32:
  ------------------
  |  |   42|   245k|#define PNE_MAP32           (0xd1)
  ------------------
  |  Branch (415:5): [True: 314, False: 786k]
  ------------------
  416|   245k|      err = pn_data_put_map(data);
  417|   245k|      if (err) return err;
  ------------------
  |  Branch (417:11): [True: 376, False: 245k]
  ------------------
  418|   245k|      break;
  419|   245k|    default:
  ------------------
  |  Branch (419:5): [True: 0, False: 786k]
  ------------------
  420|      0|      return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  421|   786k|    }
  422|   756k|    pn_data_enter(data);
  423|   837k|    for (size_t i = 0; i < count; i++)
  ------------------
  |  Branch (423:24): [True: 831k, False: 6.19k]
  ------------------
  424|   831k|    {
  425|   831k|      int e = pni_decoder_single(decoder, data);
  426|   831k|      if (e) return e;
  ------------------
  |  Branch (426:11): [True: 749k, False: 81.5k]
  ------------------
  427|   831k|    }
  428|  6.19k|    pn_data_exit(data);
  429|       |
  430|  6.19k|    return 0;
  431|   756k|  }
  432|   408k|  default:
  ------------------
  |  Branch (432:3): [True: 408k, False: 329M]
  ------------------
  433|   408k|    return pn_error_format(pni_decoder_error(decoder), PN_ARG_ERR, "unrecognized typecode: %u", code);
  ------------------
  |  |   52|   408k|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  434|   329M|  }
  435|       |
  436|   327M|  return err;
  437|   329M|}
decoder.c:pn_decoder_readf8:
   49|  1.85M|{
   50|  1.85M|  uint8_t r = decoder->position[0];
   51|  1.85M|  decoder->position++;
   52|  1.85M|  return r;
   53|  1.85M|}
decoder.c:pn_decoder_readf16:
   56|  20.6k|{
   57|  20.6k|  uint16_t a = (uint8_t) decoder->position[0];
   58|  20.6k|  uint16_t b = (uint8_t) decoder->position[1];
   59|  20.6k|  uint16_t r = a << 8
   60|  20.6k|    | b;
   61|  20.6k|  decoder->position += 2;
   62|  20.6k|  return r;
   63|  20.6k|}
decoder.c:pn_decoder_readf32:
   66|  89.2k|{
   67|  89.2k|  uint32_t a = (uint8_t) decoder->position[0];
   68|  89.2k|  uint32_t b = (uint8_t) decoder->position[1];
   69|  89.2k|  uint32_t c = (uint8_t) decoder->position[2];
   70|  89.2k|  uint32_t d = (uint8_t) decoder->position[3];
   71|  89.2k|  uint32_t r = a << 24
   72|  89.2k|    | b << 16
   73|  89.2k|    | c <<  8
   74|  89.2k|    | d;
   75|  89.2k|  decoder->position += 4;
   76|  89.2k|  return r;
   77|  89.2k|}
decoder.c:pn_decoder_readf64:
   80|  21.3k|{
   81|  21.3k|  uint64_t a = pn_decoder_readf32(decoder);
   82|  21.3k|  uint64_t b = pn_decoder_readf32(decoder);
   83|  21.3k|  return a << 32 | b;
   84|  21.3k|}
decoder.c:pn_decoder_readf128:
   87|  4.33k|{
   88|  4.33k|  memmove(dst, decoder->position, 16);
   89|  4.33k|  decoder->position += 16;
   90|  4.33k|}
decoder.c:pn_code2type:
  106|  28.8k|{
  107|  28.8k|  switch (code)
  108|  28.8k|  {
  109|      0|  case PNE_DESCRIPTOR:
  ------------------
  |  |    5|      0|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  |  Branch (109:3): [True: 0, False: 28.8k]
  ------------------
  110|      0|    return (pn_type_t) PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  111|    848|  case PNE_NULL:
  ------------------
  |  |    6|    848|#define PNE_NULL            (0x40)
  ------------------
  |  Branch (111:3): [True: 848, False: 28.0k]
  ------------------
  112|    848|    return PN_NULL;
  113|  2.17k|  case PNE_TRUE:
  ------------------
  |  |    8|  2.17k|#define PNE_TRUE            (0x41)
  ------------------
  |  Branch (113:3): [True: 2.17k, False: 26.7k]
  ------------------
  114|  2.88k|  case PNE_FALSE:
  ------------------
  |  |    9|  2.88k|#define PNE_FALSE           (0x42)
  ------------------
  |  Branch (114:3): [True: 713, False: 28.1k]
  ------------------
  115|  4.89k|  case PNE_BOOLEAN:
  ------------------
  |  |    7|  4.89k|#define PNE_BOOLEAN         (0x56)
  ------------------
  |  Branch (115:3): [True: 2.01k, False: 26.8k]
  ------------------
  116|  4.89k|    return PN_BOOL;
  117|    663|  case PNE_UBYTE:
  ------------------
  |  |   10|    663|#define PNE_UBYTE           (0x50)
  ------------------
  |  Branch (117:3): [True: 663, False: 28.2k]
  ------------------
  118|    663|    return PN_UBYTE;
  119|    418|  case PNE_BYTE:
  ------------------
  |  |   18|    418|#define PNE_BYTE            (0x51)
  ------------------
  |  Branch (119:3): [True: 418, False: 28.4k]
  ------------------
  120|    418|    return PN_BYTE;
  121|    546|  case PNE_USHORT:
  ------------------
  |  |   11|    546|#define PNE_USHORT          (0x60)
  ------------------
  |  Branch (121:3): [True: 546, False: 28.3k]
  ------------------
  122|    546|    return PN_USHORT;
  123|    356|  case PNE_SHORT:
  ------------------
  |  |   19|    356|#define PNE_SHORT           (0x61)
  ------------------
  |  Branch (123:3): [True: 356, False: 28.5k]
  ------------------
  124|    356|    return PN_SHORT;
  125|  3.10k|  case PNE_UINT0:
  ------------------
  |  |   14|  3.10k|#define PNE_UINT0           (0x43)
  ------------------
  |  Branch (125:3): [True: 3.10k, False: 25.7k]
  ------------------
  126|  3.31k|  case PNE_SMALLUINT:
  ------------------
  |  |   13|  3.31k|#define PNE_SMALLUINT       (0x52)
  ------------------
  |  Branch (126:3): [True: 206, False: 28.6k]
  ------------------
  127|  3.78k|  case PNE_UINT:
  ------------------
  |  |   12|  3.78k|#define PNE_UINT            (0x70)
  ------------------
  |  Branch (127:3): [True: 471, False: 28.4k]
  ------------------
  128|  3.78k|    return PN_UINT;
  129|    324|  case PNE_SMALLINT:
  ------------------
  |  |   21|    324|#define PNE_SMALLINT        (0x54)
  ------------------
  |  Branch (129:3): [True: 324, False: 28.5k]
  ------------------
  130|    602|  case PNE_INT:
  ------------------
  |  |   20|    602|#define PNE_INT             (0x71)
  ------------------
  |  Branch (130:3): [True: 278, False: 28.6k]
  ------------------
  131|    602|    return PN_INT;
  132|    278|  case PNE_UTF32:
  ------------------
  |  |   29|    278|#define PNE_UTF32           (0x73)
  ------------------
  |  Branch (132:3): [True: 278, False: 28.6k]
  ------------------
  133|    278|    return PN_CHAR;
  134|    359|  case PNE_FLOAT:
  ------------------
  |  |   24|    359|#define PNE_FLOAT           (0x72)
  ------------------
  |  Branch (134:3): [True: 359, False: 28.5k]
  ------------------
  135|    359|    return PN_FLOAT;
  136|    233|  case PNE_LONG:
  ------------------
  |  |   22|    233|#define PNE_LONG            (0x81)
  ------------------
  |  Branch (136:3): [True: 233, False: 28.6k]
  ------------------
  137|    671|  case PNE_SMALLLONG:
  ------------------
  |  |   23|    671|#define PNE_SMALLLONG       (0x55)
  ------------------
  |  Branch (137:3): [True: 438, False: 28.4k]
  ------------------
  138|    671|    return PN_LONG;
  139|    330|  case PNE_MS64:
  ------------------
  |  |   30|    330|#define PNE_MS64            (0x83)
  ------------------
  |  Branch (139:3): [True: 330, False: 28.5k]
  ------------------
  140|    330|    return PN_TIMESTAMP;
  141|    346|  case PNE_DOUBLE:
  ------------------
  |  |   25|    346|#define PNE_DOUBLE          (0x82)
  ------------------
  |  Branch (141:3): [True: 346, False: 28.5k]
  ------------------
  142|    346|    return PN_DOUBLE;
  143|    282|  case PNE_DECIMAL32:
  ------------------
  |  |   26|    282|#define PNE_DECIMAL32       (0x74)
  ------------------
  |  Branch (143:3): [True: 282, False: 28.6k]
  ------------------
  144|    282|    return PN_DECIMAL32;
  145|    471|  case PNE_DECIMAL64:
  ------------------
  |  |   27|    471|#define PNE_DECIMAL64       (0x84)
  ------------------
  |  Branch (145:3): [True: 471, False: 28.4k]
  ------------------
  146|    471|    return PN_DECIMAL64;
  147|    504|  case PNE_DECIMAL128:
  ------------------
  |  |   28|    504|#define PNE_DECIMAL128      (0x94)
  ------------------
  |  Branch (147:3): [True: 504, False: 28.3k]
  ------------------
  148|    504|    return PN_DECIMAL128;
  149|    324|  case PNE_UUID:
  ------------------
  |  |   31|    324|#define PNE_UUID            (0x98)
  ------------------
  |  Branch (149:3): [True: 324, False: 28.5k]
  ------------------
  150|    324|    return PN_UUID;
  151|    796|  case PNE_ULONG0:
  ------------------
  |  |   17|    796|#define PNE_ULONG0          (0x44)
  ------------------
  |  Branch (151:3): [True: 796, False: 28.0k]
  ------------------
  152|  1.37k|  case PNE_SMALLULONG:
  ------------------
  |  |   16|  1.37k|#define PNE_SMALLULONG      (0x53)
  ------------------
  |  Branch (152:3): [True: 574, False: 28.3k]
  ------------------
  153|  1.59k|  case PNE_ULONG:
  ------------------
  |  |   15|  1.59k|#define PNE_ULONG           (0x80)
  ------------------
  |  Branch (153:3): [True: 229, False: 28.6k]
  ------------------
  154|  1.59k|    return PN_ULONG;
  155|    592|  case PNE_VBIN8:
  ------------------
  |  |   32|    592|#define PNE_VBIN8           (0xa0)
  ------------------
  |  Branch (155:3): [True: 592, False: 28.3k]
  ------------------
  156|    863|  case PNE_VBIN32:
  ------------------
  |  |   33|    863|#define PNE_VBIN32          (0xb0)
  ------------------
  |  Branch (156:3): [True: 271, False: 28.6k]
  ------------------
  157|    863|    return PN_BINARY;
  158|    700|  case PNE_STR8_UTF8:
  ------------------
  |  |   34|    700|#define PNE_STR8_UTF8       (0xa1)
  ------------------
  |  Branch (158:3): [True: 700, False: 28.1k]
  ------------------
  159|    985|  case PNE_STR32_UTF8:
  ------------------
  |  |   35|    985|#define PNE_STR32_UTF8      (0xb1)
  ------------------
  |  Branch (159:3): [True: 285, False: 28.6k]
  ------------------
  160|    985|    return PN_STRING;
  161|    540|  case PNE_SYM8:
  ------------------
  |  |   36|    540|#define PNE_SYM8            (0xa3)
  ------------------
  |  Branch (161:3): [True: 540, False: 28.3k]
  ------------------
  162|    782|  case PNE_SYM32:
  ------------------
  |  |   37|    782|#define PNE_SYM32           (0xb3)
  ------------------
  |  Branch (162:3): [True: 242, False: 28.6k]
  ------------------
  163|    782|    return PN_SYMBOL;
  164|  1.50k|  case PNE_LIST0:
  ------------------
  |  |   38|  1.50k|#define PNE_LIST0           (0x45)
  ------------------
  |  Branch (164:3): [True: 1.50k, False: 27.3k]
  ------------------
  165|  2.89k|  case PNE_LIST8:
  ------------------
  |  |   39|  2.89k|#define PNE_LIST8           (0xc0)
  ------------------
  |  Branch (165:3): [True: 1.39k, False: 27.5k]
  ------------------
  166|  3.28k|  case PNE_LIST32:
  ------------------
  |  |   40|  3.28k|#define PNE_LIST32          (0xd0)
  ------------------
  |  Branch (166:3): [True: 389, False: 28.5k]
  ------------------
  167|  3.28k|    return PN_LIST;
  168|  3.58k|  case PNE_ARRAY8:
  ------------------
  |  |   43|  3.58k|#define PNE_ARRAY8          (0xe0)
  ------------------
  |  Branch (168:3): [True: 3.58k, False: 25.3k]
  ------------------
  169|  3.92k|  case PNE_ARRAY32:
  ------------------
  |  |   44|  3.92k|#define PNE_ARRAY32         (0xf0)
  ------------------
  |  Branch (169:3): [True: 337, False: 28.5k]
  ------------------
  170|  3.92k|    return PN_ARRAY;
  171|  1.15k|  case PNE_MAP8:
  ------------------
  |  |   41|  1.15k|#define PNE_MAP8            (0xc1)
  ------------------
  |  Branch (171:3): [True: 1.15k, False: 27.7k]
  ------------------
  172|  1.35k|  case PNE_MAP32:
  ------------------
  |  |   42|  1.35k|#define PNE_MAP32           (0xd1)
  ------------------
  |  Branch (172:3): [True: 195, False: 28.7k]
  ------------------
  173|  1.35k|    return PN_MAP;
  174|    429|  default:
  ------------------
  |  Branch (174:3): [True: 429, False: 28.4k]
  ------------------
  175|    429|    return (pn_type_t) PN_ARG_ERR;
  ------------------
  |  |   52|    429|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  176|  28.8k|  }
  177|  28.8k|}
decoder.c:pni_decoder_error:
   30|   408k|{
   31|   408k|  if (!decoder->error) decoder->error = pn_error();
  ------------------
  |  Branch (31:7): [True: 408k, False: 0]
  ------------------
   32|   408k|  return decoder->error;
   33|   408k|}

pni_bad_frame:
   32|    207|int pni_bad_frame(pn_transport_t *transport, uint8_t frame_type, uint16_t channel, pn_bytes_t payload) {
   33|    207|  PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "Error dispatching frame: type: %d: Unknown performative", frame_type);
  ------------------
  |  |   54|    207|    do { \
  |  |   55|    207|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   51|    207|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  |  |  Branch (51:38): [True: 207, False: 0]
  |  |  |  |  |  Branch (51:73): [True: 0, False: 207]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|    207|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   57|    207|    } while(0)
  |  |  ------------------
  |  |  |  Branch (57:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
   34|    207|  return PN_ERR;
  ------------------
  |  |   48|    207|#define PN_ERR (-2)            /**< General error */
  ------------------
   35|    207|}
pni_bad_frame_type:
   37|     15|int pni_bad_frame_type(pn_transport_t *transport, uint8_t frame_type, uint16_t channel, pn_bytes_t payload) {
   38|     15|  PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "Error dispatching frame: Unknown frame type: %d", frame_type);
  ------------------
  |  |   54|     15|    do { \
  |  |   55|     15|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   51|     15|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  |  |  Branch (51:38): [True: 15, False: 0]
  |  |  |  |  |  Branch (51:73): [True: 0, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|     15|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   57|     15|    } while(0)
  |  |  ------------------
  |  |  |  Branch (57:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
   39|     15|  return PN_ERR;
  ------------------
  |  |   48|     15|#define PN_ERR (-2)            /**< General error */
  ------------------
   40|     15|}
pn_dispatcher_input:
  106|  73.8k|{
  107|  73.8k|  size_t read = 0;
  108|       |
  109|  3.38M|  while (available && !*halt) {
  ------------------
  |  Branch (109:10): [True: 3.37M, False: 12.7k]
  |  Branch (109:23): [True: 3.37M, False: 0]
  ------------------
  110|  3.37M|    pn_frame_t frame;
  111|       |
  112|  3.37M|    ssize_t n = pn_read_frame(&frame, bytes + read, available, transport->local_max_frame, &transport->logger);
  113|  3.37M|    if (n > 0) {
  ------------------
  |  Branch (113:9): [True: 3.32M, False: 55.1k]
  ------------------
  114|  3.32M|      read += n;
  115|  3.32M|      available -= n;
  116|  3.32M|      transport->input_frames_ct += 1;
  117|  3.32M|      int e = pni_dispatch_frame(frame, &transport->logger, transport);
  118|  3.32M|      if (e) return e;
  ------------------
  |  Branch (118:11): [True: 5.87k, False: 3.31M]
  ------------------
  119|  3.32M|    } else if (n < 0) {
  ------------------
  |  Branch (119:16): [True: 4.01k, False: 51.1k]
  ------------------
  120|  4.01k|      pn_do_error(transport, "amqp:connection:framing-error", "malformed frame");
  121|  4.01k|      return n;
  122|  51.1k|    } else {
  123|  51.1k|      break;
  124|  51.1k|    }
  125|       |
  126|  3.31M|    if (!batch) break;
  ------------------
  |  Branch (126:9): [True: 0, False: 3.31M]
  ------------------
  127|  3.31M|  }
  128|       |
  129|  63.9k|  return read;
  130|  73.8k|}
pn_dispatcher_output:
  133|   277k|{
  134|   277k|    int n = pn_buffer_get(transport->output_buffer, 0, size, bytes);
  135|   277k|    pn_buffer_trim(transport->output_buffer, n, 0);
  136|       |    // XXX: need to check for errors
  137|   277k|    return n;
  138|   277k|}
dispatcher.c:pni_dispatch_frame:
   80|  3.32M|{
   81|  3.32M|  pn_bytes_t frame_payload = frame.frame_payload0;
   82|       |
   83|  3.32M|  if (frame_payload.size == 0) { // ignore null frames
  ------------------
  |  Branch (83:7): [True: 1.65k, False: 3.31M]
  ------------------
   84|  1.65k|    return 0;
   85|  1.65k|  }
   86|       |
   87|  3.31M|  uint64_t lcode;
   88|  3.31M|  pni_consumer_t consumer = make_consumer_from_bytes(frame_payload);
   89|  3.31M|  pni_consumer_t subconsumer;
   90|  3.31M|  if (!consume_described_ulong_descriptor(&consumer, &subconsumer, &lcode)
  ------------------
  |  Branch (90:7): [True: 1.55k, False: 3.31M]
  ------------------
   91|  3.31M|      || !pni_islist(&subconsumer)
  ------------------
  |  Branch (91:10): [True: 93, False: 3.31M]
  ------------------
   92|  3.31M|  ) {
   93|  1.64k|    PN_LOG(logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "Error dispatching frame");
  ------------------
  |  |   54|  1.64k|    do { \
  |  |   55|  1.64k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   51|  1.64k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  |  |  Branch (51:38): [True: 1.64k, False: 0]
  |  |  |  |  |  Branch (51:73): [True: 0, False: 1.64k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|  1.64k|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   57|  1.64k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (57:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
   94|  1.64k|    return PN_ERR;
  ------------------
  |  |   48|  1.64k|#define PN_ERR (-2)            /**< General error */
  ------------------
   95|  1.64k|  }
   96|       |
   97|  3.31M|  uint8_t frame_type = frame.type;
   98|  3.31M|  uint16_t channel = frame.channel;
   99|       |
  100|  3.31M|  int err = pni_dispatch_action(transport, lcode, frame_type, channel, frame_payload);
  101|       |
  102|  3.31M|  return err;
  103|  3.31M|}
dispatcher.c:pni_dispatch_action:
   45|  3.31M|{
   46|  3.31M|  pn_action_t *action;
   47|  3.31M|  switch (frame_type) {
   48|  3.31M|  case AMQP_FRAME_TYPE:
  ------------------
  |  |   37|  3.31M|#define AMQP_FRAME_TYPE (0)
  ------------------
  |  Branch (48:3): [True: 3.31M, False: 118]
  ------------------
   49|       |    /* Regular AMQP frames */
   50|  3.31M|    switch (lcode) {
   51|   156k|    case OPEN:            action = pn_do_open; break;
  ------------------
  |  |  141|   156k|#define OPEN ((uint64_t) 16)
  ------------------
  |  Branch (51:5): [True: 156k, False: 3.16M]
  ------------------
   52|   686k|    case BEGIN:           action = pn_do_begin; break;
  ------------------
  |  |  143|   686k|#define BEGIN ((uint64_t) 17)
  ------------------
  |  Branch (52:5): [True: 686k, False: 2.63M]
  ------------------
   53|  1.23M|    case ATTACH:          action = pn_do_attach; break;
  ------------------
  |  |  145|  1.23M|#define ATTACH ((uint64_t) 18)
  ------------------
  |  Branch (53:5): [True: 1.23M, False: 2.08M]
  ------------------
   54|  49.1k|    case FLOW:            action = pn_do_flow; break;
  ------------------
  |  |  147|  49.1k|#define FLOW ((uint64_t) 19)
  ------------------
  |  Branch (54:5): [True: 49.1k, False: 3.26M]
  ------------------
   55|  1.07M|    case TRANSFER:        action = pn_do_transfer; break;
  ------------------
  |  |  149|  1.07M|#define TRANSFER ((uint64_t) 20)
  ------------------
  |  Branch (55:5): [True: 1.07M, False: 2.24M]
  ------------------
   56|  69.2k|    case DISPOSITION:     action = pn_do_disposition; break;
  ------------------
  |  |  151|  69.2k|#define DISPOSITION ((uint64_t) 21)
  ------------------
  |  Branch (56:5): [True: 69.2k, False: 3.24M]
  ------------------
   57|  44.0k|    case DETACH:          action = pn_do_detach; break;
  ------------------
  |  |  153|  44.0k|#define DETACH ((uint64_t) 22)
  ------------------
  |  Branch (57:5): [True: 44.0k, False: 3.27M]
  ------------------
   58|  3.41k|    case END:             action = pn_do_end; break;
  ------------------
  |  |  155|  3.41k|#define END ((uint64_t) 23)
  ------------------
  |  Branch (58:5): [True: 3.41k, False: 3.31M]
  ------------------
   59|  1.61k|    case CLOSE:           action = pn_do_close; break;
  ------------------
  |  |  157|  1.61k|#define CLOSE ((uint64_t) 24)
  ------------------
  |  Branch (59:5): [True: 1.61k, False: 3.31M]
  ------------------
   60|    109|    default:              action = pni_bad_frame; break;
  ------------------
  |  Branch (60:5): [True: 109, False: 3.31M]
  ------------------
   61|  3.31M|    };
   62|  3.31M|    break;
   63|    103|  case SASL_FRAME_TYPE:
  ------------------
  |  |   38|    103|#define SASL_FRAME_TYPE (1)
  ------------------
  |  Branch (63:3): [True: 103, False: 3.31M]
  ------------------
   64|       |    /* SASL frames */
   65|    103|    switch (lcode) {
   66|      1|    case SASL_MECHANISMS: action = pn_do_mechanisms; break;
  ------------------
  |  |  197|      1|#define SASL_MECHANISMS ((uint64_t) 64)
  ------------------
  |  Branch (66:5): [True: 1, False: 102]
  ------------------
   67|      1|    case SASL_INIT:       action = pn_do_init; break;
  ------------------
  |  |  199|      1|#define SASL_INIT ((uint64_t) 65)
  ------------------
  |  Branch (67:5): [True: 1, False: 102]
  ------------------
   68|      1|    case SASL_CHALLENGE:  action = pn_do_challenge; break;
  ------------------
  |  |  201|      1|#define SASL_CHALLENGE ((uint64_t) 66)
  ------------------
  |  Branch (68:5): [True: 1, False: 102]
  ------------------
   69|      1|    case SASL_RESPONSE:   action = pn_do_response; break;
  ------------------
  |  |  203|      1|#define SASL_RESPONSE ((uint64_t) 67)
  ------------------
  |  Branch (69:5): [True: 1, False: 102]
  ------------------
   70|      1|    case SASL_OUTCOME:    action = pn_do_outcome; break;
  ------------------
  |  |  205|      1|#define SASL_OUTCOME ((uint64_t) 68)
  ------------------
  |  Branch (70:5): [True: 1, False: 102]
  ------------------
   71|     98|    default:              action = pni_bad_frame; break;
  ------------------
  |  Branch (71:5): [True: 98, False: 5]
  ------------------
   72|    103|    };
   73|    103|    break;
   74|     15|  default:              action = pni_bad_frame_type; break;
  ------------------
  |  Branch (74:3): [True: 15, False: 3.31M]
  ------------------
   75|  3.31M|  };
   76|  3.31M|  return action(transport, frame_type, channel, frame_payload);
   77|  3.31M|}

frame_generators.c:make_compound:
   47|   451k|static inline pni_compound_context make_compound(void) {
   48|   451k|  return (pni_compound_context){
   49|   451k|    .count = 0
   50|   451k|  };
   51|   451k|}
frame_generators.c:resize_required:
   80|   451k|static inline bool resize_required(pni_emitter_t* emitter) {
   81|   451k|  return emitter->position > emitter->size;
   82|   451k|}
frame_generators.c:make_emitter_from_buffer:
   59|   451k|static inline pni_emitter_t make_emitter_from_buffer(pn_buffer_t* buffer) {
   60|   451k|  pn_rwbytes_t output_bytes = pn_buffer_free_memory(buffer);
   61|   451k|  return (pni_emitter_t){
   62|   451k|    .output_start = output_bytes.start,
   63|   451k|    .size = output_bytes.size,
   64|   451k|    .position = 0
   65|   451k|  };
   66|   451k|}
frame_generators.c:size_buffer_to_emitter:
   84|     29|static inline void size_buffer_to_emitter(pn_buffer_t* buffer, pni_emitter_t* emitter) {
   85|     29|  pn_buffer_ensure(buffer, pn_buffer_capacity(buffer)+(emitter->position-emitter->size));
   86|     29|}
frame_generators.c:make_bytes_from_emitter:
   76|   451k|static inline pn_bytes_t make_bytes_from_emitter(pni_emitter_t emitter) {
   77|   451k|    return (pn_bytes_t){.size = emitter.position, .start = emitter.output_start};
   78|   451k|}
frame_generators.c:emit_descriptor:
  246|   841k|static inline void emit_descriptor(pni_emitter_t* emitter, pni_compound_context* compound, uint64_t ulong) {
  247|   841k|  emit_accumulated_nulls(emitter, compound);
  248|   841k|  pni_emitter_writef8(emitter, PNE_DESCRIPTOR);
  ------------------
  |  |    5|   841k|#define PNE_DESCRIPTOR          (0x00)
  ------------------
  249|   841k|  if (ulong < 256) {
  ------------------
  |  Branch (249:7): [True: 841k, False: 0]
  ------------------
  250|   841k|    pni_emitter_writef8(emitter, PNE_SMALLULONG);
  ------------------
  |  |   16|   841k|#define PNE_SMALLULONG      (0x53)
  ------------------
  251|   841k|    pni_emitter_writef8(emitter, ulong);
  252|   841k|  } else {
  253|      0|    pni_emitter_writef8(emitter, PNE_ULONG);
  ------------------
  |  |   15|      0|#define PNE_ULONG           (0x80)
  ------------------
  254|      0|    pni_emitter_writef64(emitter, ulong);
  255|      0|  }
  256|   841k|}
frame_generators.c:emit_accumulated_nulls:
  172|  3.53M|static inline void emit_accumulated_nulls(pni_emitter_t* emitter, pni_compound_context* compound) {
  173|  4.08M|  for (uint32_t i=compound->null_count; i>0; --i) {
  ------------------
  |  Branch (173:41): [True: 549k, False: 3.53M]
  ------------------
  174|   549k|    pni_emitter_writef8(emitter, PNE_NULL);
  ------------------
  |  |    6|   549k|#define PNE_NULL            (0x40)
  ------------------
  175|   549k|    compound->count++;
  176|   549k|  }
  177|  3.53M|  compound->null_count = 0;
  178|  3.53M|}
frame_generators.c:pni_emitter_writef8:
   97|  9.05M|{
   98|  9.05M|  if (pni_emitter_remaining(emitter, 1)) {
  ------------------
  |  Branch (98:7): [True: 9.05M, False: 0]
  ------------------
   99|  9.05M|    emitter->output_start[emitter->position+0] = value;
  100|  9.05M|  }
  101|  9.05M|  emitter->position++;
  102|  9.05M|}
frame_generators.c:pni_emitter_remaining:
   92|  9.71M|static inline bool pni_emitter_remaining(pni_emitter_t* e, size_t need) {
   93|  9.71M|  return (e->size >= e->position+need);
   94|  9.71M|}
frame_generators.c:emit_list:
  258|   841k|static inline pni_compound_context emit_list(pni_emitter_t* emitter, pni_compound_context* compound, bool small_encoding, bool is_described_list) {
  259|   841k|  emit_accumulated_nulls(emitter, compound);
  260|   841k|  if (small_encoding) {
  ------------------
  |  Branch (260:7): [True: 841k, False: 221]
  ------------------
  261|   841k|    pni_emitter_writef8(emitter, PNE_LIST8);
  ------------------
  |  |   39|   841k|#define PNE_LIST8           (0xc0)
  ------------------
  262|       |    // Need to fill in size and count later
  263|   841k|    size_t size_position = emitter->position;
  264|   841k|    pni_emitter_writef8(emitter, 0);
  265|   841k|    size_t start_position = emitter->position;
  266|   841k|    pni_emitter_writef8(emitter, 0);
  267|   841k|    return (pni_compound_context){
  268|   841k|      .previous_compound = compound,
  269|   841k|      .size_position = size_position,
  270|   841k|      .start_position = start_position,
  271|   841k|      .count = 0,
  272|   841k|      .null_count = 0,
  273|   841k|      .is_described_list = is_described_list,
  274|   841k|    };
  275|   841k|  } else {
  276|    221|    pni_emitter_writef8(emitter, PNE_LIST32);
  ------------------
  |  |   40|    221|#define PNE_LIST32          (0xd0)
  ------------------
  277|       |    // Need to fill in size and count later
  278|    221|    size_t size_position = emitter->position;
  279|    221|    pni_emitter_writef32(emitter, 0);
  280|    221|    size_t start_position = emitter->position;
  281|    221|    pni_emitter_writef32(emitter, 0);
  282|    221|    return (pni_compound_context){
  283|    221|      .previous_compound = compound,
  284|    221|      .size_position = size_position,
  285|    221|      .start_position = start_position,
  286|    221|      .count = 0,
  287|    221|      .null_count = 0,
  288|    221|      .is_described_list = is_described_list,
  289|    221|    };
  290|    221|  }
  291|   841k|}
frame_generators.c:pni_emitter_writef32:
  114|   527k|{
  115|   527k|  if (pni_emitter_remaining(emitter, 4)) {
  ------------------
  |  Branch (115:7): [True: 527k, False: 0]
  ------------------
  116|   527k|    emitter->output_start[emitter->position+0] = 0xFF & (value >> 24);
  117|   527k|    emitter->output_start[emitter->position+1] = 0xFF & (value >> 16);
  118|   527k|    emitter->output_start[emitter->position+2] = 0xFF & (value >>  8);
  119|   527k|    emitter->output_start[emitter->position+3] = 0xFF & (value      );
  120|   527k|  }
  121|   527k|  emitter->position += 4;
  122|   527k|}
frame_generators.c:emit_symbol:
  416|  82.4k|static inline void emit_symbol(pni_emitter_t* emitter, pni_compound_context* compound, const char* symbol) {
  417|       |  // FIXME: Yuck we need to use strlen to find the end of the string - would be better to take pn_bytes_t
  418|  82.4k|  if (symbol == NULL) {
  ------------------
  |  Branch (418:7): [True: 61.3k, False: 21.0k]
  ------------------
  419|  61.3k|    emit_null(emitter, compound);
  420|  61.3k|  } else {
  421|  21.0k|    size_t size = strlen(symbol);
  422|  21.0k|    emit_symbol_bytes(emitter, compound, (pn_bytes_t){.size = size, .start = symbol});
  423|  21.0k|  }
  424|  82.4k|}
frame_generators.c:emit_symbol_bytes:
  404|  21.0k|static inline void emit_symbol_bytes(pni_emitter_t* emitter, pni_compound_context* compound, pn_bytes_t bytes) {
  405|  21.0k|  emit_accumulated_nulls(emitter, compound);
  406|  21.0k|  if (bytes.size < 256) {
  ------------------
  |  Branch (406:7): [True: 21.0k, False: 0]
  ------------------
  407|  21.0k|    pni_emitter_writef8(emitter, PNE_SYM8);
  ------------------
  |  |   36|  21.0k|#define PNE_SYM8            (0xa3)
  ------------------
  408|  21.0k|    pni_emitter_writev8(emitter, bytes);
  409|  21.0k|  } else {
  410|      0|    pni_emitter_writef8(emitter, PNE_SYM32);
  ------------------
  |  |   37|      0|#define PNE_SYM32           (0xb3)
  ------------------
  411|      0|    pni_emitter_writev32(emitter, bytes);
  412|      0|  }
  413|  21.0k|  compound->count++;
  414|  21.0k|}
frame_generators.c:pni_emitter_writev8:
  146|   103k|{
  147|   103k|  pni_emitter_writef8(emitter, value.size);
  148|   103k|  if (pni_emitter_remaining(emitter, value.size))
  ------------------
  |  Branch (148:7): [True: 103k, False: 0]
  ------------------
  149|   103k|    memcpy(emitter->output_start+emitter->position, value.start, value.size);
  150|   103k|  emitter->position += value.size;
  151|   103k|}
frame_generators.c:pni_emitter_writev32:
  154|    268|{
  155|    268|  pni_emitter_writef32(emitter, value.size);
  156|    268|  if (pni_emitter_remaining(emitter, value.size))
  ------------------
  |  Branch (156:7): [True: 156, False: 112]
  ------------------
  157|    156|    memcpy(emitter->output_start+emitter->position, value.start, value.size);
  158|    268|  emitter->position += value.size;
  159|    268|}
frame_generators.c:emit_string:
  426|   174k|static inline void emit_string(pni_emitter_t* emitter, pni_compound_context* compound, const char* string) {
  427|       |  // FIXME: Yuck we need to use strlen to find the end of the string - would be better to take pn_bytes_t
  428|   174k|  if (string == NULL) {
  ------------------
  |  Branch (428:7): [True: 92.0k, False: 82.4k]
  ------------------
  429|  92.0k|    emit_null(emitter, compound);
  430|  92.0k|  } else {
  431|  82.4k|    size_t size = strlen(string);
  432|  82.4k|    emit_string_bytes(emitter, compound, (pn_bytes_t){.size = size, .start = string});
  433|  82.4k|  }
  434|   174k|}
frame_generators.c:emit_string_bytes:
  392|  82.4k|static inline void emit_string_bytes(pni_emitter_t* emitter, pni_compound_context* compound, pn_bytes_t bytes) {
  393|  82.4k|  emit_accumulated_nulls(emitter, compound);
  394|  82.4k|  if (bytes.size < 256) {
  ------------------
  |  Branch (394:7): [True: 82.1k, False: 268]
  ------------------
  395|  82.1k|    pni_emitter_writef8(emitter, PNE_STR8_UTF8);
  ------------------
  |  |   34|  82.1k|#define PNE_STR8_UTF8       (0xa1)
  ------------------
  396|  82.1k|    pni_emitter_writev8(emitter, bytes);
  397|  82.1k|  } else {
  398|    268|    pni_emitter_writef8(emitter, PNE_STR32_UTF8);
  ------------------
  |  |   35|    268|#define PNE_STR32_UTF8      (0xb1)
  ------------------
  399|    268|    pni_emitter_writev32(emitter, bytes);
  400|    268|  }
  401|  82.4k|  compound->count++;
  402|  82.4k|}
frame_generators.c:emit_copy:
  532|   174k|static inline void emit_copy(pni_emitter_t* emitter, pni_compound_context* compound, pn_data_t* data) {
  533|   174k|  if (!data || pn_data_size(data) == 0) {
  ------------------
  |  Branch (533:7): [True: 30.6k, False: 143k]
  |  Branch (533:16): [True: 143k, False: 0]
  ------------------
  534|   174k|    emit_null(emitter, compound);
  535|   174k|    return;
  536|   174k|  }
  537|       |
  538|      0|  emit_accumulated_nulls(emitter, compound);
  539|      0|  pn_handle_t point = pn_data_point(data);
  540|      0|  pn_data_rewind(data);
  541|      0|  pni_emitter_data(emitter, data);
  542|      0|  pn_data_restore(data, point);
  543|      0|  compound->count++;
  544|      0|}
frame_generators.c:emit_end_list:
  293|   841k|static inline void emit_end_list(pni_emitter_t* emitter, pni_compound_context* compound, bool small_encoding) {
  294|       |  // Check if list was 0 length
  295|   841k|  if (compound->count==0) {
  ------------------
  |  Branch (295:7): [True: 307k, False: 533k]
  ------------------
  296|   307k|    emitter->position = compound->size_position - 1;
  297|   307k|    pni_emitter_writef8(emitter, PNE_LIST0);
  ------------------
  |  |   38|   307k|#define PNE_LIST0           (0x45)
  ------------------
  298|   307k|    compound->previous_compound->count++;
  299|   307k|    compound->encoding_succeeded = true;
  300|   307k|    return;
  301|   307k|  }
  302|       |  // Fill in size and count
  303|   533k|  size_t current = emitter->position;
  304|   533k|  emitter->position = compound->size_position;
  305|   533k|  size_t size = current-compound->start_position;
  306|   533k|  if (small_encoding) {
  ------------------
  |  Branch (306:7): [True: 533k, False: 221]
  ------------------
  307|   533k|    if (size>255 || compound->count>255) {
  ------------------
  |  Branch (307:9): [True: 221, False: 533k]
  |  Branch (307:21): [True: 0, False: 533k]
  ------------------
  308|    221|      compound->encoding_succeeded = false;
  309|    221|      emitter->position -= 1;
  310|    221|      return;
  311|    221|    }
  312|   533k|    pni_emitter_writef8(emitter, size);
  313|   533k|    pni_emitter_writef8(emitter, compound->count);
  314|   533k|  } else {
  315|    221|    pni_emitter_writef32(emitter, size);
  316|    221|    pni_emitter_writef32(emitter, compound->count);
  317|    221|  }
  318|   533k|  emitter->position = current;
  319|   533k|  compound->previous_compound->count++;
  320|   533k|  compound->encoding_succeeded = true;
  321|   533k|}
frame_generators.c:encode_succeeded:
   88|   841k|static inline bool encode_succeeded(pni_emitter_t* emitter, pni_compound_context* compound) {
   89|   841k|  return compound->encoding_succeeded;
   90|   841k|}
frame_generators.c:emit_null:
  163|  1.09M|static inline void emit_null(pni_emitter_t* emitter, pni_compound_context* compound) {
  164|  1.09M|  if (compound->is_described_list) {
  ------------------
  |  Branch (164:7): [True: 1.09M, False: 0]
  ------------------
  165|  1.09M|    compound->null_count++;
  166|  1.09M|    return;
  167|  1.09M|  }
  168|      0|  pni_emitter_writef8(emitter, PNE_NULL);
  ------------------
  |  |    6|      0|#define PNE_NULL            (0x40)
  ------------------
  169|      0|  compound->count++;
  170|      0|}
frame_generators.c:emit_ushort:
  197|  30.6k|static inline void emit_ushort(pni_emitter_t* emitter, pni_compound_context* compound, uint16_t ushort) {
  198|  30.6k|  emit_accumulated_nulls(emitter, compound);
  199|  30.6k|  pni_emitter_writef8(emitter, PNE_USHORT);
  ------------------
  |  |   11|  30.6k|#define PNE_USHORT          (0x60)
  ------------------
  200|  30.6k|  pni_emitter_writef16(emitter, ushort);
  201|  30.6k|  compound->count++;
  202|  30.6k|}
frame_generators.c:pni_emitter_writef16:
  105|  30.6k|{
  106|  30.6k|  if (pni_emitter_remaining(emitter, 2)) {
  ------------------
  |  Branch (106:7): [True: 30.6k, False: 0]
  ------------------
  107|  30.6k|    emitter->output_start[emitter->position+0] = 0xFF & (value >> 8);
  108|  30.6k|    emitter->output_start[emitter->position+1] = 0xFF & (value     );
  109|  30.6k|  }
  110|  30.6k|  emitter->position += 2;
  111|  30.6k|}
frame_generators.c:emit_uint:
  204|   893k|static inline void emit_uint(pni_emitter_t* emitter, pni_compound_context* compound, uint32_t uint) {
  205|   893k|  emit_accumulated_nulls(emitter, compound);
  206|   893k|  if (uint == 0) {
  ------------------
  |  Branch (206:7): [True: 308k, False: 584k]
  ------------------
  207|   308k|    pni_emitter_writef8(emitter, PNE_UINT0);
  ------------------
  |  |   14|   308k|#define PNE_UINT0           (0x43)
  ------------------
  208|   584k|  } else if (uint < 256) {
  ------------------
  |  Branch (208:14): [True: 58.5k, False: 526k]
  ------------------
  209|  58.5k|    pni_emitter_writef8(emitter, PNE_SMALLUINT);
  ------------------
  |  |   13|  58.5k|#define PNE_SMALLUINT       (0x52)
  ------------------
  210|  58.5k|    pni_emitter_writef8(emitter, uint);
  211|   526k|  } else {
  212|   526k|    pni_emitter_writef8(emitter, PNE_UINT);
  ------------------
  |  |   12|   526k|#define PNE_UINT            (0x70)
  ------------------
  213|   526k|    pni_emitter_writef32(emitter, uint);
  214|   526k|  }
  215|   893k|  compound->count++;
  216|   893k|}
frame_generators.c:emit_bool:
  180|   737k|static inline void emit_bool(pni_emitter_t* emitter, pni_compound_context* compound, bool b) {
  181|   737k|  emit_accumulated_nulls(emitter, compound);
  182|   737k|  if (b) {
  ------------------
  |  Branch (182:7): [True: 645k, False: 92.0k]
  ------------------
  183|   645k|    pni_emitter_writef8(emitter, PNE_TRUE);
  ------------------
  |  |    8|   645k|#define PNE_TRUE            (0x41)
  ------------------
  184|   645k|  } else {
  185|  92.0k|    pni_emitter_writef8(emitter, PNE_FALSE);
  ------------------
  |  |    9|  92.0k|#define PNE_FALSE           (0x42)
  ------------------
  186|  92.0k|  }
  187|   737k|  compound->count++;
  188|   737k|}
frame_generators.c:emit_ubyte:
  190|  61.3k|static inline void emit_ubyte(pni_emitter_t* emitter, pni_compound_context* compound, uint8_t ubyte) {
  191|  61.3k|  emit_accumulated_nulls(emitter, compound);
  192|  61.3k|  pni_emitter_writef8(emitter, PNE_UBYTE);
  ------------------
  |  |   10|  61.3k|#define PNE_UBYTE           (0x50)
  ------------------
  193|  61.3k|  pni_emitter_writef8(emitter, ubyte);
  194|  61.3k|  compound->count++;
  195|  61.3k|}
frame_generators.c:emit_multiple:
  546|   153k|static inline void emit_multiple(pni_emitter_t* emitter, pni_compound_context* compound, pn_data_t* data) {
  547|   153k|  if (!data || pn_data_size(data) == 0) {
  ------------------
  |  Branch (547:7): [True: 0, False: 153k]
  |  Branch (547:16): [True: 153k, False: 0]
  ------------------
  548|   153k|    emit_null(emitter, compound);
  549|   153k|    return;
  550|   153k|  }
  551|       |
  552|      0|  pn_handle_t point = pn_data_point(data);
  553|      0|  pn_data_rewind(data);
  554|       |  // Rewind and position to first node so data type is defined.
  555|      0|  pn_data_next(data);
  556|       |
  557|      0|  if (pn_data_type(data) == PN_ARRAY) {
  ------------------
  |  Branch (557:7): [True: 0, False: 0]
  ------------------
  558|      0|      switch (pn_data_get_array(data)) {
  559|      0|      case 0:
  ------------------
  |  Branch (559:7): [True: 0, False: 0]
  ------------------
  560|      0|        emit_null(emitter, compound);
  561|      0|        pn_data_restore(data, point);
  562|      0|        return;
  563|      0|      case 1:
  ------------------
  |  Branch (563:7): [True: 0, False: 0]
  ------------------
  564|      0|        emit_accumulated_nulls(emitter, compound);
  565|      0|        pn_data_enter(data);
  566|      0|        pn_data_narrow(data);
  567|      0|        pni_emitter_data(emitter, data);
  568|      0|        pn_data_widen(data);
  569|      0|        break;
  570|      0|      default:
  ------------------
  |  Branch (570:7): [True: 0, False: 0]
  ------------------
  571|      0|        emit_accumulated_nulls(emitter, compound);
  572|      0|        pni_emitter_data(emitter, data);
  573|      0|    }
  574|      0|  } else {
  575|      0|    emit_accumulated_nulls(emitter, compound);
  576|      0|    pni_emitter_data(emitter, data);
  577|      0|  }
  578|       |
  579|      0|  compound->count++;
  580|      0|  pn_data_restore(data, point);
  581|      0|}
frame_generators.c:emit_ulong:
  218|  30.6k|static inline void emit_ulong(pni_emitter_t* emitter, pni_compound_context* compound, uint64_t ulong) {
  219|  30.6k|  emit_accumulated_nulls(emitter, compound);
  220|  30.6k|  if (ulong == 0) {
  ------------------
  |  Branch (220:7): [True: 30.6k, False: 0]
  ------------------
  221|  30.6k|    pni_emitter_writef8(emitter, PNE_ULONG0);
  ------------------
  |  |   17|  30.6k|#define PNE_ULONG0          (0x44)
  ------------------
  222|  30.6k|  } else if (ulong < 256) {
  ------------------
  |  Branch (222:14): [True: 0, False: 0]
  ------------------
  223|      0|    pni_emitter_writef8(emitter, PNE_SMALLULONG);
  ------------------
  |  |   16|      0|#define PNE_SMALLULONG      (0x53)
  ------------------
  224|      0|    pni_emitter_writef8(emitter, ulong);
  225|      0|  } else {
  226|      0|    pni_emitter_writef8(emitter, PNE_ULONG);
  ------------------
  |  |   15|      0|#define PNE_ULONG           (0x80)
  ------------------
  227|      0|    pni_emitter_writef64(emitter, ulong);
  228|      0|  }
  229|  30.6k|  compound->count++;
  230|  30.6k|}

pn_connection_reset:
  112|  30.6k|{
  113|  30.6k|  assert(connection);
  114|  30.6k|  pn_endpoint_t *endpoint = &connection->endpoint;
  115|  30.6k|  endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
  ------------------
  |  |   50|  30.6k|#define PN_LOCAL_UNINIT (1)
  ------------------
                endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
  ------------------
  |  |   65|  30.6k|#define PN_REMOTE_UNINIT (8)
  ------------------
  116|  30.6k|}
pn_connection_open:
  119|  30.6k|{
  120|  30.6k|  assert(connection);
  121|  30.6k|  pn_endpoint_open(&connection->endpoint);
  122|  30.6k|}
pn_connection_close:
  125|  56.6k|{
  126|  56.6k|  assert(connection);
  127|  56.6k|  pn_endpoint_close(&connection->endpoint);
  128|  56.6k|}
pn_connection_release:
  133|  30.6k|{
  134|  30.6k|  assert(!connection->endpoint.freed);
  135|       |  // free those endpoints that haven't been freed by the application
  136|  30.6k|  LL_REMOVE(connection, endpoint, &connection->endpoint);
  ------------------
  |  |  152|  30.6k|  {                                                                    \
  |  |  153|  30.6k|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (153:9): [True: 0, False: 30.6k]
  |  |  ------------------
  |  |  154|  30.6k|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  155|  30.6k|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (155:9): [True: 30.6k, False: 0]
  |  |  ------------------
  |  |  156|  30.6k|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  157|  30.6k|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  125|  30.6k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (157:9): [True: 30.6k, False: 0]
  |  |  ------------------
  |  |  158|  30.6k|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  125|  30.6k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  159|  30.6k|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  126|  30.6k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 30.6k]
  |  |  ------------------
  |  |  160|  30.6k|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  126|      0|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  161|  30.6k|  }
  ------------------
  137|   652k|  while (connection->endpoint_head) {
  ------------------
  |  Branch (137:10): [True: 622k, False: 30.6k]
  ------------------
  138|   622k|    pn_endpoint_t *ep = connection->endpoint_head;
  139|   622k|    switch (ep->type) {
  140|   622k|    case SESSION:
  ------------------
  |  Branch (140:5): [True: 622k, False: 0]
  ------------------
  141|       |      // note: this will free all child links:
  142|   622k|      pn_session_free((pn_session_t *)ep);
  143|   622k|      break;
  144|      0|    case SENDER:
  ------------------
  |  Branch (144:5): [True: 0, False: 622k]
  ------------------
  145|      0|    case RECEIVER:
  ------------------
  |  Branch (145:5): [True: 0, False: 622k]
  ------------------
  146|      0|      pn_link_free((pn_link_t *)ep);
  147|      0|      break;
  148|      0|    default:
  ------------------
  |  Branch (148:5): [True: 0, False: 622k]
  ------------------
  149|      0|      assert(false);
  150|   622k|    }
  151|   622k|  }
  152|  30.6k|  connection->endpoint.freed = true;
  153|  30.6k|  if (!connection->transport) {
  ------------------
  |  Branch (153:7): [True: 30.6k, False: 0]
  ------------------
  154|       |    // no transport available to consume transport work items,
  155|       |    // so manually clear them:
  156|  30.6k|    pn_ep_incref(&connection->endpoint);
  157|  30.6k|    pn_connection_unbound(connection);
  158|  30.6k|  }
  159|  30.6k|  pn_ep_decref(&connection->endpoint);
  160|  30.6k|}
pn_connection_free:
  162|  30.6k|void pn_connection_free(pn_connection_t *connection) {
  163|  30.6k|  pn_connection_release(connection);
  164|  30.6k|  pn_decref(connection);
  165|  30.6k|}
pn_connection_bound:
  168|  30.6k|{
  169|  30.6k|  pn_collector_put_object(connection->collector, connection, PN_CONNECTION_BOUND);
  170|  30.6k|  pn_ep_incref(&connection->endpoint);
  171|       |
  172|  30.6k|  size_t nsessions = pn_list_size(connection->sessions);
  173|  61.3k|  for (size_t i = 0; i < nsessions; i++) {
  ------------------
  |  Branch (173:22): [True: 30.6k, False: 30.6k]
  ------------------
  174|  30.6k|    pni_session_bound((pn_session_t *) pn_list_get(connection->sessions, i));
  175|  30.6k|  }
  176|  30.6k|}
pn_connection_unbound:
  180|  61.3k|{
  181|  61.3k|  connection->transport = NULL;
  182|  61.3k|  if (connection->endpoint.freed) {
  ------------------
  |  Branch (182:7): [True: 30.6k, False: 30.6k]
  ------------------
  183|       |    // connection has been freed prior to unbinding, thus it
  184|       |    // cannot be re-assigned to a new transport.  Clear the
  185|       |    // transport work lists to allow the connection to be freed.
  186|  61.3k|    while (connection->transport_head) {
  ------------------
  |  Branch (186:12): [True: 30.6k, False: 30.6k]
  ------------------
  187|  30.6k|        pn_clear_modified(connection, connection->transport_head);
  188|  30.6k|    }
  189|  30.6k|    while (connection->tpwork_head) {
  ------------------
  |  Branch (189:12): [True: 0, False: 30.6k]
  ------------------
  190|      0|      pn_clear_tpwork(connection->tpwork_head);
  191|      0|    }
  192|  30.6k|  }
  193|  61.3k|  pn_ep_decref(&connection->endpoint);
  194|  61.3k|}
pn_condition_init:
  222|  4.50M|{
  223|  4.50M|  condition->name = NULL;
  224|  4.50M|  condition->description = NULL;
  225|  4.50M|  condition->info = NULL;
  226|  4.50M|}
pn_condition_tini:
  235|  4.50M|{
  236|  4.50M|  pn_data_free(condition->info);
  237|  4.50M|  pn_free(condition->description);
  238|  4.50M|  pn_free(condition->name);
  239|  4.50M|}
pn_session_connection:
  266|  46.8k|{
  267|  46.8k|  if (!session) return NULL;
  ------------------
  |  Branch (267:7): [True: 0, False: 46.8k]
  ------------------
  268|  46.8k|  return session->connection;
  269|  46.8k|}
pn_session_open:
  272|  30.6k|{
  273|  30.6k|  assert(session);
  274|  30.6k|  pn_endpoint_open(&session->endpoint);
  275|  30.6k|}
pn_session_free:
  284|   622k|{
  285|   622k|  assert(!session->endpoint.freed);
  286|  1.88M|  while(pn_list_size(session->links)) {
  ------------------
  |  Branch (286:9): [True: 1.26M, False: 622k]
  ------------------
  287|  1.26M|    pn_link_t *link = (pn_link_t *)pn_list_get(session->links, 0);
  288|  1.26M|    pn_link_free(link);
  289|  1.26M|  }
  290|   622k|  pni_remove_session(session->connection, session);
  291|   622k|  pn_list_add(session->connection->freed, session);
  292|   622k|  session->endpoint.freed = true;
  293|   622k|  pn_ep_decref(&session->endpoint);
  294|       |
  295|       |  // the finalize logic depends on endpoint.freed, so we incref/decref
  296|       |  // to give it a chance to rerun
  297|   622k|  pn_incref(session);
  298|   622k|  pn_decref(session);
  299|   622k|}
pn_link_open:
  335|  30.6k|{
  336|  30.6k|  assert(link);
  337|  30.6k|  pn_endpoint_open(&link->endpoint);
  338|  30.6k|}
pn_link_free:
  367|  1.26M|{
  368|  1.26M|  assert(!link->endpoint.freed);
  369|  1.26M|  pni_remove_link(link->session, link);
  370|  1.26M|  pn_list_add(link->session->freed, link);
  371|  1.26M|  pn_delivery_t *delivery = link->unsettled_head;
  372|  1.38M|  while (delivery) {
  ------------------
  |  Branch (372:10): [True: 119k, False: 1.26M]
  ------------------
  373|   119k|    pn_delivery_t *next = delivery->unsettled_next;
  374|   119k|    pn_delivery_settle(delivery);
  375|   119k|    delivery = next;
  376|   119k|  }
  377|  1.26M|  link->endpoint.freed = true;
  378|  1.26M|  pn_ep_decref(&link->endpoint);
  379|       |
  380|       |  // the finalize logic depends on endpoint.freed (modified above), so
  381|       |  // we incref/decref to give it a chance to rerun
  382|  1.26M|  pn_incref(link);
  383|  1.26M|  pn_decref(link);
  384|  1.26M|}
pn_endpoint_init:
  405|  1.91M|{
  406|  1.91M|  endpoint->type = (pn_endpoint_type_t) type;
  407|  1.91M|  endpoint->referenced = true;
  408|  1.91M|  endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
  ------------------
  |  |   50|  1.91M|#define PN_LOCAL_UNINIT (1)
  ------------------
                endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
  ------------------
  |  |   65|  1.91M|#define PN_REMOTE_UNINIT (8)
  ------------------
  409|  1.91M|  pn_condition_init(&endpoint->condition);
  410|  1.91M|  pn_condition_init(&endpoint->remote_condition);
  411|  1.91M|  endpoint->endpoint_next = NULL;
  412|  1.91M|  endpoint->endpoint_prev = NULL;
  413|  1.91M|  endpoint->transport_next = NULL;
  414|  1.91M|  endpoint->transport_prev = NULL;
  415|  1.91M|  endpoint->modified = false;
  416|  1.91M|  endpoint->freed = false;
  417|  1.91M|  endpoint->refcount = 1;
  418|       |  //fprintf(stderr, "initting 0x%lx\n", (uintptr_t) endpoint);
  419|       |
  420|  1.91M|  LL_ADD(conn, endpoint, endpoint);
  ------------------
  |  |  128|  1.91M|  {                                                           \
  |  |  129|  1.91M|    (NODE)-> LIST ## _next = NULL;                            \
  |  |  130|  1.91M|    (NODE)-> LIST ## _prev = (ROOT)-> LIST ## _tail;          \
  |  |  131|  1.91M|    if (LL_TAIL(ROOT, LIST))                                  \
  |  |  ------------------
  |  |  |  |  126|  1.91M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (126:29): [True: 1.88M, False: 30.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  132|  1.91M|      LL_TAIL(ROOT, LIST)-> LIST ## _next = (NODE);           \
  |  |  ------------------
  |  |  |  |  126|  1.88M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  133|  1.91M|    LL_TAIL(ROOT, LIST) = (NODE);                             \
  |  |  ------------------
  |  |  |  |  126|  1.91M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  134|  1.91M|    if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  125|  1.91M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |                   if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  125|  30.6k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (134:9): [True: 30.6k, False: 1.88M]
  |  |  ------------------
  |  |  135|  1.91M|  }
  ------------------
  421|  1.91M|}
pn_ep_incref:
  424|  3.92M|{
  425|  3.92M|  endpoint->refcount++;
  426|  3.92M|}
pn_ep_decref:
  459|  4.02M|{
  460|  4.02M|  assert(endpoint->refcount > 0);
  461|  4.02M|  endpoint->refcount--;
  462|  4.02M|  if (endpoint->refcount == 0) {
  ------------------
  |  Branch (462:7): [True: 182k, False: 3.83M]
  ------------------
  463|   182k|    pn_connection_t *conn = pni_ep_get_connection(endpoint);
  464|   182k|    pn_collector_put_object(conn->collector, endpoint, pn_final_type((pn_endpoint_type_t) endpoint->type));
  465|   182k|  }
  466|  4.02M|}
pn_connection:
  529|  30.6k|{
  530|  30.6k|  static const pn_class_t clazz = PN_CLASS(pn_connection);
  ------------------
  |  |   66|  30.6k|#define PN_CLASS(PREFIX) {                      \
  |  |   67|  30.6k|    #PREFIX,                                    \
  |  |   68|  30.6k|    CID_ ## PREFIX,                             \
  |  |   69|  30.6k|    NULL,                                       \
  |  |   70|  30.6k|    PREFIX ## _initialize,                      \
  |  |   71|  30.6k|    NULL,                                       \
  |  |   72|  30.6k|    NULL,                                       \
  |  |   73|  30.6k|    NULL,                                       \
  |  |   74|  30.6k|    PREFIX ## _finalize,                        \
  |  |   75|  30.6k|    NULL,                                       \
  |  |   76|  30.6k|    PREFIX ## _hashcode,                        \
  |  |   77|  30.6k|    PREFIX ## _compare,                         \
  |  |   78|  30.6k|    PREFIX ## _inspect                          \
  |  |   79|  30.6k|}
  ------------------
  531|  30.6k|  pn_connection_t *conn = (pn_connection_t *) pn_class_new(&clazz, sizeof(pn_connection_t));
  532|  30.6k|  if (!conn) return NULL;
  ------------------
  |  Branch (532:7): [True: 0, False: 30.6k]
  ------------------
  533|       |
  534|  30.6k|  conn->endpoint_head = NULL;
  535|  30.6k|  conn->endpoint_tail = NULL;
  536|  30.6k|  pn_endpoint_init(&conn->endpoint, CONNECTION, conn);
  537|  30.6k|  conn->transport_head = NULL;
  538|  30.6k|  conn->transport_tail = NULL;
  539|  30.6k|  conn->sessions = pn_list(PN_WEAKREF, 0);
  540|  30.6k|  conn->freed = pn_list(PN_WEAKREF, 0);
  541|  30.6k|  conn->transport = NULL;
  542|  30.6k|  conn->work_head = NULL;
  543|  30.6k|  conn->work_tail = NULL;
  544|  30.6k|  conn->tpwork_head = NULL;
  545|  30.6k|  conn->tpwork_tail = NULL;
  546|  30.6k|  conn->container = pn_string(NULL);
  547|  30.6k|  conn->hostname = pn_string(NULL);
  548|  30.6k|  conn->auth_user = pn_string(NULL);
  549|  30.6k|  conn->authzid = pn_string(NULL);
  550|  30.6k|  conn->auth_password = pn_string(NULL);
  551|  30.6k|  conn->offered_capabilities = pn_data(0);
  552|  30.6k|  conn->desired_capabilities = pn_data(0);
  553|  30.6k|  conn->properties = pn_data(0);
  554|  30.6k|  conn->collector = NULL;
  555|  30.6k|  conn->context = pn_record();
  556|  30.6k|  conn->delivery_pool = pn_list(&PN_CLASSCLASS(pn_delivery), 0);
  ------------------
  |  |  101|  30.6k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  557|  30.6k|  conn->driver = NULL;
  558|       |
  559|  30.6k|  return conn;
  560|  30.6k|}
pn_connection_collect:
  569|  61.3k|{
  570|  61.3k|  pn_decref(connection->collector);
  571|  61.3k|  connection->collector = collector;
  572|  61.3k|  pn_incref(connection->collector);
  573|  61.3k|  pn_endpoint_t *endpoint = connection->endpoint_head;
  574|  2.00M|  while (endpoint) {
  ------------------
  |  Branch (574:10): [True: 1.94M, False: 61.3k]
  ------------------
  575|  1.94M|    pn_collector_put_object(connection->collector, endpoint, endpoint_init_event_map[endpoint->type]);
  576|  1.94M|    endpoint = endpoint->endpoint_next;
  577|  1.94M|  }
  578|  61.3k|}
pn_connection_set_container:
  596|  30.6k|{
  597|  30.6k|  assert(connection);
  598|  30.6k|  pn_string_set(connection->container, container);
  599|  30.6k|}
pn_work_update:
  730|  5.77M|{
  731|  5.77M|  pn_link_t *link = pn_delivery_link(delivery);
  732|  5.77M|  pn_delivery_t *current = pn_link_current(link);
  733|  5.77M|  if (delivery->updated && !delivery->local.settled) {
  ------------------
  |  Branch (733:7): [True: 2.90M, False: 2.86M]
  |  Branch (733:28): [True: 2.48M, False: 426k]
  ------------------
  734|  2.48M|    pni_add_work(connection, delivery);
  735|  3.29M|  } else if (delivery == current) {
  ------------------
  |  Branch (735:14): [True: 621k, False: 2.66M]
  ------------------
  736|   621k|    if (link->endpoint.type == SENDER) {
  ------------------
  |  Branch (736:9): [True: 37.7k, False: 583k]
  ------------------
  737|  37.7k|      if (pn_link_credit(link) > 0) {
  ------------------
  |  Branch (737:11): [True: 2.24k, False: 35.4k]
  ------------------
  738|  2.24k|        pni_add_work(connection, delivery);
  739|  35.4k|      } else {
  740|  35.4k|        pni_clear_work(connection, delivery);
  741|  35.4k|      }
  742|   583k|    } else {
  743|   583k|      pni_add_work(connection, delivery);
  744|   583k|    }
  745|  2.66M|  } else {
  746|  2.66M|    pni_clear_work(connection, delivery);
  747|  2.66M|  }
  748|  5.77M|}
pn_clear_tpwork:
  762|  1.94M|{
  763|  1.94M|  pn_connection_t *connection = delivery->link->session->connection;
  764|  1.94M|  if (delivery->tpwork)
  ------------------
  |  Branch (764:7): [True: 1.03M, False: 912k]
  ------------------
  765|  1.03M|  {
  766|  1.03M|    LL_REMOVE(connection, tpwork, delivery);
  ------------------
  |  |  152|  1.03M|  {                                                                    \
  |  |  153|  1.03M|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (153:9): [True: 7.87k, False: 1.02M]
  |  |  ------------------
  |  |  154|  1.03M|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  155|  1.03M|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (155:9): [True: 953k, False: 78.7k]
  |  |  ------------------
  |  |  156|  1.03M|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  157|  1.03M|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  125|  1.03M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (157:9): [True: 1.02M, False: 7.87k]
  |  |  ------------------
  |  |  158|  1.03M|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  125|  1.02M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  159|  1.03M|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  126|  1.03M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 78.7k, False: 953k]
  |  |  ------------------
  |  |  160|  1.03M|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  126|  78.7k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  161|  1.03M|  }
  ------------------
  767|  1.03M|    delivery->tpwork = false;
  768|  1.03M|    if (pn_refcount(delivery) > 0) {
  ------------------
  |  Branch (768:9): [True: 912k, False: 119k]
  ------------------
  769|   912k|      pn_incref(delivery);
  770|   912k|      pn_decref(delivery);
  771|   912k|    }
  772|  1.03M|  }
  773|  1.94M|}
pn_modified:
  789|  4.66M|{
  790|  4.66M|  if (!endpoint->modified) {
  ------------------
  |  Branch (790:7): [True: 2.01M, False: 2.65M]
  ------------------
  791|  2.01M|    LL_ADD(connection, transport, endpoint);
  ------------------
  |  |  128|  2.01M|  {                                                           \
  |  |  129|  2.01M|    (NODE)-> LIST ## _next = NULL;                            \
  |  |  130|  2.01M|    (NODE)-> LIST ## _prev = (ROOT)-> LIST ## _tail;          \
  |  |  131|  2.01M|    if (LL_TAIL(ROOT, LIST))                                  \
  |  |  ------------------
  |  |  |  |  126|  2.01M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (126:29): [True: 1.95M, False: 67.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  132|  2.01M|      LL_TAIL(ROOT, LIST)-> LIST ## _next = (NODE);           \
  |  |  ------------------
  |  |  |  |  126|  1.95M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  133|  2.01M|    LL_TAIL(ROOT, LIST) = (NODE);                             \
  |  |  ------------------
  |  |  |  |  126|  2.01M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  134|  2.01M|    if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  125|  2.01M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |                   if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  125|  67.3k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (134:9): [True: 67.3k, False: 1.95M]
  |  |  ------------------
  |  |  135|  2.01M|  }
  ------------------
  792|  2.01M|    endpoint->modified = true;
  793|  2.01M|  }
  794|       |
  795|  4.66M|  if (emit && connection->transport) {
  ------------------
  |  Branch (795:7): [True: 4.10M, False: 561k]
  |  Branch (795:15): [True: 3.85M, False: 256k]
  ------------------
  796|  3.85M|    pn_collector_put_object(connection->collector, connection->transport,
  797|  3.85M|                            PN_TRANSPORT);
  798|  3.85M|  }
  799|  4.66M|}
pn_clear_modified:
  802|   135k|{
  803|   135k|  if (endpoint->modified) {
  ------------------
  |  Branch (803:7): [True: 135k, False: 0]
  ------------------
  804|   135k|    LL_REMOVE(connection, transport, endpoint);
  ------------------
  |  |  152|   135k|  {                                                                    \
  |  |  153|   135k|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (153:9): [True: 68.0k, False: 67.3k]
  |  |  ------------------
  |  |  154|   135k|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  155|   135k|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (155:9): [True: 0, False: 135k]
  |  |  ------------------
  |  |  156|   135k|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  157|   135k|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  125|   135k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (157:9): [True: 67.3k, False: 68.0k]
  |  |  ------------------
  |  |  158|   135k|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  125|  67.3k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  159|   135k|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  126|   135k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 135k, False: 0]
  |  |  ------------------
  |  |  160|   135k|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  126|   135k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  161|   135k|  }
  ------------------
  805|   135k|    endpoint->transport_next = NULL;
  806|   135k|    endpoint->transport_prev = NULL;
  807|   135k|    endpoint->modified = false;
  808|   135k|  }
  809|   135k|}
pn_find:
  825|   652k|{
  826|  1.94M|  while (endpoint)
  ------------------
  |  Branch (826:10): [True: 1.91M, False: 30.6k]
  ------------------
  827|  1.91M|  {
  828|  1.91M|    if (pni_matches(endpoint, type, state))
  ------------------
  |  Branch (828:9): [True: 622k, False: 1.29M]
  ------------------
  829|   622k|      return endpoint;
  830|  1.29M|    endpoint = endpoint->endpoint_next;
  831|  1.29M|  }
  832|  30.6k|  return NULL;
  833|   652k|}
pn_session_head:
  836|  30.6k|{
  837|  30.6k|  if (conn)
  ------------------
  |  Branch (837:7): [True: 30.6k, False: 0]
  ------------------
  838|  30.6k|    return (pn_session_t *) pn_find(conn->endpoint_head, SESSION, state);
  839|      0|  else
  840|      0|    return NULL;
  841|  30.6k|}
pn_session_next:
  844|   622k|{
  845|   622k|  if (ssn)
  ------------------
  |  Branch (845:7): [True: 622k, False: 0]
  ------------------
  846|   622k|    return (pn_session_t *) pn_find(ssn->endpoint.endpoint_next, SESSION, state);
  847|      0|  else
  848|      0|    return NULL;
  849|   622k|}
pn_link_head:
  852|    215|{
  853|    215|  if (!conn) return NULL;
  ------------------
  |  Branch (853:7): [True: 0, False: 215]
  ------------------
  854|       |
  855|    215|  pn_endpoint_t *endpoint = conn->endpoint_head;
  856|       |
  857|    645|  while (endpoint)
  ------------------
  |  Branch (857:10): [True: 645, False: 0]
  ------------------
  858|    645|  {
  859|    645|    if (pni_matches(endpoint, SENDER, state) || pni_matches(endpoint, RECEIVER, state))
  ------------------
  |  Branch (859:9): [True: 0, False: 645]
  |  Branch (859:49): [True: 215, False: 430]
  ------------------
  860|    215|      return (pn_link_t *) endpoint;
  861|    430|    endpoint = endpoint->endpoint_next;
  862|    430|  }
  863|       |
  864|      0|  return NULL;
  865|    215|}
pn_link_next:
  868|  29.1k|{
  869|  29.1k|  if (!link) return NULL;
  ------------------
  |  Branch (869:7): [True: 0, False: 29.1k]
  ------------------
  870|       |
  871|  29.1k|  pn_endpoint_t *endpoint = link->endpoint.endpoint_next;
  872|       |
  873|  37.3k|  while (endpoint)
  ------------------
  |  Branch (873:10): [True: 37.1k, False: 215]
  ------------------
  874|  37.1k|  {
  875|  37.1k|    if (pni_matches(endpoint, SENDER, state) || pni_matches(endpoint, RECEIVER, state))
  ------------------
  |  Branch (875:9): [True: 4.29k, False: 32.8k]
  |  Branch (875:49): [True: 24.6k, False: 8.19k]
  ------------------
  876|  28.9k|      return (pn_link_t *) endpoint;
  877|  8.19k|    endpoint = endpoint->endpoint_next;
  878|  8.19k|  }
  879|       |
  880|    215|  return NULL;
  881|  29.1k|}
pn_session:
 1001|   622k|{
 1002|   622k|  assert(conn);
 1003|   622k|#define pn_session_free NULL
 1004|   622k|  static const pn_class_t clazz = PN_METACLASS(pn_session);
  ------------------
  |  |   81|   622k|#define PN_METACLASS(PREFIX) {                  \
  |  |   82|   622k|    #PREFIX,                                    \
  |  |   83|   622k|    CID_ ## PREFIX,                             \
  |  |   84|   622k|    PREFIX ## _new,                             \
  |  |   85|   622k|    PREFIX ## _initialize,                      \
  |  |   86|   622k|    PREFIX ## _incref,                          \
  |  |   87|   622k|    PREFIX ## _decref,                          \
  |  |   88|   622k|    PREFIX ## _refcount,                        \
  |  |   89|   622k|    PREFIX ## _finalize,                        \
  |  |   90|   622k|    PREFIX ## _free,                            \
  |  |   91|   622k|    PREFIX ## _hashcode,                        \
  |  |   92|   622k|    PREFIX ## _compare,                         \
  |  |   93|   622k|    PREFIX ## _inspect                          \
  |  |   94|   622k|}
  ------------------
 1005|   622k|#undef pn_session_free
 1006|   622k|  pn_session_t *ssn = (pn_session_t *) pn_class_new(&clazz, sizeof(pn_session_t));
 1007|   622k|  if (!ssn) return NULL;
  ------------------
  |  Branch (1007:7): [True: 0, False: 622k]
  ------------------
 1008|   622k|  pn_endpoint_init(&ssn->endpoint, SESSION, conn);
 1009|   622k|  pni_add_session(conn, ssn);
 1010|   622k|  ssn->links = pn_list(PN_WEAKREF, 0);
 1011|   622k|  ssn->freed = pn_list(PN_WEAKREF, 0);
 1012|   622k|  ssn->context = pn_record();
 1013|   622k|  ssn->incoming_capacity = 0;
 1014|   622k|  ssn->incoming_bytes = 0;
 1015|   622k|  ssn->outgoing_bytes = 0;
 1016|   622k|  ssn->incoming_deliveries = 0;
 1017|   622k|  ssn->outgoing_deliveries = 0;
 1018|   622k|  ssn->outgoing_window = AMQP_MAX_WINDOW_SIZE;
  ------------------
  |  |   35|   622k|#define AMQP_MAX_WINDOW_SIZE (2147483647)
  ------------------
 1019|   622k|  ssn->local_handle_max = PN_IMPL_HANDLE_MAX;
  ------------------
  |  |   97|   622k|  #define PN_IMPL_HANDLE_MAX 0x7fffffff
  ------------------
 1020|       |
 1021|       |  // begin transport state
 1022|   622k|  memset(&ssn->state, 0, sizeof(ssn->state));
 1023|   622k|  ssn->state.remote_handle_max = UINT32_MAX;
 1024|   622k|  ssn->state.local_channel = (uint16_t)-1;
 1025|   622k|  ssn->state.remote_channel = (uint16_t)-1;
 1026|   622k|  pn_delivery_map_init(&ssn->state.incoming, 0);
 1027|   622k|  pn_delivery_map_init(&ssn->state.outgoing, 0);
 1028|   622k|  ssn->state.local_handles = pn_hash(PN_WEAKREF, 0, 0.75);
 1029|   622k|  ssn->state.remote_handles = pn_hash(PN_WEAKREF, 0, 0.75);
 1030|       |  // end transport state
 1031|       |
 1032|   622k|  pn_collector_put_object(conn->collector, ssn, PN_SESSION_INIT);
 1033|   622k|  if (conn->transport) {
  ------------------
  |  Branch (1033:7): [True: 591k, False: 30.6k]
  ------------------
 1034|   591k|    pni_session_bound(ssn);
 1035|   591k|  }
 1036|   622k|  pn_decref(ssn);
 1037|   622k|  return ssn;
 1038|   622k|}
pn_session_unbound:
 1050|  59.5k|{
 1051|  59.5k|  assert(ssn);
 1052|  59.5k|  ssn->state.local_channel = (uint16_t)-1;
 1053|  59.5k|  ssn->state.remote_channel = (uint16_t)-1;
 1054|  59.5k|  ssn->incoming_bytes = 0;
 1055|  59.5k|  ssn->outgoing_bytes = 0;
 1056|  59.5k|  ssn->incoming_deliveries = 0;
 1057|  59.5k|  ssn->outgoing_deliveries = 0;
 1058|  59.5k|}
pn_link_new:
 1169|  1.26M|{
 1170|  1.26M|#define pn_link_new NULL
 1171|  1.26M|#define pn_link_free NULL
 1172|  1.26M|  static const pn_class_t clazz = PN_METACLASS(pn_link);
  ------------------
  |  |   81|  1.26M|#define PN_METACLASS(PREFIX) {                  \
  |  |   82|  1.26M|    #PREFIX,                                    \
  |  |   83|  1.26M|    CID_ ## PREFIX,                             \
  |  |   84|  1.26M|    PREFIX ## _new,                             \
  |  |   85|  1.26M|    PREFIX ## _initialize,                      \
  |  |   86|  1.26M|    PREFIX ## _incref,                          \
  |  |   87|  1.26M|    PREFIX ## _decref,                          \
  |  |   88|  1.26M|    PREFIX ## _refcount,                        \
  |  |   89|  1.26M|    PREFIX ## _finalize,                        \
  |  |   90|  1.26M|    PREFIX ## _free,                            \
  |  |   91|  1.26M|    PREFIX ## _hashcode,                        \
  |  |   92|  1.26M|    PREFIX ## _compare,                         \
  |  |   93|  1.26M|    PREFIX ## _inspect                          \
  |  |   94|  1.26M|}
  ------------------
 1173|  1.26M|#undef pn_link_new
 1174|  1.26M|#undef pn_link_free
 1175|  1.26M|  pn_link_t *link = (pn_link_t *) pn_class_new(&clazz, sizeof(pn_link_t));
 1176|       |
 1177|  1.26M|  pn_endpoint_init(&link->endpoint, type, session->connection);
 1178|  1.26M|  pni_add_link(session, link);
 1179|  1.26M|  pn_incref(session);  // keep session until link finalized
 1180|  1.26M|  link->name = pn_string(name);
 1181|  1.26M|  pni_terminus_init(&link->source, PN_SOURCE);
 1182|  1.26M|  pni_terminus_init(&link->target, PN_TARGET);
 1183|  1.26M|  pni_terminus_init(&link->remote_source, PN_UNSPECIFIED);
 1184|  1.26M|  pni_terminus_init(&link->remote_target, PN_UNSPECIFIED);
 1185|  1.26M|  link->unsettled_head = link->unsettled_tail = link->current = NULL;
 1186|  1.26M|  link->unsettled_count = 0;
 1187|  1.26M|  link->max_message_size = 0;
 1188|  1.26M|  link->remote_max_message_size = 0;
 1189|  1.26M|  link->available = 0;
 1190|  1.26M|  link->credit = 0;
 1191|  1.26M|  link->queued = 0;
 1192|  1.26M|  link->more_id = 0;
 1193|  1.26M|  link->drain = false;
 1194|  1.26M|  link->drain_flag_mode = true;
 1195|  1.26M|  link->drained = 0;
 1196|  1.26M|  link->context = pn_record();
 1197|  1.26M|  link->snd_settle_mode = PN_SND_MIXED;
 1198|  1.26M|  link->rcv_settle_mode = PN_RCV_FIRST;
 1199|  1.26M|  link->remote_snd_settle_mode = PN_SND_MIXED;
 1200|  1.26M|  link->remote_rcv_settle_mode = PN_RCV_FIRST;
 1201|  1.26M|  link->detached = false;
 1202|  1.26M|  link->more_pending = false;
 1203|  1.26M|  link->properties = 0;
 1204|  1.26M|  link->remote_properties = 0;
 1205|       |
 1206|       |  // begin transport state
 1207|  1.26M|  link->state.local_handle = -1;
 1208|  1.26M|  link->state.remote_handle = -1;
 1209|  1.26M|  link->state.delivery_count = 0;
 1210|  1.26M|  link->state.link_credit = 0;
 1211|       |  // end transport state
 1212|       |
 1213|  1.26M|  pn_collector_put_object(session->connection->collector, link, PN_LINK_INIT);
 1214|  1.26M|  if (session->connection->transport) {
  ------------------
  |  Branch (1214:7): [True: 1.23M, False: 30.6k]
  ------------------
 1215|  1.23M|    pni_link_bound(link);
 1216|  1.23M|  }
 1217|  1.26M|  pn_decref(link);
 1218|  1.26M|  return link;
 1219|  1.26M|}
pn_link_unbound:
 1226|  53.0k|{
 1227|  53.0k|  assert(link);
 1228|  53.0k|  link->state.local_handle = -1;
 1229|  53.0k|  link->state.remote_handle = -1;
 1230|  53.0k|  link->state.delivery_count = 0;
 1231|  53.0k|  link->state.link_credit = 0;
 1232|  53.0k|}
pn_link_source:
 1235|  30.6k|{
 1236|  30.6k|  return link ? &link->source : NULL;
  ------------------
  |  Branch (1236:10): [True: 30.6k, False: 0]
  ------------------
 1237|  30.6k|}
pn_terminus_set_type:
 1255|  2.46M|{
 1256|  2.46M|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1256:7): [True: 0, False: 2.46M]
  ------------------
 1257|  2.46M|  terminus->type = type;
 1258|  2.46M|  return 0;
 1259|  2.46M|}
pn_terminus_get_type:
 1262|  1.23M|{
 1263|  1.23M|  return (pn_terminus_type_t) (terminus ? terminus->type : 0);
  ------------------
  |  Branch (1263:32): [True: 1.23M, False: 0]
  ------------------
 1264|  1.23M|}
pn_terminus_set_address:
 1273|  30.6k|{
 1274|  30.6k|  assert(terminus);
 1275|  30.6k|  return pn_string_set(terminus->address, address);
 1276|  30.6k|}
pn_terminus_set_durability:
 1284|  61.8k|{
 1285|  61.8k|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1285:7): [True: 0, False: 61.8k]
  ------------------
 1286|  61.8k|  terminus->durability = durability;
 1287|  61.8k|  return 0;
 1288|  61.8k|}
pn_terminus_set_expiry_policy:
 1301|  3.02k|{
 1302|  3.02k|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1302:7): [True: 0, False: 3.02k]
  ------------------
 1303|  3.02k|  terminus->expiry_policy = expiry_policy;
 1304|  3.02k|  terminus->has_expiry_policy = true;
 1305|  3.02k|  return 0;
 1306|  3.02k|}
pn_terminus_set_timeout:
 1314|  61.8k|{
 1315|  61.8k|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1315:7): [True: 0, False: 61.8k]
  ------------------
 1316|  61.8k|  terminus->timeout = timeout;
 1317|  61.8k|  return 0;
 1318|  61.8k|}
pn_terminus_set_dynamic:
 1326|  61.8k|{
 1327|  61.8k|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1327:7): [True: 0, False: 61.8k]
  ------------------
 1328|  61.8k|  terminus->dynamic = dynamic;
 1329|  61.8k|  return 0;
 1330|  61.8k|}
pn_terminus_set_distribution_mode:
 1358|  47.9k|{
 1359|  47.9k|  if (!terminus) return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1359:7): [True: 0, False: 47.9k]
  ------------------
 1360|  47.9k|  terminus->distribution_mode = m;
 1361|  47.9k|  return 0;
 1362|  47.9k|}
pn_sender:
 1391|   268k|{
 1392|   268k|  return pn_link_new(SENDER, session, name);
 1393|   268k|}
pn_receiver:
 1396|   992k|{
 1397|   992k|  return pn_link_new(RECEIVER, session, name);
 1398|   992k|}
pn_link_is_sender:
 1412|  1.97M|{
 1413|  1.97M|  return link->endpoint.type == SENDER;
 1414|  1.97M|}
pn_link_is_receiver:
 1417|  2.31M|{
 1418|  2.31M|  return link->endpoint.type == RECEIVER;
 1419|  2.31M|}
pn_link_session:
 1422|  43.6k|{
 1423|  43.6k|  assert(link);
 1424|  43.6k|  return link->session;
 1425|  43.6k|}
pn_dtag:
 1534|  1.03M|pn_delivery_tag_t pn_dtag(const char *bytes, size_t size) {
 1535|  1.03M|  pn_delivery_tag_t dtag = {size, bytes};
 1536|  1.03M|  return dtag;
 1537|  1.03M|}
pn_delivery:
 1540|  1.03M|{
 1541|  1.03M|  assert(link);
 1542|  1.03M|  pn_list_t *pool = link->session->connection->delivery_pool;
 1543|  1.03M|  pn_delivery_t *delivery = (pn_delivery_t *) pn_list_pop(pool);
 1544|  1.03M|  if (!delivery) {
  ------------------
  |  Branch (1544:7): [True: 305k, False: 726k]
  ------------------
 1545|   305k|    delivery = (pn_delivery_t *) pn_class_new(&PN_CLASSCLASS(pn_delivery), sizeof(pn_delivery_t));
  ------------------
  |  |  101|   305k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
 1546|   305k|    if (!delivery) return NULL;
  ------------------
  |  Branch (1546:9): [True: 0, False: 305k]
  ------------------
 1547|   305k|    delivery->tag = pn_buffer(16);
 1548|   305k|    delivery->bytes = pn_buffer(64);
 1549|   305k|    pn_disposition_init(&delivery->local);
 1550|   305k|    pn_disposition_init(&delivery->remote);
 1551|   305k|    delivery->context = pn_record();
 1552|   726k|  } else {
 1553|   726k|    assert(!delivery->state.init);
 1554|   726k|  }
 1555|  1.03M|  delivery->link = link;
 1556|  1.03M|  pn_incref(delivery->link);  // keep link until finalized
 1557|  1.03M|  pn_buffer_clear(delivery->tag);
 1558|  1.03M|  pn_buffer_append(delivery->tag, tag.start, tag.size);
 1559|  1.03M|  pn_disposition_clear(&delivery->local);
 1560|  1.03M|  pn_disposition_clear(&delivery->remote);
 1561|  1.03M|  delivery->updated = false;
 1562|  1.03M|  delivery->settled = false;
 1563|  1.03M|  LL_ADD(link, unsettled, delivery);
  ------------------
  |  |  128|  1.03M|  {                                                           \
  |  |  129|  1.03M|    (NODE)-> LIST ## _next = NULL;                            \
  |  |  130|  1.03M|    (NODE)-> LIST ## _prev = (ROOT)-> LIST ## _tail;          \
  |  |  131|  1.03M|    if (LL_TAIL(ROOT, LIST))                                  \
  |  |  ------------------
  |  |  |  |  126|  1.03M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (126:29): [True: 1.00M, False: 23.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  132|  1.03M|      LL_TAIL(ROOT, LIST)-> LIST ## _next = (NODE);           \
  |  |  ------------------
  |  |  |  |  126|  1.00M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  133|  1.03M|    LL_TAIL(ROOT, LIST) = (NODE);                             \
  |  |  ------------------
  |  |  |  |  126|  1.03M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  134|  1.03M|    if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  125|  1.03M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |                   if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  125|  23.0k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (134:9): [True: 23.0k, False: 1.00M]
  |  |  ------------------
  |  |  135|  1.03M|  }
  ------------------
 1564|  1.03M|  delivery->referenced = true;
 1565|  1.03M|  delivery->work_next = NULL;
 1566|  1.03M|  delivery->work_prev = NULL;
 1567|  1.03M|  delivery->work = false;
 1568|  1.03M|  delivery->tpwork_next = NULL;
 1569|  1.03M|  delivery->tpwork_prev = NULL;
 1570|  1.03M|  delivery->tpwork = false;
 1571|  1.03M|  pn_buffer_clear(delivery->bytes);
 1572|  1.03M|  delivery->done = false;
 1573|  1.03M|  delivery->aborted = false;
 1574|  1.03M|  pn_record_clear(delivery->context);
 1575|       |
 1576|       |  // begin delivery state
 1577|  1.03M|  delivery->state.init = false;
 1578|  1.03M|  delivery->state.sending = false; /* True if we have sent at least 1 frame */
 1579|  1.03M|  delivery->state.sent = false;    /* True if we have sent the entire delivery */
 1580|       |  // end delivery state
 1581|       |
 1582|  1.03M|  if (!link->current)
  ------------------
  |  Branch (1582:7): [True: 23.1k, False: 1.00M]
  ------------------
 1583|  23.1k|    link->current = delivery;
 1584|       |
 1585|  1.03M|  link->unsettled_count++;
 1586|       |
 1587|  1.03M|  pn_work_update(link->session->connection, delivery);
 1588|       |
 1589|       |  // XXX: could just remove incref above
 1590|  1.03M|  pn_decref(delivery);
 1591|       |
 1592|  1.03M|  return delivery;
 1593|  1.03M|}
pn_delivery_current:
 1635|  2.38M|{
 1636|  2.38M|  pn_link_t *link = delivery->link;
 1637|  2.38M|  return pn_link_current(link) == delivery;
 1638|  2.38M|}
pn_link_current:
 1754|  8.15M|{
 1755|  8.15M|  if (!link) return NULL;
  ------------------
  |  Branch (1755:7): [True: 0, False: 8.15M]
  ------------------
 1756|  8.15M|  return link->current;
 1757|  8.15M|}
pn_link_advance:
 1794|  1.03M|{
 1795|  1.03M|  if (link && link->current) {
  ------------------
  |  Branch (1795:7): [True: 1.03M, False: 0]
  |  Branch (1795:15): [True: 1.03M, False: 0]
  ------------------
 1796|  1.03M|    pn_delivery_t *prev = link->current;
 1797|  1.03M|    if (link->endpoint.type == SENDER) {
  ------------------
  |  Branch (1797:9): [True: 65.9k, False: 966k]
  ------------------
 1798|  65.9k|      pni_advance_sender(link);
 1799|   966k|    } else {
 1800|   966k|      pni_advance_receiver(link);
 1801|   966k|    }
 1802|  1.03M|    pn_delivery_t *next = link->current;
 1803|  1.03M|    pn_work_update(link->session->connection, prev);
 1804|  1.03M|    if (next) pn_work_update(link->session->connection, next);
  ------------------
  |  Branch (1804:9): [True: 1.00M, False: 23.1k]
  ------------------
 1805|  1.03M|    return prev != next;
 1806|  1.03M|  } else {
 1807|      0|    return false;
 1808|      0|  }
 1809|  1.03M|}
pn_link_credit:
 1812|  37.7k|{
 1813|  37.7k|  return link ? link->credit : 0;
  ------------------
  |  Branch (1813:10): [True: 37.7k, False: 0]
  ------------------
 1814|  37.7k|}
pn_link_queued:
 1822|  4.29k|{
 1823|  4.29k|  return link ? link->queued : 0;
  ------------------
  |  Branch (1823:10): [True: 4.29k, False: 0]
  ------------------
 1824|  4.29k|}
pn_delivery_settle:
 1873|  1.08M|{
 1874|  1.08M|  assert(delivery);
 1875|  1.08M|  if (!delivery->local.settled) {
  ------------------
  |  Branch (1875:7): [True: 1.03M, False: 51.0k]
  ------------------
 1876|  1.03M|    pn_link_t *link = delivery->link;
 1877|  1.03M|    if (pn_delivery_current(delivery)) {
  ------------------
  |  Branch (1877:9): [True: 68.2k, False: 964k]
  ------------------
 1878|  68.2k|      pn_link_advance(link);
 1879|  68.2k|    }
 1880|       |
 1881|  1.03M|    link->unsettled_count--;
 1882|  1.03M|    delivery->local.settled = true;
 1883|  1.03M|    pni_add_tpwork(delivery);
 1884|  1.03M|    pn_work_update(delivery->link->session->connection, delivery);
 1885|  1.03M|    pn_incref(delivery);
 1886|  1.03M|    pn_decref(delivery);
 1887|  1.03M|  }
 1888|  1.08M|}
pn_link_recv:
 1927|   961k|{
 1928|   961k|  if (!receiver) return PN_ARG_ERR;
  ------------------
  |  |   52|      0|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
  |  Branch (1928:7): [True: 0, False: 961k]
  ------------------
 1929|   961k|  pn_delivery_t *delivery = receiver->current;
 1930|   961k|  if (!delivery) return PN_STATE_ERR;
  ------------------
  |  |   51|      0|#define PN_STATE_ERR (-5)      /**< State error */
  ------------------
  |  Branch (1930:7): [True: 0, False: 961k]
  ------------------
 1931|   961k|  if (delivery->aborted) return PN_ABORTED;
  ------------------
  |  |   57|  1.00k|#define PN_ABORTED (-11)       /**< Delivery aborted error */
  ------------------
  |  Branch (1931:7): [True: 1.00k, False: 960k]
  ------------------
 1932|   960k|  size_t size = pn_buffer_get(delivery->bytes, 0, n, bytes);
 1933|   960k|  pn_buffer_trim(delivery->bytes, size, 0);
 1934|   960k|  if (size) {
  ------------------
  |  Branch (1934:7): [True: 507k, False: 452k]
  ------------------
 1935|   507k|    receiver->session->incoming_bytes -= size;
 1936|   507k|    if (!receiver->session->state.incoming_window) {
  ------------------
  |  Branch (1936:9): [True: 0, False: 507k]
  ------------------
 1937|      0|      pni_add_tpwork(delivery);
 1938|      0|    }
 1939|   507k|    return size;
 1940|   507k|  } else {
 1941|   452k|    return delivery->done ? PN_EOS : 0;
  ------------------
  |  |   47|   452k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
  |  Branch (1941:12): [True: 452k, False: 0]
  ------------------
 1942|   452k|  }
 1943|   960k|}
pn_link_flow:
 1947|  30.6k|{
 1948|  30.6k|  assert(receiver);
 1949|  30.6k|  assert(pn_link_is_receiver(receiver));
 1950|  30.6k|  receiver->credit += credit;
 1951|  30.6k|  pn_modified(receiver->session->connection, &receiver->endpoint, true);
 1952|  30.6k|  if (!receiver->drain_flag_mode) {
  ------------------
  |  Branch (1952:7): [True: 0, False: 30.6k]
  ------------------
 1953|      0|    pn_link_set_drain(receiver, false);
 1954|      0|    receiver->drain_flag_mode = false;
 1955|      0|  }
 1956|  30.6k|}
pn_delivery_link:
 2014|  7.69M|{
 2015|  7.69M|  assert(delivery);
 2016|  7.69M|  return delivery->link;
 2017|  7.69M|}
pn_delivery_update:
 2060|   964k|{
 2061|   964k|  if (!delivery) return;
  ------------------
  |  Branch (2061:7): [True: 0, False: 964k]
  ------------------
 2062|   964k|  delivery->local.type = state;
 2063|   964k|  pni_add_tpwork(delivery);
 2064|   964k|}
pn_delivery_readable:
 2075|  2.31M|{
 2076|  2.31M|  if (delivery) {
  ------------------
  |  Branch (2076:7): [True: 2.31M, False: 0]
  ------------------
 2077|  2.31M|    pn_link_t *link = delivery->link;
 2078|  2.31M|    return pn_link_is_receiver(link) && pn_delivery_current(delivery);
  ------------------
  |  Branch (2078:12): [True: 1.35M, False: 962k]
  |  Branch (2078:41): [True: 978k, False: 372k]
  ------------------
 2079|  2.31M|  } else {
 2080|      0|    return false;
 2081|      0|  }
 2082|  2.31M|}
pn_delivery_pending:
 2085|   964k|{
 2086|       |  /* Aborted deliveries: for clients that don't check pn_delivery_aborted(),
 2087|       |     return 1 rather than 0. This will force them to call pn_link_recv() and get
 2088|       |     the PN_ABORTED error return code.
 2089|       |  */
 2090|   964k|  if (delivery->aborted) return 1;
  ------------------
  |  Branch (2090:7): [True: 1.00k, False: 963k]
  ------------------
 2091|   963k|  return pn_buffer_size(delivery->bytes);
 2092|   964k|}
pn_delivery_partial:
 2095|   978k|{
 2096|   978k|  return !delivery->done;
 2097|   978k|}
pn_connection_condition:
 2113|    401|{
 2114|    401|  assert(connection);
 2115|    401|  return &connection->endpoint.condition;
 2116|    401|}
pn_connection_remote_condition:
 2119|  1.52k|{
 2120|  1.52k|  assert(connection);
 2121|  1.52k|  pn_transport_t *transport = connection->transport;
 2122|  1.52k|  return transport ? &transport->remote_condition : NULL;
  ------------------
  |  Branch (2122:10): [True: 1.52k, False: 0]
  ------------------
 2123|  1.52k|}
pn_session_remote_condition:
 2132|  3.20k|{
 2133|  3.20k|  assert(session);
 2134|  3.20k|  return &session->endpoint.remote_condition;
 2135|  3.20k|}
pn_link_remote_condition:
 2144|  43.6k|{
 2145|  43.6k|  assert(link);
 2146|  43.6k|  return &link->endpoint.remote_condition;
 2147|  43.6k|}
pn_condition_is_set:
 2150|   129k|{
 2151|   129k|  return condition && condition->name && pn_string_get(condition->name);
  ------------------
  |  Branch (2151:10): [True: 129k, False: 0]
  |  Branch (2151:23): [True: 77.4k, False: 52.0k]
  |  Branch (2151:42): [True: 29.9k, False: 47.5k]
  ------------------
 2152|   129k|}
pn_condition_clear:
 2155|  4.02M|{
 2156|  4.02M|  assert(condition);
 2157|  4.02M|  if (condition->name) pn_string_clear(condition->name);
  ------------------
  |  Branch (2157:7): [True: 58.2k, False: 3.96M]
  ------------------
 2158|  4.02M|  if (condition->description) pn_string_clear(condition->description);
  ------------------
  |  Branch (2158:7): [True: 58.2k, False: 3.96M]
  ------------------
 2159|  4.02M|  if (condition->info) pn_data_clear(condition->info);
  ------------------
  |  Branch (2159:7): [True: 58.2k, False: 3.96M]
  ------------------
 2160|  4.02M|}
pn_condition_get_name:
 2163|  20.8k|{
 2164|  20.8k|  assert(condition);
 2165|  20.8k|  if (condition->name == NULL) {
  ------------------
  |  Branch (2165:7): [True: 0, False: 20.8k]
  ------------------
 2166|      0|    return NULL;
 2167|  20.8k|  } else {
 2168|  20.8k|    return pn_string_get(condition->name);
 2169|  20.8k|  }
 2170|  20.8k|}
pn_condition_set_name:
 2173|  20.9k|{
 2174|  20.9k|  assert(condition);
 2175|  20.9k|  if (condition->name == NULL) {
  ------------------
  |  Branch (2175:7): [True: 20.9k, False: 0]
  ------------------
 2176|  20.9k|    condition->name = pn_string(name);
 2177|  20.9k|    return 0;
 2178|  20.9k|  } else {
 2179|      0|    return pn_string_set(condition->name, name);
 2180|      0|  }
 2181|  20.9k|}
pn_condition_get_description:
 2184|  20.8k|{
 2185|  20.8k|  assert(condition);
 2186|  20.8k|  if (condition->description == NULL) {
  ------------------
  |  Branch (2186:7): [True: 0, False: 20.8k]
  ------------------
 2187|      0|    return NULL;
 2188|  20.8k|  } else {
 2189|  20.8k|    return pn_string_get(condition->description);
 2190|  20.8k|  }
 2191|  20.8k|}
pn_condition_set_description:
 2194|  20.9k|{
 2195|  20.9k|  assert(condition);
 2196|  20.9k|  if (condition->description == NULL) {
  ------------------
  |  Branch (2196:7): [True: 20.9k, False: 0]
  ------------------
 2197|  20.9k|    condition->description = pn_string(description);
 2198|  20.9k|    return 0;
 2199|  20.9k|  } else {
 2200|      0|    return pn_string_set(condition->description, description);
 2201|      0|  }
 2202|  20.9k|}
pn_condition_info:
 2230|   136k|{
 2231|   136k|  assert(condition);
 2232|   136k|  if (condition->info == NULL) {
  ------------------
  |  Branch (2232:7): [True: 72.8k, False: 64.0k]
  ------------------
 2233|  72.8k|    condition->info = pn_data(0);
 2234|  72.8k|  }
 2235|   136k|  return condition->info;
 2236|   136k|}
pn_event_connection:
 2270|  88.8k|{
 2271|  88.8k|  pn_session_t *ssn;
 2272|  88.8k|  pn_transport_t *transport;
 2273|       |
 2274|  88.8k|  switch (pn_class_id(pn_event_class(event))) {
 2275|  33.7k|  case CID_pn_connection:
  ------------------
  |  Branch (2275:3): [True: 33.7k, False: 55.1k]
  ------------------
 2276|  33.7k|    return (pn_connection_t *) pn_event_context(event);
 2277|  8.27k|  case CID_pn_transport:
  ------------------
  |  Branch (2277:3): [True: 8.27k, False: 80.5k]
  ------------------
 2278|  8.27k|    transport = pn_event_transport(event);
 2279|  8.27k|    if (transport)
  ------------------
  |  Branch (2279:9): [True: 8.27k, False: 0]
  ------------------
 2280|  8.27k|      return transport->connection;
 2281|      0|    return NULL;
 2282|  46.8k|  default:
  ------------------
  |  Branch (2282:3): [True: 46.8k, False: 42.0k]
  ------------------
 2283|  46.8k|    ssn = pn_event_session(event);
 2284|  46.8k|    if (ssn)
  ------------------
  |  Branch (2284:9): [True: 46.8k, False: 0]
  ------------------
 2285|  46.8k|     return pn_session_connection(ssn);
 2286|  88.8k|  }
 2287|      0|  return NULL;
 2288|  88.8k|}
pn_event_session:
 2291|  50.0k|{
 2292|  50.0k|  pn_link_t *link;
 2293|  50.0k|  switch (pn_class_id(pn_event_class(event))) {
 2294|  6.40k|  case CID_pn_session:
  ------------------
  |  Branch (2294:3): [True: 6.40k, False: 43.6k]
  ------------------
 2295|  6.40k|    return (pn_session_t *) pn_event_context(event);
 2296|  43.6k|  default:
  ------------------
  |  Branch (2296:3): [True: 43.6k, False: 6.40k]
  ------------------
 2297|  43.6k|    link = pn_event_link(event);
 2298|  43.6k|    if (link)
  ------------------
  |  Branch (2298:9): [True: 43.6k, False: 0]
  ------------------
 2299|  43.6k|      return pn_link_session(link);
 2300|  50.0k|  }
 2301|      0|  return NULL;
 2302|  50.0k|}
pn_event_link:
 2305|  87.2k|{
 2306|  87.2k|  pn_delivery_t *dlv;
 2307|  87.2k|  switch (pn_class_id(pn_event_class(event))) {
 2308|  87.2k|  case CID_pn_link:
  ------------------
  |  Branch (2308:3): [True: 87.2k, False: 0]
  ------------------
 2309|  87.2k|    return (pn_link_t *) pn_event_context(event);
 2310|      0|  default:
  ------------------
  |  Branch (2310:3): [True: 0, False: 87.2k]
  ------------------
 2311|      0|    dlv = pn_event_delivery(event);
 2312|      0|    if (dlv)
  ------------------
  |  Branch (2312:9): [True: 0, False: 0]
  ------------------
 2313|      0|      return pn_delivery_link(dlv);
 2314|  87.2k|  }
 2315|      0|  return NULL;
 2316|  87.2k|}
pn_event_delivery:
 2319|  2.31M|{
 2320|  2.31M|  switch (pn_class_id(pn_event_class(event))) {
 2321|  2.31M|  case CID_pn_delivery:
  ------------------
  |  Branch (2321:3): [True: 2.31M, False: 0]
  ------------------
 2322|  2.31M|    return (pn_delivery_t *) pn_event_context(event);
 2323|      0|  default:
  ------------------
  |  Branch (2323:3): [True: 0, False: 2.31M]
  ------------------
 2324|      0|    return NULL;
 2325|  2.31M|  }
 2326|  2.31M|}
pn_event_transport:
 2329|  16.5k|{
 2330|  16.5k|  switch (pn_class_id(pn_event_class(event))) {
 2331|  16.5k|  case CID_pn_transport:
  ------------------
  |  Branch (2331:3): [True: 16.5k, False: 0]
  ------------------
 2332|  16.5k|    return (pn_transport_t *) pn_event_context(event);
 2333|      0|  default:
  ------------------
  |  Branch (2333:3): [True: 0, False: 16.5k]
  ------------------
 2334|      0|    {
 2335|      0|      pn_connection_t *conn = pn_event_connection(event);
 2336|      0|      if (conn)
  ------------------
  |  Branch (2336:11): [True: 0, False: 0]
  ------------------
 2337|      0|        return pn_connection_transport(conn);
 2338|      0|      return NULL;
 2339|      0|    }
 2340|  16.5k|  }
 2341|  16.5k|}
engine.c:pn_endpoint_open:
   90|  92.0k|{
   91|  92.0k|  if (!(endpoint->state & PN_LOCAL_ACTIVE)) {
  ------------------
  |  |   55|  92.0k|#define PN_LOCAL_ACTIVE (2)
  ------------------
  |  Branch (91:7): [True: 92.0k, False: 0]
  ------------------
   92|  92.0k|    PN_SET_LOCAL(endpoint->state, PN_LOCAL_ACTIVE);
  ------------------
  |  |  355|  92.0k|  (OLD) = ((OLD) & PN_REMOTE_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   87|  92.0k|#define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  92.0k|#define PN_REMOTE_UNINIT (8)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|  92.0k|#define PN_REMOTE_ACTIVE (16)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|  92.0k|#define PN_REMOTE_CLOSED (32)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   93|  92.0k|    pn_connection_t *conn = pni_ep_get_connection(endpoint);
   94|  92.0k|    pn_collector_put_object(conn->collector, endpoint,
   95|  92.0k|                            endpoint_event((pn_endpoint_type_t) endpoint->type, true));
   96|  92.0k|    pn_modified(conn, endpoint, true);
   97|  92.0k|  }
   98|  92.0k|}
engine.c:endpoint_event:
   74|   101k|static pn_event_type_t endpoint_event(pn_endpoint_type_t type, bool open) {
   75|   101k|  switch (type) {
   76|  39.7k|  case CONNECTION:
  ------------------
  |  Branch (76:3): [True: 39.7k, False: 61.3k]
  ------------------
   77|  39.7k|    return open ? PN_CONNECTION_LOCAL_OPEN : PN_CONNECTION_LOCAL_CLOSE;
  ------------------
  |  Branch (77:12): [True: 30.6k, False: 9.01k]
  ------------------
   78|  30.6k|  case SESSION:
  ------------------
  |  Branch (78:3): [True: 30.6k, False: 70.3k]
  ------------------
   79|  30.6k|    return open ? PN_SESSION_LOCAL_OPEN : PN_SESSION_LOCAL_CLOSE;
  ------------------
  |  Branch (79:12): [True: 30.6k, False: 0]
  ------------------
   80|      0|  case SENDER:
  ------------------
  |  Branch (80:3): [True: 0, False: 101k]
  ------------------
   81|  30.6k|  case RECEIVER:
  ------------------
  |  Branch (81:3): [True: 30.6k, False: 70.3k]
  ------------------
   82|  30.6k|    return open ? PN_LINK_LOCAL_OPEN : PN_LINK_LOCAL_CLOSE;
  ------------------
  |  Branch (82:12): [True: 30.6k, False: 0]
  ------------------
   83|      0|  default:
  ------------------
  |  Branch (83:3): [True: 0, False: 101k]
  ------------------
   84|      0|    assert(false);
   85|      0|    return PN_EVENT_NONE;
   86|   101k|  }
   87|   101k|}
engine.c:pn_endpoint_close:
  101|  56.6k|{
  102|  56.6k|  if (!(endpoint->state & PN_LOCAL_CLOSED)) {
  ------------------
  |  |   60|  56.6k|#define PN_LOCAL_CLOSED (4)
  ------------------
  |  Branch (102:7): [True: 9.01k, False: 47.6k]
  ------------------
  103|  9.01k|    PN_SET_LOCAL(endpoint->state, PN_LOCAL_CLOSED);
  ------------------
  |  |  355|  9.01k|  (OLD) = ((OLD) & PN_REMOTE_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   87|  9.01k|#define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  9.01k|#define PN_REMOTE_UNINIT (8)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|  9.01k|#define PN_REMOTE_ACTIVE (16)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|  9.01k|#define PN_REMOTE_CLOSED (32)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  104|  9.01k|    pn_connection_t *conn = pni_ep_get_connection(endpoint);
  105|  9.01k|    pn_collector_put_object(conn->collector, endpoint,
  106|  9.01k|                            endpoint_event((pn_endpoint_type_t) endpoint->type, false));
  107|  9.01k|    pn_modified(conn, endpoint, true);
  108|  9.01k|  }
  109|  56.6k|}
engine.c:pni_remove_session:
  258|  1.24M|{
  259|  1.24M|  if (pn_list_remove(conn->sessions, ssn)) {
  ------------------
  |  Branch (259:7): [True: 622k, False: 622k]
  ------------------
  260|   622k|    pn_ep_decref(&conn->endpoint);
  261|   622k|    LL_REMOVE(conn, endpoint, &ssn->endpoint);
  ------------------
  |  |  152|   622k|  {                                                                    \
  |  |  153|   622k|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (153:9): [True: 0, False: 622k]
  |  |  ------------------
  |  |  154|   622k|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  155|   622k|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (155:9): [True: 591k, False: 30.6k]
  |  |  ------------------
  |  |  156|   622k|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  157|   622k|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  125|   622k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (157:9): [True: 622k, False: 0]
  |  |  ------------------
  |  |  158|   622k|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  125|   622k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  159|   622k|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  126|   622k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 30.6k, False: 591k]
  |  |  ------------------
  |  |  160|   622k|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  126|  30.6k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  161|   622k|  }
  ------------------
  262|   622k|  }
  263|  1.24M|}
engine.c:pni_remove_link:
  327|  2.52M|{
  328|  2.52M|  if (pn_list_remove(ssn->links, link)) {
  ------------------
  |  Branch (328:7): [True: 1.26M, False: 1.26M]
  ------------------
  329|  1.26M|    pn_ep_decref(&ssn->endpoint);
  330|  1.26M|    LL_REMOVE(ssn->connection, endpoint, &link->endpoint);
  ------------------
  |  |  152|  1.26M|  {                                                                    \
  |  |  153|  1.26M|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (153:9): [True: 1.26M, False: 0]
  |  |  ------------------
  |  |  154|  1.26M|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  155|  1.26M|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (155:9): [True: 1.23M, False: 28.6k]
  |  |  ------------------
  |  |  156|  1.26M|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  157|  1.26M|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  125|  1.26M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (157:9): [True: 0, False: 1.26M]
  |  |  ------------------
  |  |  158|  1.26M|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  125|      0|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  159|  1.26M|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  126|  1.26M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 28.6k, False: 1.23M]
  |  |  ------------------
  |  |  160|  1.26M|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  126|  28.6k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  161|  1.26M|  }
  ------------------
  331|  1.26M|  }
  332|  2.52M|}
engine.c:pni_ep_get_connection:
   60|  11.0M|{
   61|  11.0M|  switch (endpoint->type) {
  ------------------
  |  Branch (61:11): [True: 0, False: 11.0M]
  ------------------
   62|  70.3k|  case CONNECTION:
  ------------------
  |  Branch (62:3): [True: 70.3k, False: 10.9M]
  ------------------
   63|  70.3k|    return (pn_connection_t *) endpoint;
   64|  5.12M|  case SESSION:
  ------------------
  |  Branch (64:3): [True: 5.12M, False: 5.88M]
  ------------------
   65|  5.12M|    return ((pn_session_t *) endpoint)->connection;
   66|   878k|  case SENDER:
  ------------------
  |  Branch (66:3): [True: 878k, False: 10.1M]
  ------------------
   67|  5.81M|  case RECEIVER:
  ------------------
  |  Branch (67:3): [True: 4.93M, False: 6.07M]
  ------------------
   68|  5.81M|    return ((pn_link_t *) endpoint)->session->connection;
   69|  11.0M|  }
   70|       |
   71|      0|  return NULL;
   72|  11.0M|}
engine.c:pn_final_type:
  428|   182k|static pn_event_type_t pn_final_type(pn_endpoint_type_t type) {
  429|   182k|  switch (type) {
  430|  30.6k|  case CONNECTION:
  ------------------
  |  Branch (430:3): [True: 30.6k, False: 152k]
  ------------------
  431|  30.6k|    return PN_CONNECTION_FINAL;
  432|  52.6k|  case SESSION:
  ------------------
  |  Branch (432:3): [True: 52.6k, False: 130k]
  ------------------
  433|  52.6k|    return PN_SESSION_FINAL;
  434|  5.89k|  case SENDER:
  ------------------
  |  Branch (434:3): [True: 5.89k, False: 176k]
  ------------------
  435|  99.5k|  case RECEIVER:
  ------------------
  |  Branch (435:3): [True: 93.6k, False: 89.2k]
  ------------------
  436|  99.5k|    return PN_LINK_FINAL;
  437|      0|  default:
  ------------------
  |  Branch (437:3): [True: 0, False: 182k]
  ------------------
  438|      0|    assert(false);
  439|      0|    return PN_EVENT_NONE;
  440|   182k|  }
  441|   182k|}
engine.c:pn_connection_finalize:
  493|  30.6k|{
  494|  30.6k|  pn_connection_t *conn = (pn_connection_t *) object;
  495|  30.6k|  pn_endpoint_t *endpoint = &conn->endpoint;
  496|       |
  497|  30.6k|  if (conn->transport) {
  ------------------
  |  Branch (497:7): [True: 0, False: 30.6k]
  ------------------
  498|      0|    assert(!conn->transport->referenced);
  499|      0|    pn_free(conn->transport);
  500|      0|  }
  501|       |
  502|       |  // freeing the transport could post events
  503|  30.6k|  if (pn_refcount(conn) > 0) {
  ------------------
  |  Branch (503:7): [True: 0, False: 30.6k]
  ------------------
  504|      0|    return;
  505|      0|  }
  506|       |
  507|  30.6k|  pni_free_children(conn->sessions, conn->freed);
  508|  30.6k|  pn_free(conn->context);
  509|  30.6k|  pn_decref(conn->collector);
  510|       |
  511|  30.6k|  pn_free(conn->container);
  512|  30.6k|  pn_free(conn->hostname);
  513|  30.6k|  pn_free(conn->auth_user);
  514|  30.6k|  pn_free(conn->authzid);
  515|  30.6k|  pn_free(conn->auth_password);
  516|  30.6k|  pn_free(conn->offered_capabilities);
  517|  30.6k|  pn_free(conn->desired_capabilities);
  518|  30.6k|  pn_free(conn->properties);
  519|  30.6k|  pni_endpoint_tini(endpoint);
  520|  30.6k|  pn_free(conn->delivery_pool);
  521|  30.6k|}
engine.c:pni_free_children:
  475|   652k|{
  476|   652k|  while (pn_list_size(children) > 0) {
  ------------------
  |  Branch (476:10): [True: 0, False: 652k]
  ------------------
  477|      0|    pn_endpoint_t *endpoint = (pn_endpoint_t *) pn_list_get(children, 0);
  478|      0|    assert(!endpoint->referenced);
  479|      0|    pn_free(endpoint);
  480|      0|  }
  481|       |
  482|   652k|  while (pn_list_size(freed) > 0) {
  ------------------
  |  Branch (482:10): [True: 0, False: 652k]
  ------------------
  483|      0|    pn_endpoint_t *endpoint = (pn_endpoint_t *) pn_list_get(freed, 0);
  484|      0|    assert(!endpoint->referenced);
  485|      0|    pn_free(endpoint);
  486|      0|  }
  487|       |
  488|   652k|  pn_free(children);
  489|   652k|  pn_free(freed);
  490|   652k|}
engine.c:pni_endpoint_tini:
  469|  1.91M|{
  470|  1.91M|  pn_condition_tini(&endpoint->remote_condition);
  471|  1.91M|  pn_condition_tini(&endpoint->condition);
  472|  1.91M|}
engine.c:pn_delivery_incref:
 1435|  6.20M|{
 1436|  6.20M|  pn_delivery_t *delivery = (pn_delivery_t *) object;
 1437|  6.20M|  if (delivery->link && !delivery->referenced) {
  ------------------
  |  Branch (1437:7): [True: 5.16M, False: 1.03M]
  |  Branch (1437:25): [True: 2.94M, False: 2.21M]
  ------------------
 1438|  2.94M|    delivery->referenced = true;
 1439|  2.94M|    pn_incref(delivery->link);
 1440|  3.25M|  } else {
 1441|  3.25M|    pn_object_incref(object);
 1442|  3.25M|  }
 1443|  6.20M|}
engine.c:pn_delivery_finalize:
 1452|  4.33M|{
 1453|  4.33M|  pn_delivery_t *delivery = (pn_delivery_t *) object;
 1454|  4.33M|  pn_link_t *link = delivery->link;
 1455|       |  //  assert(!delivery->state.init);
 1456|       |
 1457|  4.33M|  bool pooled = false;
 1458|  4.33M|  bool referenced = true;
 1459|  4.33M|  if (link) {
  ------------------
  |  Branch (1459:7): [True: 4.03M, False: 305k]
  ------------------
 1460|  4.03M|    if (pni_link_live(link) && pni_preserve_delivery(delivery) && delivery->referenced) {
  ------------------
  |  Branch (1460:9): [True: 4.03M, False: 0]
  |  Branch (1460:32): [True: 2.99M, False: 1.03M]
  |  Branch (1460:67): [True: 2.99M, False: 0]
  ------------------
 1461|  2.99M|      delivery->referenced = false;
 1462|  2.99M|      pn_object_incref(delivery);
 1463|  2.99M|      pn_decref(link);
 1464|  2.99M|      return;
 1465|  2.99M|    }
 1466|  1.03M|    referenced = delivery->referenced;
 1467|       |
 1468|  1.03M|    pn_clear_tpwork(delivery);
 1469|  1.03M|    LL_REMOVE(link, unsettled, delivery);
  ------------------
  |  |  152|  1.03M|  {                                                                    \
  |  |  153|  1.03M|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (153:9): [True: 1.18k, False: 1.03M]
  |  |  ------------------
  |  |  154|  1.03M|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  155|  1.03M|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (155:9): [True: 1.00M, False: 24.2k]
  |  |  ------------------
  |  |  156|  1.03M|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  157|  1.03M|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  125|  1.03M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (157:9): [True: 1.03M, False: 1.18k]
  |  |  ------------------
  |  |  158|  1.03M|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  125|  1.03M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  159|  1.03M|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  126|  1.03M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 24.2k, False: 1.00M]
  |  |  ------------------
  |  |  160|  1.03M|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  126|  24.2k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  161|  1.03M|  }
  ------------------
 1470|  1.03M|    pn_delivery_map_del(pn_link_is_sender(link)
  ------------------
  |  Branch (1470:25): [True: 65.9k, False: 966k]
  ------------------
 1471|  1.03M|                        ? &link->session->state.outgoing
 1472|  1.03M|                        : &link->session->state.incoming,
 1473|  1.03M|                        delivery);
 1474|  1.03M|    pn_buffer_clear(delivery->tag);
 1475|  1.03M|    pn_buffer_clear(delivery->bytes);
 1476|  1.03M|    pn_record_clear(delivery->context);
 1477|  1.03M|    delivery->settled = true;
 1478|  1.03M|    pn_connection_t *conn = link->session->connection;
 1479|  1.03M|    assert(pn_refcount(delivery) == 0);
 1480|  1.03M|    if (pni_connection_live(conn)) {
  ------------------
  |  Branch (1480:9): [True: 1.03M, False: 0]
  ------------------
 1481|  1.03M|      pn_list_t *pool = link->session->connection->delivery_pool;
 1482|  1.03M|      delivery->link = NULL;
 1483|  1.03M|      pn_list_add(pool, delivery);
 1484|  1.03M|      pooled = true;
 1485|  1.03M|      assert(pn_refcount(delivery) == 1);
 1486|  1.03M|    }
 1487|  1.03M|  }
 1488|       |
 1489|  1.33M|  if (!pooled) {
  ------------------
  |  Branch (1489:7): [True: 305k, False: 1.03M]
  ------------------
 1490|   305k|    pn_free(delivery->context);
 1491|   305k|    pn_buffer_free(delivery->tag);
 1492|   305k|    pn_buffer_free(delivery->bytes);
 1493|   305k|    pn_disposition_finalize(&delivery->local);
 1494|   305k|    pn_disposition_finalize(&delivery->remote);
 1495|   305k|  }
 1496|       |
 1497|  1.33M|  if (referenced) {
  ------------------
  |  Branch (1497:7): [True: 1.28M, False: 51.0k]
  ------------------
 1498|  1.28M|    pn_decref(link);
 1499|  1.28M|  }
 1500|  1.33M|}
engine.c:pni_link_live:
  927|  4.03M|static bool pni_link_live(pn_link_t *link) {
  928|  4.03M|  return pni_session_live(link->session) || pn_refcount(link) > 1;
  ------------------
  |  Branch (928:10): [True: 4.03M, False: 0]
  |  Branch (928:45): [True: 0, False: 0]
  ------------------
  929|  4.03M|}
engine.c:pni_session_live:
  923|  8.45M|static bool pni_session_live(pn_session_t *ssn) {
  924|  8.45M|  return pni_connection_live(ssn->connection) || pn_refcount(ssn) > 1;
  ------------------
  |  Branch (924:10): [True: 8.45M, False: 0]
  |  Branch (924:50): [True: 0, False: 0]
  ------------------
  925|  8.45M|}
engine.c:pni_preserve_delivery:
 1446|  4.03M|{
 1447|  4.03M|  pn_connection_t *conn = delivery->link->session->connection;
 1448|  4.03M|  return !delivery->local.settled || (conn->transport && (delivery->state.init || delivery->tpwork));
  ------------------
  |  Branch (1448:10): [True: 1.12M, False: 2.91M]
  |  Branch (1448:39): [True: 2.79M, False: 119k]
  |  Branch (1448:59): [True: 1.87M, False: 917k]
  |  Branch (1448:83): [True: 4.29k, False: 912k]
  ------------------
 1449|  4.03M|}
engine.c:pni_connection_live:
  919|  13.9M|static bool pni_connection_live(pn_connection_t *conn) {
  920|  13.9M|  return pn_refcount(conn) > 1;
  921|  13.9M|}
engine.c:pn_disposition_finalize:
 1428|   610k|{
 1429|   610k|  pn_free(ds->data);
 1430|   610k|  pn_free(ds->annotations);
 1431|   610k|  pn_condition_tini(&ds->condition);
 1432|   610k|}
engine.c:pni_add_work:
  712|  3.06M|{
  713|  3.06M|  if (!delivery->work)
  ------------------
  |  Branch (713:7): [True: 998k, False: 2.06M]
  ------------------
  714|   998k|  {
  715|   998k|    LL_ADD(connection, work, delivery);
  ------------------
  |  |  128|   998k|  {                                                           \
  |  |  129|   998k|    (NODE)-> LIST ## _next = NULL;                            \
  |  |  130|   998k|    (NODE)-> LIST ## _prev = (ROOT)-> LIST ## _tail;          \
  |  |  131|   998k|    if (LL_TAIL(ROOT, LIST))                                  \
  |  |  ------------------
  |  |  |  |  126|   998k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (126:29): [True: 880k, False: 117k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  132|   998k|      LL_TAIL(ROOT, LIST)-> LIST ## _next = (NODE);           \
  |  |  ------------------
  |  |  |  |  126|   880k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  133|   998k|    LL_TAIL(ROOT, LIST) = (NODE);                             \
  |  |  ------------------
  |  |  |  |  126|   998k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  134|   998k|    if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  125|   998k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |                   if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  125|   117k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (134:9): [True: 117k, False: 880k]
  |  |  ------------------
  |  |  135|   998k|  }
  ------------------
  716|   998k|    delivery->work = true;
  717|   998k|  }
  718|  3.06M|}
engine.c:pni_clear_work:
  721|  2.70M|{
  722|  2.70M|  if (delivery->work)
  ------------------
  |  Branch (722:7): [True: 998k, False: 1.70M]
  ------------------
  723|   998k|  {
  724|   998k|    LL_REMOVE(connection, work, delivery);
  ------------------
  |  |  152|   998k|  {                                                                    \
  |  |  153|   998k|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (153:9): [True: 477k, False: 520k]
  |  |  ------------------
  |  |  154|   998k|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  155|   998k|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (155:9): [True: 423k, False: 574k]
  |  |  ------------------
  |  |  156|   998k|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  157|   998k|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  125|   998k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (157:9): [True: 520k, False: 477k]
  |  |  ------------------
  |  |  158|   998k|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  125|   520k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  159|   998k|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  126|   998k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 574k, False: 423k]
  |  |  ------------------
  |  |  160|   998k|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  126|   574k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  161|   998k|  }
  ------------------
  725|   998k|    delivery->work = false;
  726|   998k|  }
  727|  2.70M|}
engine.c:pni_matches:
  812|  1.98M|{
  813|  1.98M|  if (endpoint->type != type) return false;
  ------------------
  |  Branch (813:7): [True: 1.33M, False: 651k]
  ------------------
  814|       |
  815|   651k|  if (!state) return true;
  ------------------
  |  Branch (815:7): [True: 651k, False: 0]
  ------------------
  816|       |
  817|      0|  int st = endpoint->state;
  818|      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 (818:7): [True: 0, False: 0]
  |  Branch (818:40): [True: 0, False: 0]
  ------------------
  819|      0|    return st & state;
  820|      0|  else
  821|      0|    return st == state;
  822|      0|}
engine.c:pn_session_incref:
  884|  6.38M|{
  885|  6.38M|  pn_session_t *session = (pn_session_t *) object;
  886|  6.38M|  if (!session->endpoint.referenced) {
  ------------------
  |  Branch (886:7): [True: 3.79M, False: 2.58M]
  ------------------
  887|  3.79M|    session->endpoint.referenced = true;
  888|  3.79M|    pn_incref(session->connection);
  889|  3.79M|  } else {
  890|  2.58M|    pn_object_incref(object);
  891|  2.58M|  }
  892|  6.38M|}
engine.c:pn_session_finalize:
  963|  4.42M|{
  964|  4.42M|  pn_session_t *session = (pn_session_t *) object;
  965|  4.42M|  pn_endpoint_t *endpoint = &session->endpoint;
  966|       |
  967|  4.42M|  if (pni_preserve_child(endpoint)) {
  ------------------
  |  Branch (967:7): [True: 3.79M, False: 622k]
  ------------------
  968|  3.79M|    return;
  969|  3.79M|  }
  970|       |
  971|   622k|  pn_free(session->context);
  972|   622k|  pni_free_children(session->links, session->freed);
  973|   622k|  pni_endpoint_tini(endpoint);
  974|   622k|  pn_delivery_map_free(&session->state.incoming);
  975|   622k|  pn_delivery_map_free(&session->state.outgoing);
  976|   622k|  pn_free(session->state.local_handles);
  977|   622k|  pn_free(session->state.remote_handles);
  978|   622k|  pni_remove_session(session->connection, session);
  979|   622k|  pn_list_remove(session->connection->freed, session);
  980|       |
  981|   622k|  if (session->connection->transport) {
  ------------------
  |  Branch (981:7): [True: 0, False: 622k]
  ------------------
  982|      0|    pn_transport_t *transport = session->connection->transport;
  983|      0|    pn_hash_del(transport->local_channels, session->state.local_channel);
  984|      0|    pn_hash_del(transport->remote_channels, session->state.remote_channel);
  985|      0|  }
  986|       |
  987|   622k|  if (endpoint->referenced) {
  ------------------
  |  Branch (987:7): [True: 622k, False: 0]
  ------------------
  988|   622k|    pn_decref(session->connection);
  989|   622k|  }
  990|   622k|}
engine.c:pni_preserve_child:
  947|  8.84M|{
  948|  8.84M|  pn_connection_t *conn = pni_ep_get_connection(endpoint);
  949|  8.84M|  pn_endpoint_t *parent = pn_ep_parent(endpoint);
  950|  8.84M|  if (pni_endpoint_live(parent) && (!endpoint->freed || (pn_ep_bound(endpoint)))
  ------------------
  |  Branch (950:7): [True: 8.84M, False: 0]
  |  Branch (950:37): [True: 6.96M, False: 1.88M]
  |  Branch (950:57): [True: 0, False: 1.88M]
  ------------------
  951|  8.84M|      && endpoint->referenced) {
  ------------------
  |  Branch (951:10): [True: 6.96M, False: 0]
  ------------------
  952|  6.96M|    pn_object_incref(endpoint);
  953|  6.96M|    endpoint->referenced = false;
  954|  6.96M|    pn_decref(parent);
  955|  6.96M|    return true;
  956|  6.96M|  } else {
  957|  1.88M|    LL_REMOVE(conn, transport, endpoint);
  ------------------
  |  |  152|  1.88M|  {                                                                    \
  |  |  153|  1.88M|    if ((NODE)-> LIST ## _prev)                                        \
  |  |  ------------------
  |  |  |  Branch (153:9): [True: 1.88M, False: 0]
  |  |  ------------------
  |  |  154|  1.88M|      (NODE)-> LIST ## _prev-> LIST ## _next = (NODE)-> LIST ## _next; \
  |  |  155|  1.88M|    if ((NODE)-> LIST ## _next)                                        \
  |  |  ------------------
  |  |  |  Branch (155:9): [True: 1.82M, False: 59.3k]
  |  |  ------------------
  |  |  156|  1.88M|      (NODE)-> LIST ## _next-> LIST ## _prev = (NODE)-> LIST ## _prev; \
  |  |  157|  1.88M|    if ((NODE) == LL_HEAD(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  125|  1.88M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (157:9): [True: 0, False: 1.88M]
  |  |  ------------------
  |  |  158|  1.88M|      LL_HEAD(ROOT, LIST) = (NODE)-> LIST ## _next;                    \
  |  |  ------------------
  |  |  |  |  125|      0|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  159|  1.88M|    if ((NODE) == LL_TAIL(ROOT, LIST))                                 \
  |  |  ------------------
  |  |  |  |  126|  1.88M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 59.3k, False: 1.82M]
  |  |  ------------------
  |  |  160|  1.88M|      LL_TAIL(ROOT, LIST) = (NODE)-> LIST ## _prev;                    \
  |  |  ------------------
  |  |  |  |  126|  59.3k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  161|  1.88M|  }
  ------------------
  958|  1.88M|    return false;
  959|  1.88M|  }
  960|  8.84M|}
engine.c:pn_ep_parent:
  443|  8.84M|static pn_endpoint_t *pn_ep_parent(pn_endpoint_t *endpoint) {
  444|  8.84M|  switch (endpoint->type) {
  445|      0|  case CONNECTION:
  ------------------
  |  Branch (445:3): [True: 0, False: 8.84M]
  ------------------
  446|      0|    return NULL;
  447|  4.42M|  case SESSION:
  ------------------
  |  Branch (447:3): [True: 4.42M, False: 4.42M]
  ------------------
  448|  4.42M|    return &((pn_session_t *) endpoint)->connection->endpoint;
  449|   603k|  case SENDER:
  ------------------
  |  Branch (449:3): [True: 603k, False: 8.24M]
  ------------------
  450|  4.42M|  case RECEIVER:
  ------------------
  |  Branch (450:3): [True: 3.81M, False: 5.02M]
  ------------------
  451|  4.42M|    return &((pn_link_t *) endpoint)->session->endpoint;
  452|      0|  default:
  ------------------
  |  Branch (452:3): [True: 0, False: 8.84M]
  ------------------
  453|      0|    assert(false);
  454|      0|    return NULL;
  455|  8.84M|  }
  456|  8.84M|}
engine.c:pni_endpoint_live:
  931|  8.84M|static bool pni_endpoint_live(pn_endpoint_t *endpoint) {
  932|  8.84M|  switch (endpoint->type) {
  933|  4.42M|  case CONNECTION:
  ------------------
  |  Branch (933:3): [True: 4.42M, False: 4.42M]
  ------------------
  934|  4.42M|    return pni_connection_live((pn_connection_t *)endpoint);
  935|  4.42M|  case SESSION:
  ------------------
  |  Branch (935:3): [True: 4.42M, False: 4.42M]
  ------------------
  936|  4.42M|    return pni_session_live((pn_session_t *) endpoint);
  937|      0|  case SENDER:
  ------------------
  |  Branch (937:3): [True: 0, False: 8.84M]
  ------------------
  938|      0|  case RECEIVER:
  ------------------
  |  Branch (938:3): [True: 0, False: 8.84M]
  ------------------
  939|      0|    return pni_link_live((pn_link_t *) endpoint);
  940|      0|  default:
  ------------------
  |  Branch (940:3): [True: 0, False: 8.84M]
  ------------------
  941|      0|    assert(false);
  942|      0|    return false;
  943|  8.84M|  }
  944|  8.84M|}
engine.c:pn_ep_bound:
  895|  1.88M|{
  896|  1.88M|  pn_connection_t *conn = pni_ep_get_connection(endpoint);
  897|  1.88M|  pn_session_t *ssn;
  898|  1.88M|  pn_link_t *lnk;
  899|       |
  900|  1.88M|  if (!conn->transport) return false;
  ------------------
  |  Branch (900:7): [True: 1.88M, False: 0]
  ------------------
  901|      0|  if (endpoint->modified) return true;
  ------------------
  |  Branch (901:7): [True: 0, False: 0]
  ------------------
  902|       |
  903|      0|  switch (endpoint->type) {
  904|      0|  case CONNECTION:
  ------------------
  |  Branch (904:3): [True: 0, False: 0]
  ------------------
  905|      0|    return ((pn_connection_t *)endpoint)->transport;
  906|      0|  case SESSION:
  ------------------
  |  Branch (906:3): [True: 0, False: 0]
  ------------------
  907|      0|    ssn = (pn_session_t *) endpoint;
  908|      0|    return (((int16_t) ssn->state.local_channel) >= 0 || ((int16_t) ssn->state.remote_channel) >= 0);
  ------------------
  |  Branch (908:13): [True: 0, False: 0]
  |  Branch (908:58): [True: 0, False: 0]
  ------------------
  909|      0|  case SENDER:
  ------------------
  |  Branch (909:3): [True: 0, False: 0]
  ------------------
  910|      0|  case RECEIVER:
  ------------------
  |  Branch (910:3): [True: 0, False: 0]
  ------------------
  911|      0|    lnk = (pn_link_t *) endpoint;
  912|      0|    return ((int32_t) lnk->state.local_handle) >= 0 || ((int32_t) lnk->state.remote_handle) >= 0;
  ------------------
  |  Branch (912:12): [True: 0, False: 0]
  |  Branch (912:56): [True: 0, False: 0]
  ------------------
  913|      0|  default:
  ------------------
  |  Branch (913:3): [True: 0, False: 0]
  ------------------
  914|      0|    assert(false);
  915|      0|    return false;
  916|      0|  }
  917|      0|}
engine.c:pni_add_session:
  250|   622k|{
  251|   622k|  pn_list_add(conn->sessions, ssn);
  252|   622k|  ssn->connection = conn;
  253|   622k|  pn_incref(conn);  // keep around until finalized
  254|   622k|  pn_ep_incref(&conn->endpoint);
  255|   622k|}
engine.c:pni_session_bound:
 1041|   622k|{
 1042|   622k|  assert(ssn);
 1043|   622k|  size_t nlinks = pn_list_size(ssn->links);
 1044|   652k|  for (size_t i = 0; i < nlinks; i++) {
  ------------------
  |  Branch (1044:22): [True: 30.6k, False: 622k]
  ------------------
 1045|  30.6k|    pni_link_bound((pn_link_t *) pn_list_get(ssn->links, i));
 1046|  30.6k|  }
 1047|   622k|}
engine.c:pn_link_incref:
 1119|  7.80M|{
 1120|  7.80M|  pn_link_t *link = (pn_link_t *) object;
 1121|  7.80M|  if (!link->endpoint.referenced) {
  ------------------
  |  Branch (1121:7): [True: 3.16M, False: 4.64M]
  ------------------
 1122|  3.16M|    link->endpoint.referenced = true;
 1123|  3.16M|    pn_incref(link->session);
 1124|  4.64M|  } else {
 1125|  4.64M|    pn_object_incref(object);
 1126|  4.64M|  }
 1127|  7.80M|}
engine.c:pn_link_finalize:
 1130|  4.42M|{
 1131|  4.42M|  pn_link_t *link = (pn_link_t *) object;
 1132|  4.42M|  pn_endpoint_t *endpoint = &link->endpoint;
 1133|       |
 1134|  4.42M|  if (pni_preserve_child(endpoint)) {
  ------------------
  |  Branch (1134:7): [True: 3.16M, False: 1.26M]
  ------------------
 1135|  3.16M|    return;
 1136|  3.16M|  }
 1137|       |
 1138|  1.31M|  while (link->unsettled_head) {
  ------------------
  |  Branch (1138:10): [True: 51.0k, False: 1.26M]
  ------------------
 1139|  51.0k|    assert(!link->unsettled_head->referenced);
 1140|  51.0k|    pn_free(link->unsettled_head);
 1141|  51.0k|  }
 1142|       |
 1143|  1.26M|  pn_free(link->context);
 1144|  1.26M|  pni_terminus_free(&link->source);
 1145|  1.26M|  pni_terminus_free(&link->target);
 1146|  1.26M|  pni_terminus_free(&link->remote_source);
 1147|  1.26M|  pni_terminus_free(&link->remote_target);
 1148|  1.26M|  pn_free(link->name);
 1149|  1.26M|  pni_endpoint_tini(endpoint);
 1150|  1.26M|  pni_remove_link(link->session, link);
 1151|  1.26M|  pn_hash_del(link->session->state.local_handles, link->state.local_handle);
 1152|  1.26M|  pn_hash_del(link->session->state.remote_handles, link->state.remote_handle);
 1153|  1.26M|  pn_list_remove(link->session->freed, link);
 1154|  1.26M|  if (endpoint->referenced) {
  ------------------
  |  Branch (1154:7): [True: 1.26M, False: 0]
  ------------------
 1155|  1.26M|    pn_decref(link->session);
 1156|  1.26M|  }
 1157|  1.26M|  pn_free(link->properties);
 1158|  1.26M|  pn_free(link->remote_properties);
 1159|  1.26M|}
engine.c:pni_terminus_free:
  358|  5.04M|{
  359|  5.04M|  pn_free(terminus->address);
  360|  5.04M|  pn_free(terminus->properties);
  361|  5.04M|  pn_free(terminus->capabilities);
  362|  5.04M|  pn_free(terminus->outcomes);
  363|  5.04M|  pn_free(terminus->filter);
  364|  5.04M|}
engine.c:pni_add_link:
  320|  1.26M|{
  321|  1.26M|  pn_list_add(ssn->links, link);
  322|  1.26M|  link->session = ssn;
  323|  1.26M|  pn_ep_incref(&ssn->endpoint);
  324|  1.26M|}
engine.c:pni_terminus_init:
 1103|  5.04M|{
 1104|  5.04M|  terminus->type = type;
 1105|  5.04M|  terminus->address = pn_string(NULL);
 1106|  5.04M|  terminus->durability = PN_NONDURABLE;
 1107|  5.04M|  terminus->has_expiry_policy = false;
 1108|  5.04M|  terminus->expiry_policy = PN_EXPIRE_WITH_SESSION;
 1109|  5.04M|  terminus->timeout = 0;
 1110|  5.04M|  terminus->dynamic = false;
 1111|  5.04M|  terminus->distribution_mode = PN_DIST_MODE_UNSPECIFIED;
 1112|  5.04M|  terminus->properties = pn_data(0);
 1113|  5.04M|  terminus->capabilities = pn_data(0);
 1114|  5.04M|  terminus->outcomes = pn_data(0);
 1115|  5.04M|  terminus->filter = pn_data(0);
 1116|  5.04M|}
engine.c:pni_link_bound:
 1222|  1.26M|{
 1223|  1.26M|}
engine.c:pn_disposition_init:
 1503|   610k|{
 1504|   610k|  ds->data = pn_data(0);
 1505|   610k|  ds->annotations = pn_data(0);
 1506|   610k|  pn_condition_init(&ds->condition);
 1507|   610k|}
engine.c:pn_disposition_clear:
 1510|  2.06M|{
 1511|  2.06M|  ds->type = 0;
 1512|  2.06M|  ds->section_number = 0;
 1513|  2.06M|  ds->section_offset = 0;
 1514|  2.06M|  ds->failed = false;
 1515|  2.06M|  ds->undeliverable = false;
 1516|  2.06M|  ds->settled = false;
 1517|  2.06M|  pn_data_clear(ds->data);
 1518|  2.06M|  pn_data_clear(ds->annotations);
 1519|  2.06M|  pn_condition_clear(&ds->condition);
 1520|  2.06M|}
engine.c:pni_advance_sender:
 1760|  65.9k|{
 1761|  65.9k|  link->current->done = true;
 1762|       |  /* Skip accounting if the link is aborted and has not sent any frames.
 1763|       |     A delivery that was aborted before sending the first frame was not accounted
 1764|       |     for in pni_process_tpwork_sender() so we don't need to account for it being sent here.
 1765|       |  */
 1766|  65.9k|  bool skip = link->current->aborted && !link->current->state.sending;
  ------------------
  |  Branch (1766:15): [True: 240, False: 65.6k]
  |  Branch (1766:41): [True: 240, False: 0]
  ------------------
 1767|  65.9k|  if (!skip) {
  ------------------
  |  Branch (1767:7): [True: 65.6k, False: 240]
  ------------------
 1768|  65.6k|    link->queued++;
 1769|  65.6k|    link->credit--;
 1770|  65.6k|    link->session->outgoing_deliveries++;
 1771|  65.6k|  }
 1772|  65.9k|  pni_add_tpwork(link->current);
 1773|  65.9k|  link->current = link->current->unsettled_next;
 1774|  65.9k|}
engine.c:pni_advance_receiver:
 1777|   966k|{
 1778|   966k|  link->credit--;
 1779|   966k|  link->queued--;
 1780|   966k|  link->session->incoming_deliveries--;
 1781|       |
 1782|   966k|  pn_delivery_t *current = link->current;
 1783|   966k|  link->session->incoming_bytes -= pn_buffer_size(current->bytes);
 1784|   966k|  pn_buffer_clear(current->bytes);
 1785|       |
 1786|   966k|  if (!link->session->state.incoming_window) {
  ------------------
  |  Branch (1786:7): [True: 0, False: 966k]
  ------------------
 1787|      0|    pni_add_tpwork(current);
 1788|      0|  }
 1789|       |
 1790|   966k|  link->current = link->current->unsettled_next;
 1791|   966k|}
engine.c:pni_add_tpwork:
  751|  2.06M|{
  752|  2.06M|  pn_connection_t *connection = delivery->link->session->connection;
  753|  2.06M|  if (!delivery->tpwork)
  ------------------
  |  Branch (753:7): [True: 1.03M, False: 1.02M]
  ------------------
  754|  1.03M|  {
  755|  1.03M|    LL_ADD(connection, tpwork, delivery);
  ------------------
  |  |  128|  1.03M|  {                                                           \
  |  |  129|  1.03M|    (NODE)-> LIST ## _next = NULL;                            \
  |  |  130|  1.03M|    (NODE)-> LIST ## _prev = (ROOT)-> LIST ## _tail;          \
  |  |  131|  1.03M|    if (LL_TAIL(ROOT, LIST))                                  \
  |  |  ------------------
  |  |  |  |  126|  1.03M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (126:29): [True: 961k, False: 70.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  132|  1.03M|      LL_TAIL(ROOT, LIST)-> LIST ## _next = (NODE);           \
  |  |  ------------------
  |  |  |  |  126|   961k|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  133|  1.03M|    LL_TAIL(ROOT, LIST) = (NODE);                             \
  |  |  ------------------
  |  |  |  |  126|  1.03M|#define LL_TAIL(ROOT, LIST) ((ROOT)-> LIST ## _tail)
  |  |  ------------------
  |  |  134|  1.03M|    if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  125|  1.03M|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |                   if (!LL_HEAD(ROOT, LIST)) LL_HEAD(ROOT, LIST) = (NODE);   \
  |  |  ------------------
  |  |  |  |  125|  70.9k|#define LL_HEAD(ROOT, LIST) ((ROOT)-> LIST ## _head)
  |  |  ------------------
  |  |  |  Branch (134:9): [True: 70.9k, False: 961k]
  |  |  ------------------
  |  |  135|  1.03M|  }
  ------------------
  756|  1.03M|    delivery->tpwork = true;
  757|  1.03M|  }
  758|  2.06M|  pn_modified(connection, &connection->endpoint, true);
  759|  2.06M|}

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

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

object.c:pn_fixed_string:
   43|   507k|static inline pn_fixed_string_t pn_fixed_string(char *bytes, uint32_t size) {
   44|   507k|  return (pn_fixed_string_t) {.bytes=bytes, .size=size, .position=0};
   45|   507k|}
object.c:pn_fixed_string_terminate:
   92|   507k|static inline void pn_fixed_string_terminate(pn_fixed_string_t *str) {
   93|   507k|  if (str->position==str->size) str->position--;
  ------------------
  |  Branch (93:7): [True: 1.45k, False: 505k]
  ------------------
   94|   507k|  str->bytes[str->position] = 0;
   95|   507k|}
logger.c:pn_fixed_string:
   43|  5.83k|static inline pn_fixed_string_t pn_fixed_string(char *bytes, uint32_t size) {
   44|  5.83k|  return (pn_fixed_string_t) {.bytes=bytes, .size=size, .position=0};
   45|  5.83k|}
logger.c:pn_fixed_string_terminate:
   92|  5.83k|static inline void pn_fixed_string_terminate(pn_fixed_string_t *str) {
   93|  5.83k|  if (str->position==str->size) str->position--;
  ------------------
  |  Branch (93:7): [True: 0, False: 5.83k]
  ------------------
   94|  5.83k|  str->bytes[str->position] = 0;
   95|  5.83k|}
logger.c:pn_fixed_string_vaddf:
   61|  5.83k|static inline void pn_fixed_string_vaddf(pn_fixed_string_t *str, const char *format, va_list ap){
   62|  5.83k|  uint32_t bytes_left = str->size-str->position;
   63|  5.83k|  if (bytes_left==0) return;
  ------------------
  |  Branch (63:7): [True: 0, False: 5.83k]
  ------------------
   64|       |
   65|  5.83k|  char *out = &str->bytes[str->position];
   66|  5.83k|  int out_size = vsnprintf(out, bytes_left, format, ap);
   67|  5.83k|  if ( out_size<0 ) return;
  ------------------
  |  Branch (67:8): [True: 0, False: 5.83k]
  ------------------
   68|  5.83k|  str->position += pn_min((uint32_t)out_size, bytes_left);
  ------------------
  |  |  163|  5.83k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 0, False: 5.83k]
  |  |  ------------------
  ------------------
   69|  5.83k|}
codec.c:pn_fixed_string_addf:
   71|  7.54M|static inline void pn_fixed_string_addf(pn_fixed_string_t *str, const char *format, ...) {
   72|  7.54M|  va_list ap;
   73|  7.54M|  va_start(ap, format);
   74|  7.54M|  pn_fixed_string_vaddf(str, format, ap);
   75|  7.54M|  va_end(ap);
   76|  7.54M|}
codec.c:pn_fixed_string_vaddf:
   61|  7.54M|static inline void pn_fixed_string_vaddf(pn_fixed_string_t *str, const char *format, va_list ap){
   62|  7.54M|  uint32_t bytes_left = str->size-str->position;
   63|  7.54M|  if (bytes_left==0) return;
  ------------------
  |  Branch (63:7): [True: 6.57M, False: 967k]
  ------------------
   64|       |
   65|   967k|  char *out = &str->bytes[str->position];
   66|   967k|  int out_size = vsnprintf(out, bytes_left, format, ap);
   67|   967k|  if ( out_size<0 ) return;
  ------------------
  |  Branch (67:8): [True: 0, False: 967k]
  ------------------
   68|   967k|  str->position += pn_min((uint32_t)out_size, bytes_left);
  ------------------
  |  |  163|   967k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 205, False: 967k]
  |  |  ------------------
  ------------------
   69|   967k|}
codec.c:pn_fixed_string_quote:
   78|  4.84k|static inline void pn_fixed_string_quote(pn_fixed_string_t *str, const char *data, size_t size) {
   79|  4.84k|  size_t bytes_left = str->size-str->position;
   80|  4.84k|  if (bytes_left==0) return;
  ------------------
  |  Branch (80:7): [True: 434, False: 4.40k]
  ------------------
   81|       |
   82|  4.40k|  char *out = &str->bytes[str->position];
   83|  4.40k|  ssize_t out_size = pn_quote_data(out, bytes_left, data, size);
   84|       |  // The only error (ie value less than 0) that can come from pn_quote_data is PN_OVERFLOW
   85|  4.40k|  if ( out_size>=0 ) {
  ------------------
  |  Branch (85:8): [True: 3.19k, False: 1.21k]
  ------------------
   86|  3.19k|    str->position += out_size;
   87|  3.19k|  } else {
   88|  1.21k|    str->position = str->size;
   89|  1.21k|  }
   90|  4.40k|}

pn_read_frame:
   58|  3.37M|{
   59|  3.37M|  if (available < AMQP_HEADER_SIZE) return 0;
  ------------------
  |  |   33|  3.37M|#define AMQP_HEADER_SIZE (8)
  ------------------
  |  Branch (59:7): [True: 22.4k, False: 3.35M]
  ------------------
   60|  3.35M|  uint32_t size = pni_read32(&bytes[0]);
   61|  3.35M|  if (max && size > max) return PN_ERR;
  ------------------
  |  |   48|  3.44k|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (61:7): [True: 3.35M, False: 0]
  |  Branch (61:14): [True: 3.44k, False: 3.35M]
  ------------------
   62|  3.35M|  if (available < size) return 0;
  ------------------
  |  Branch (62:7): [True: 28.6k, False: 3.32M]
  ------------------
   63|  3.32M|  unsigned int doff = 4 * (uint8_t)bytes[4];
   64|  3.32M|  if (doff < AMQP_HEADER_SIZE || doff > size) return PN_ERR;
  ------------------
  |  |   33|  6.64M|#define AMQP_HEADER_SIZE (8)
  ------------------
                if (doff < AMQP_HEADER_SIZE || doff > size) return PN_ERR;
  ------------------
  |  |   48|    569|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (64:7): [True: 254, False: 3.32M]
  |  Branch (64:34): [True: 315, False: 3.32M]
  ------------------
   65|       |
   66|  3.32M|  frame->frame_payload0 = (pn_bytes_t){.size=size-doff, .start=bytes+doff};
   67|  3.32M|  frame->frame_payload1 = (pn_bytes_t){.size=0,.start=NULL};
   68|  3.32M|  frame->extended = (pn_bytes_t){.size=doff-AMQP_HEADER_SIZE, .start=bytes+AMQP_HEADER_SIZE};
  ------------------
  |  |   33|  3.32M|#define AMQP_HEADER_SIZE (8)
  ------------------
                frame->extended = (pn_bytes_t){.size=doff-AMQP_HEADER_SIZE, .start=bytes+AMQP_HEADER_SIZE};
  ------------------
  |  |   33|  3.32M|#define AMQP_HEADER_SIZE (8)
  ------------------
   69|  3.32M|  frame->type = bytes[5];
   70|  3.32M|  frame->channel = pni_read16(&bytes[6]);
   71|       |
   72|  3.32M|  pn_do_rx_trace(logger, frame->channel, frame->frame_payload0);
   73|       |
   74|  3.32M|  return size;
   75|  3.32M|}
pn_write_frame:
   78|   451k|{
   79|   451k|  size_t size = AMQP_HEADER_SIZE + frame.extended.size + frame.frame_payload0.size + frame.frame_payload1.size;
  ------------------
  |  |   33|   451k|#define AMQP_HEADER_SIZE (8)
  ------------------
   80|   451k|  if (size <= pn_buffer_available(buffer))
  ------------------
  |  Branch (80:7): [True: 451k, False: 0]
  ------------------
   81|   451k|  {
   82|       |    // Prepare header
   83|   451k|    char bytes[8];
   84|   451k|    pni_write32(&bytes[0], size);
   85|   451k|    int doff = (frame.extended.size + AMQP_HEADER_SIZE - 1)/4 + 1;
  ------------------
  |  |   33|   451k|#define AMQP_HEADER_SIZE (8)
  ------------------
   86|   451k|    bytes[4] = doff;
   87|   451k|    bytes[5] = frame.type;
   88|   451k|    pni_write16(&bytes[6], frame.channel);
   89|       |
   90|       |    // Write header then rest of frame
   91|   451k|    pn_buffer_append(buffer, bytes, 8);
   92|   451k|    pn_buffer_append(buffer, frame.extended.start, frame.extended.size);
   93|       |
   94|       |    // Don't mess with the buffer unless we are logging frame traces to avoid
   95|       |    // shuffling the buffer unnecessarily.
   96|   451k|    if (PN_SHOULD_LOG(logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_FRAME) ) {
  ------------------
  |  |   51|   451k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  ------------------
  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  Branch (51:38): [True: 451k, False: 0]
  |  |  |  Branch (51:73): [True: 0, False: 451k]
  |  |  ------------------
  ------------------
   97|       |      // Get current buffer pointer so we can trace dump performative and payload together
   98|      0|      pn_bytes_t smem = pn_buffer_bytes(buffer);
   99|      0|      pn_buffer_append(buffer, frame.frame_payload0.start, frame.frame_payload0.size);
  100|      0|      pn_buffer_append(buffer, frame.frame_payload1.start, frame.frame_payload1.size);
  101|      0|      pn_bytes_t emem = pn_buffer_bytes(buffer);
  102|       |
  103|       |      // The buffer can't have moved
  104|      0|      assert(smem.start==emem.start);
  105|      0|      pn_bytes_t frame_payload = {.size=emem.size-smem.size, .start=smem.start+smem.size};
  106|      0|      pn_do_tx_trace(logger, frame.channel, frame_payload);
  107|   451k|    } else {
  108|   451k|      pn_buffer_append(buffer, frame.frame_payload0.start, frame.frame_payload0.size);
  109|   451k|      pn_buffer_append(buffer, frame.frame_payload1.start, frame.frame_payload1.size);
  110|   451k|    }
  111|   451k|    pn_do_raw_trace(logger, buffer, AMQP_HEADER_SIZE+frame.extended.size+frame.frame_payload0.size+frame.frame_payload1.size);
  ------------------
  |  |   33|   451k|#define AMQP_HEADER_SIZE (8)
  ------------------
  112|       |
  113|   451k|    return size;
  114|   451k|  } else {
  115|      0|    return 0;
  116|      0|  }
  117|   451k|}
pn_framing_send_amqp:
  132|   451k|{
  133|   451k|  if (!performative.start)
  ------------------
  |  Branch (133:7): [True: 0, False: 451k]
  ------------------
  134|      0|    return PN_ERR;
  ------------------
  |  |   48|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
  135|       |
  136|   451k|  pn_post_frame(transport->output_buffer, &transport->logger, AMQP_FRAME_TYPE, ch, performative, (pn_bytes_t){0, NULL});
  ------------------
  |  |   37|   451k|#define AMQP_FRAME_TYPE (0)
  ------------------
  137|   451k|  transport->output_frames_ct += 1;
  138|   451k|  return 0;
  139|   451k|}
framing.c:pn_do_rx_trace:
   42|  3.32M|{
   43|  3.32M|  if (PN_SHOULD_LOG(logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_FRAME) ) {
  ------------------
  |  |   51|  3.32M|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  ------------------
  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  Branch (51:38): [True: 3.32M, False: 0]
  |  |  |  Branch (51:73): [True: 0, False: 3.32M]
  |  |  ------------------
  ------------------
   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.32M|}
framing.c:pn_do_raw_trace:
   53|   451k|{
   54|   451k|  PN_LOG_RAW(logger, PN_SUBSYSTEM_IO, PN_LEVEL_RAW, output, size);
  ------------------
  |  |   74|   451k|    do { \
  |  |   75|   451k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   51|   451k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  |  |  Branch (51:38): [True: 451k, False: 0]
  |  |  |  |  |  Branch (51:73): [True: 0, False: 451k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   76|   451k|            pni_logger_log_raw(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   77|   451k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (77:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
   55|   451k|}
framing.c:pn_post_frame:
  120|   451k|{
  121|   451k|  pn_frame_t frame = {
  122|   451k|    .type = type,
  123|   451k|    .channel = ch,
  124|   451k|    .frame_payload0 = performative,
  125|   451k|    .frame_payload1 = payload
  126|   451k|  };
  127|   451k|  pn_buffer_ensure(output, AMQP_HEADER_SIZE+frame.extended.size+frame.frame_payload0.size+frame.frame_payload1.size);
  ------------------
  |  |   33|   451k|#define AMQP_HEADER_SIZE (8)
  ------------------
  128|   451k|  pn_write_frame(output, frame, logger);
  129|   451k|}

pni_logger_init:
   48|  30.6k|{
   49|  30.6k|  *logger = the_default_logger;
   50|  30.6k|  logger->sink_context = (intptr_t) logger;
   51|  30.6k|}
pni_logger_fini:
   54|  30.6k|{
   55|  30.6k|}
pn_default_logger:
  153|  30.6k|{
  154|  30.6k|  return &the_default_logger;
  155|  30.6k|}
pn_logger_set_log_sink:
  170|  30.6k|{
  171|  30.6k|  logger->sink = sink;
  172|  30.6k|  logger->sink_context = sink_context;
  173|  30.6k|}
pni_logger_log:
  266|  5.83k|{
  267|  5.83k|  assert(logger);
  268|  5.83k|  logger->sink(logger->sink_context, subsystem, severity, message);
  269|  5.83k|}
pni_logger_vlogf:
  272|  5.83k|{
  273|  5.83k|  assert(logger);
  274|  5.83k|  char buf[1024];
  275|  5.83k|  pn_fixed_string_t output = pn_fixed_string(buf, sizeof(buf));
  276|  5.83k|  pn_fixed_string_vaddf(&output, fmt, ap);
  277|  5.83k|  if (output.position==output.size) {
  ------------------
  |  Branch (277:7): [True: 0, False: 5.83k]
  ------------------
  278|       |    // Message overflow
  279|      0|    const char truncated[] = " ... (truncated)";
  280|      0|    output.position -= sizeof(truncated);
  281|      0|    pn_fixed_string_append(&output, pn_string_const(truncated, sizeof(truncated)));
  282|      0|  }
  283|  5.83k|  pn_fixed_string_terminate(&output);
  284|  5.83k|  pni_logger_log(logger, subsystem, severity, buf);
  285|  5.83k|}
pn_logger_logf:
  288|  5.83k|{
  289|  5.83k|  va_list ap;
  290|       |
  291|  5.83k|  va_start(ap, fmt);
  292|  5.83k|  pni_logger_vlogf(logger, subsystem, severity, fmt, ap);
  293|  5.83k|  va_end(ap);
  294|  5.83k|}

pni_mem_allocate:
  270|  2.78M|void *pni_mem_allocate(const pn_class_t *clazz, size_t size) { return malloc(size); }
pni_mem_zallocate:
  271|  48.9M|void *pni_mem_zallocate(const pn_class_t *clazz, size_t size) { return calloc(1, size); }
pni_mem_deallocate:
  272|  51.3M|void pni_mem_deallocate(const pn_class_t *clazz, void *object) { free(object); }
pni_mem_suballocate:
  274|  17.3M|void *pni_mem_suballocate(const pn_class_t *clazz, void *object, size_t size) { return malloc(size); }
pni_mem_subreallocate:
  275|  4.90M|void *pni_mem_subreallocate(const pn_class_t *clazz, void *object, void *buffer, size_t size) { return realloc(buffer, size); }
pni_mem_subdeallocate:
  276|  46.8M|void pni_mem_subdeallocate(const pn_class_t *clazz, void *object, void *buffer) { free(buffer); }

pni_msgid_clear:
   78|  1.06M|void pni_msgid_clear(pn_atom_t* msgid) {
   79|  1.06M|  switch (msgid->type) {
   80|  8.10k|    case PN_BINARY:
  ------------------
  |  Branch (80:5): [True: 8.10k, False: 1.05M]
  ------------------
   81|  9.64k|    case PN_STRING:
  ------------------
  |  Branch (81:5): [True: 1.53k, False: 1.06M]
  ------------------
   82|  9.64k|      free((void*)msgid->u.as_bytes.start);
   83|  11.5k|    case PN_ULONG:
  ------------------
  |  Branch (83:5): [True: 1.88k, False: 1.06M]
  ------------------
   84|  12.5k|    case PN_UUID:
  ------------------
  |  Branch (84:5): [True: 1.03k, False: 1.06M]
  ------------------
   85|  12.5k|      msgid->type = PN_NULL;
   86|  1.06M|    case PN_NULL:
  ------------------
  |  Branch (86:5): [True: 1.05M, False: 12.5k]
  ------------------
   87|  1.06M|      return;
   88|      0|    default:
  ------------------
  |  Branch (88:5): [True: 0, False: 1.06M]
  ------------------
   89|      0|      break;
   90|  1.06M|  }
   91|      0|  assert(false);
   92|      0|}
pni_msgid_validate_intern:
   94|  49.0k|void pni_msgid_validate_intern(pn_atom_t* msgid) {
   95|  49.0k|  switch (msgid->type) {
   96|  8.10k|    case PN_BINARY:
  ------------------
  |  Branch (96:5): [True: 8.10k, False: 40.9k]
  ------------------
   97|  9.64k|    case PN_STRING: {
  ------------------
  |  Branch (97:5): [True: 1.53k, False: 47.5k]
  ------------------
   98|  9.64k|      char* new = malloc(msgid->u.as_bytes.size);
   99|  9.64k|      assert(new);
  100|  9.64k|      memcpy(new, msgid->u.as_bytes.start, msgid->u.as_bytes.size);
  101|  9.64k|      msgid->u.as_bytes.start = new;
  102|  9.64k|      return;
  103|  8.10k|    }
  104|  1.88k|    case PN_ULONG:
  ------------------
  |  Branch (104:5): [True: 1.88k, False: 47.1k]
  ------------------
  105|  2.91k|    case PN_UUID:
  ------------------
  |  Branch (105:5): [True: 1.03k, False: 48.0k]
  ------------------
  106|  27.8k|    case PN_NULL:
  ------------------
  |  Branch (106:5): [True: 24.9k, False: 24.0k]
  ------------------
  107|  27.8k|      return;
  108|  11.5k|    default:
  ------------------
  |  Branch (108:5): [True: 11.5k, False: 37.5k]
  ------------------
  109|       |      // Not a legal msgid type
  110|  11.5k|      msgid->type = PN_NULL;
  111|  11.5k|      return;
  112|  49.0k|  }
  113|  49.0k|}
pni_msgid_fix_interop:
  116|  49.0k|void pni_msgid_fix_interop(pn_atom_t* msgid) {
  117|  49.0k|  switch (msgid->type) {
  118|      0|    case PN_INT: {
  ------------------
  |  Branch (118:5): [True: 0, False: 49.0k]
  ------------------
  119|      0|      int32_t v = msgid->u.as_int;
  120|       |      // Only fix if the value actually is positive
  121|      0|      if (v < 0) return;
  ------------------
  |  Branch (121:11): [True: 0, False: 0]
  ------------------
  122|      0|      msgid->type = PN_ULONG;
  123|      0|      msgid->u.as_ulong = v;
  124|      0|      return;
  125|      0|    }
  126|      0|    case PN_LONG: {
  ------------------
  |  Branch (126:5): [True: 0, False: 49.0k]
  ------------------
  127|      0|      int64_t v = msgid->u.as_long;
  128|       |      // Only fix if the value actually is positive
  129|      0|      if (v < 0) return;
  ------------------
  |  Branch (129:11): [True: 0, False: 0]
  ------------------
  130|      0|      msgid->type = PN_ULONG;
  131|      0|      msgid->u.as_ulong = v;
  132|      0|      return;
  133|      0|    }
  134|  49.0k|    default:
  ------------------
  |  Branch (134:5): [True: 49.0k, False: 0]
  ------------------
  135|  49.0k|      return;
  136|  49.0k|  }
  137|  49.0k|}
pn_message_finalize:
  140|   507k|{
  141|   507k|  pn_message_t *msg = (pn_message_t *) obj;
  142|   507k|  pn_free(msg->user_id);
  143|   507k|  pn_free(msg->address);
  144|   507k|  pn_free(msg->subject);
  145|   507k|  pn_free(msg->reply_to);
  146|   507k|  pn_free(msg->content_type);
  147|   507k|  pn_free(msg->content_encoding);
  148|   507k|  pn_free(msg->group_id);
  149|   507k|  pn_free(msg->reply_to_group_id);
  150|   507k|  pni_msgid_clear(&msg->id);
  151|   507k|  pni_msgid_clear(&msg->correlation_id);
  152|   507k|  if (msg->id_deprecated) pn_data_free(msg->id_deprecated);
  ------------------
  |  Branch (152:7): [True: 0, False: 507k]
  ------------------
  153|   507k|  if (msg->correlation_id_deprecated) pn_data_free(msg->correlation_id_deprecated);
  ------------------
  |  Branch (153:7): [True: 0, False: 507k]
  ------------------
  154|   507k|  pn_data_free(msg->instructions);
  155|   507k|  pn_data_free(msg->annotations);
  156|   507k|  pn_data_free(msg->properties);
  157|   507k|  pn_data_free(msg->body);
  158|   507k|  pn_error_free(msg->error);
  159|   507k|}
pn_message:
  360|   507k|pn_message_t *pn_message(void) {
  361|   507k|  return pni_message_new(sizeof(pn_message_t));
  362|   507k|}
pn_message_free:
  379|   507k|{
  380|   507k|  pn_free(msg);
  381|   507k|}
pn_message_set_id:
  522|  24.5k|{
  523|  24.5k|  assert(msg);
  524|  24.5k|  if (msg->id_deprecated) {
  ------------------
  |  Branch (524:7): [True: 0, False: 24.5k]
  ------------------
  525|      0|    pn_data_rewind(msg->id_deprecated);
  526|      0|    pn_data_put_atom(msg->id_deprecated, id);
  527|  24.5k|  } else {
  528|  24.5k|    pni_msgid_clear(&msg->id);
  529|  24.5k|    msg->id = id;
  530|  24.5k|    pni_msgid_validate_intern(&msg->id);
  531|  24.5k|  }
  532|  24.5k|  return 0;
  533|  24.5k|}
pn_message_set_correlation_id:
  613|  24.5k|{
  614|  24.5k|  assert(msg);
  615|  24.5k|  if (msg->correlation_id_deprecated) {
  ------------------
  |  Branch (615:7): [True: 0, False: 24.5k]
  ------------------
  616|      0|    pn_data_rewind(msg->correlation_id_deprecated);
  617|      0|    pn_data_put_atom(msg->correlation_id_deprecated, id);
  618|  24.5k|  } else {
  619|  24.5k|    pni_msgid_clear(&msg->correlation_id);
  620|  24.5k|    msg->correlation_id = id;
  621|  24.5k|    pni_msgid_validate_intern(&msg->correlation_id);
  622|  24.5k|  }
  623|  24.5k|  return 0;
  624|  24.5k|}
pn_message_decode:
  708|   507k|{
  709|   507k|  assert(msg && bytes && size);
  710|       |
  711|   507k|  pn_bytes_t msg_bytes = {.size=size, .start=bytes};
  712|  1.18M|  while (msg_bytes.size) {
  ------------------
  |  Branch (712:10): [True: 675k, False: 507k]
  ------------------
  713|   675k|    bool scanned;
  714|   675k|    uint64_t desc;
  715|   675k|    size_t section_size = pn_amqp_decode_DQLq(msg_bytes, &scanned, &desc);
  716|   675k|    if (!scanned) {
  ------------------
  |  Branch (716:9): [True: 632k, False: 43.7k]
  ------------------
  717|   632k|      desc = 0;
  718|   632k|    }
  719|       |
  720|   675k|    switch (desc) {
  721|  7.90k|      case HEADER: {
  ------------------
  |  |  161|  7.90k|#define HEADER ((uint64_t) 112)
  ------------------
  |  Branch (721:7): [True: 7.90k, False: 667k]
  ------------------
  722|  7.90k|        bool priority_q;
  723|  7.90k|        uint8_t priority;
  724|  7.90k|        pn_amqp_decode_DqEoQBIoIe(msg_bytes,
  725|  7.90k|                                  &msg->durable,
  726|  7.90k|                                  &priority_q, &priority,
  727|  7.90k|                                  &msg->ttl,
  728|  7.90k|                                  &msg->first_acquirer,
  729|  7.90k|                                  &msg->delivery_count);
  730|  7.90k|        msg->priority = priority_q ? priority : HEADER_PRIORITY_DEFAULT;
  ------------------
  |  |   79|  15.7k|#define HEADER_PRIORITY_DEFAULT (4) /* ubyte */
  ------------------
  |  Branch (730:25): [True: 69, False: 7.83k]
  ------------------
  731|  7.90k|        break;
  732|      0|      }
  733|  24.5k|      case PROPERTIES: {
  ------------------
  |  |  163|  24.5k|#define PROPERTIES ((uint64_t) 115)
  ------------------
  |  Branch (733:7): [True: 24.5k, False: 651k]
  ------------------
  734|  24.5k|        pn_bytes_t user_id, address, subject, reply_to, ctype, cencoding,
  735|  24.5k|                   group_id, reply_to_group_id;
  736|  24.5k|        pn_atom_t id;
  737|  24.5k|        pn_atom_t correlation_id;
  738|  24.5k|        pn_amqp_decode_DqEazSSSassttSISe(msg_bytes,  &id,
  739|  24.5k|                           &user_id, &address, &subject, &reply_to,
  740|  24.5k|                           &correlation_id, &ctype, &cencoding,
  741|  24.5k|                           &msg->expiry_time, &msg->creation_time, &group_id,
  742|  24.5k|                           &msg->group_sequence, &reply_to_group_id);
  743|  24.5k|        pni_msgid_fix_interop(&id);
  744|  24.5k|        pn_message_set_id(msg, id);
  745|  24.5k|        int err = pn_string_set_bytes(msg->user_id, user_id);
  746|  24.5k|        if (err) return pn_error_format(msg->error, err, "error setting user_id");
  ------------------
  |  Branch (746:13): [True: 0, False: 24.5k]
  ------------------
  747|  24.5k|        err = pn_string_setn(msg->address, address.start, address.size);
  748|  24.5k|        if (err) return pn_error_format(msg->error, err, "error setting address");
  ------------------
  |  Branch (748:13): [True: 0, False: 24.5k]
  ------------------
  749|  24.5k|        err = pn_string_setn(msg->subject, subject.start, subject.size);
  750|  24.5k|        if (err) return pn_error_format(msg->error, err, "error setting subject");
  ------------------
  |  Branch (750:13): [True: 0, False: 24.5k]
  ------------------
  751|  24.5k|        err = pn_string_setn(msg->reply_to, reply_to.start, reply_to.size);
  752|  24.5k|        if (err) return pn_error_format(msg->error, err, "error setting reply_to");
  ------------------
  |  Branch (752:13): [True: 0, False: 24.5k]
  ------------------
  753|  24.5k|        pni_msgid_fix_interop(&correlation_id);
  754|  24.5k|        pn_message_set_correlation_id(msg, correlation_id);
  755|  24.5k|        err = pn_string_setn(msg->content_type, ctype.start, ctype.size);
  756|  24.5k|        if (err) return pn_error_format(msg->error, err, "error setting content_type");
  ------------------
  |  Branch (756:13): [True: 0, False: 24.5k]
  ------------------
  757|  24.5k|        err = pn_string_setn(msg->content_encoding, cencoding.start,
  758|  24.5k|                             cencoding.size);
  759|  24.5k|        if (err) return pn_error_format(msg->error, err, "error setting content_encoding");
  ------------------
  |  Branch (759:13): [True: 0, False: 24.5k]
  ------------------
  760|  24.5k|        err = pn_string_setn(msg->group_id, group_id.start, group_id.size);
  761|  24.5k|        if (err) return pn_error_format(msg->error, err, "error setting group_id");
  ------------------
  |  Branch (761:13): [True: 0, False: 24.5k]
  ------------------
  762|  24.5k|        err = pn_string_setn(msg->reply_to_group_id, reply_to_group_id.start,
  763|  24.5k|                             reply_to_group_id.size);
  764|  24.5k|        if (err) return pn_error_format(msg->error, err, "error setting reply_to_group_id");
  ------------------
  |  Branch (764:13): [True: 0, False: 24.5k]
  ------------------
  765|  24.5k|        break;
  766|  24.5k|      }
  767|  24.5k|      case DELIVERY_ANNOTATIONS: {
  ------------------
  |  |  207|     56|#define DELIVERY_ANNOTATIONS ((uint64_t) 113)
  ------------------
  |  Branch (767:7): [True: 56, False: 675k]
  ------------------
  768|     56|        pn_data_clear(msg->instructions);
  769|     56|        pn_amqp_decode_DqC(msg_bytes, msg->instructions);
  770|     56|        pn_data_rewind(msg->instructions);
  771|     56|        break;
  772|  24.5k|      }
  773|    330|      case MESSAGE_ANNOTATIONS: {
  ------------------
  |  |  209|    330|#define MESSAGE_ANNOTATIONS ((uint64_t) 114)
  ------------------
  |  Branch (773:7): [True: 330, False: 675k]
  ------------------
  774|    330|        pn_data_clear(msg->annotations);
  775|    330|        pn_amqp_decode_DqC(msg_bytes, msg->annotations);
  776|    330|        pn_data_rewind(msg->annotations);
  777|    330|        break;
  778|  24.5k|      }
  779|    221|      case APPLICATION_PROPERTIES: {
  ------------------
  |  |  211|    221|#define APPLICATION_PROPERTIES ((uint64_t) 116)
  ------------------
  |  Branch (779:7): [True: 221, False: 675k]
  ------------------
  780|    221|        pn_data_clear(msg->properties);
  781|    221|        pn_amqp_decode_DqC(msg_bytes, msg->properties);
  782|    221|        pn_data_rewind(msg->properties);
  783|    221|        break;
  784|  24.5k|      }
  785|    258|      case DATA:
  ------------------
  |  |  213|    258|#define DATA ((uint64_t) 117)
  ------------------
  |  Branch (785:7): [True: 258, False: 675k]
  ------------------
  786|    502|      case AMQP_SEQUENCE: {
  ------------------
  |  |  215|    502|#define AMQP_SEQUENCE ((uint64_t) 118)
  ------------------
  |  Branch (786:7): [True: 244, False: 675k]
  ------------------
  787|    502|        msg->inferred = true;
  788|    502|        pn_data_clear(msg->body);
  789|    502|        pn_amqp_decode_DqC(msg_bytes, msg->body);
  790|    502|        pn_data_rewind(msg->body);
  791|    502|        break;
  792|    258|      }
  793|    111|      case AMQP_VALUE: {
  ------------------
  |  |  217|    111|#define AMQP_VALUE ((uint64_t) 119)
  ------------------
  |  Branch (793:7): [True: 111, False: 675k]
  ------------------
  794|    111|        msg->inferred = false;
  795|    111|        pn_data_clear(msg->body);
  796|    111|        pn_amqp_decode_DqC(msg_bytes, msg->body);
  797|    111|        pn_data_rewind(msg->body);
  798|    111|        break;
  799|    258|      }
  800|    209|      case FOOTER:
  ------------------
  |  |  219|    209|#define FOOTER ((uint64_t) 120)
  ------------------
  |  Branch (800:7): [True: 209, False: 675k]
  ------------------
  801|    209|        break;
  802|   642k|      default: {
  ------------------
  |  Branch (802:7): [True: 642k, False: 33.8k]
  ------------------
  803|   642k|        pn_data_clear(msg->body);
  804|   642k|        pn_data_decode(msg->body, msg_bytes.start, msg_bytes.size);
  805|   642k|        pn_data_rewind(msg->body);
  806|   642k|        break;
  807|    258|      }
  808|   675k|    }
  809|   675k|    msg_bytes = (pn_bytes_t){.size=msg_bytes.size-section_size, .start=msg_bytes.start+section_size};
  810|   675k|  }
  811|   507k|  return 0;
  812|   507k|}
pn_message_body:
 1027|   507k|{
 1028|   507k|  return msg ? msg->body : NULL;
  ------------------
  |  Branch (1028:10): [True: 507k, False: 0]
  ------------------
 1029|   507k|}
message.c:pni_message_new:
  326|   507k|{
  327|   507k|  static const pn_class_t clazz = PN_CLASS(pn_message);
  ------------------
  |  |   66|   507k|#define PN_CLASS(PREFIX) {                      \
  |  |   67|   507k|    #PREFIX,                                    \
  |  |   68|   507k|    CID_ ## PREFIX,                             \
  |  |   69|   507k|    NULL,                                       \
  |  |   70|   507k|    PREFIX ## _initialize,                      \
  |  |   71|   507k|    NULL,                                       \
  |  |   72|   507k|    NULL,                                       \
  |  |   73|   507k|    NULL,                                       \
  |  |   74|   507k|    PREFIX ## _finalize,                        \
  |  |   75|   507k|    NULL,                                       \
  |  |   76|   507k|    PREFIX ## _hashcode,                        \
  |  |   77|   507k|    PREFIX ## _compare,                         \
  |  |   78|   507k|    PREFIX ## _inspect                          \
  |  |   79|   507k|}
  ------------------
  328|   507k|  pn_message_t *msg = (pn_message_t *) pn_class_new(&clazz, size);
  329|   507k|  msg->durable = false;
  330|   507k|  msg->priority = HEADER_PRIORITY_DEFAULT;
  ------------------
  |  |   79|   507k|#define HEADER_PRIORITY_DEFAULT (4) /* ubyte */
  ------------------
  331|   507k|  msg->ttl = 0;
  332|   507k|  msg->first_acquirer = false;
  333|   507k|  msg->delivery_count = 0;
  334|   507k|  msg->id = (pn_atom_t){.type=PN_NULL};
  335|   507k|  msg->user_id = pn_string(NULL);
  336|   507k|  msg->address = pn_string(NULL);
  337|   507k|  msg->subject = pn_string(NULL);
  338|   507k|  msg->reply_to = pn_string(NULL);
  339|   507k|  msg->correlation_id = (pn_atom_t){.type=PN_NULL};
  340|   507k|  msg->content_type = pn_string(NULL);
  341|   507k|  msg->content_encoding = pn_string(NULL);
  342|   507k|  msg->expiry_time = 0;
  343|   507k|  msg->creation_time = 0;
  344|   507k|  msg->group_id = pn_string(NULL);
  345|   507k|  msg->group_sequence = 0;
  346|   507k|  msg->reply_to_group_id = pn_string(NULL);
  347|       |
  348|   507k|  msg->inferred = false;
  349|   507k|  msg->id_deprecated = NULL;
  350|   507k|  msg->correlation_id_deprecated = NULL;
  351|   507k|  msg->instructions = pn_data(16);
  352|   507k|  msg->annotations = pn_data(16);
  353|   507k|  msg->properties = pn_data(16);
  354|   507k|  msg->body = pn_data(16);
  355|       |
  356|   507k|  msg->error = pn_error();
  357|   507k|  return msg;
  358|   507k|}
message.c:pn_string_set_bytes:
  541|  24.5k|{
  542|  24.5k|  return pn_string_setn(string, bytes.start, bytes.size);
  543|  24.5k|}

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

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

pn_void_incref:
   46|  8.68M|void pn_void_incref(void* p) {}
pn_void_decref:
   47|  8.68M|void pn_void_decref(void* p) {}
pn_void_refcount:
   48|  8.68M|int pn_void_refcount(void *object) { return -1; }
pn_class_id:
   91|  2.55M|{
   92|  2.55M|  return clazz->cid;
   93|  2.55M|}
pn_object_incref:
  132|  20.6M|void pn_object_incref(void *object) {
  133|  20.6M|  pni_default_incref(object);
  134|  20.6M|}
pn_class_new:
  177|  48.9M|{
  178|  48.9M|  assert(clazz);
  179|  48.9M|  void *object = pni_class_new(clazz, size);
  180|  48.9M|  if (object && clazz->initialize) {
  ------------------
  |  Branch (180:7): [True: 48.9M, False: 0]
  |  Branch (180:17): [True: 6.74M, False: 42.2M]
  ------------------
  181|  6.74M|    clazz->initialize(object);
  182|  6.74M|  }
  183|  48.9M|  return object;
  184|  48.9M|}
pn_class_incref:
  187|  23.3M|{
  188|  23.3M|  if (object) {
  ------------------
  |  Branch (188:7): [True: 22.7M, False: 562k]
  ------------------
  189|  22.7M|    pni_class_incref(clazz, object);
  190|  22.7M|  }
  191|  23.3M|  return object;
  192|  23.3M|}
pn_class_decref:
  200|  33.4M|{
  201|  33.4M|  if (object) {
  ------------------
  |  Branch (201:7): [True: 17.7M, False: 15.6M]
  ------------------
  202|  17.7M|    pni_class_decref(clazz, object);
  203|  17.7M|    int rc = pni_class_refcount(clazz, object);
  204|  17.7M|    if (rc == 0) {
  ------------------
  |  Branch (204:9): [True: 5.04M, False: 12.6M]
  ------------------
  205|  5.04M|      if (clazz->finalize) {
  ------------------
  |  Branch (205:11): [True: 5.04M, False: 0]
  ------------------
  206|  5.04M|        clazz->finalize(object);
  207|       |        // check the refcount again in case the finalizer created a
  208|       |        // new reference
  209|  5.04M|        rc = pni_class_refcount(clazz, object);
  210|  5.04M|      }
  211|  5.04M|      if (rc == 0) {
  ------------------
  |  Branch (211:11): [True: 2.58M, False: 2.46M]
  ------------------
  212|  2.58M|        pni_class_free(clazz, object);
  213|  2.58M|        return 0;
  214|  2.58M|      }
  215|  12.6M|    } else {
  216|  12.6M|      return rc;
  217|  12.6M|    }
  218|  17.7M|  }
  219|       |
  220|  18.1M|  return 0;
  221|  33.4M|}
pn_class_compare:
  241|  1.22G|{
  242|  1.22G|  if (a == b) return 0;
  ------------------
  |  Branch (242:7): [True: 3.76M, False: 1.22G]
  ------------------
  243|       |
  244|  1.22G|  if (a && b) {
  ------------------
  |  Branch (244:7): [True: 1.22G, False: 0]
  |  Branch (244:12): [True: 1.22G, False: 0]
  ------------------
  245|  1.22G|    if (clazz->compare) {
  ------------------
  |  Branch (245:9): [True: 1.22G, False: 0]
  ------------------
  246|  1.22G|      return clazz->compare(a, b);
  247|  1.22G|    }
  248|  1.22G|  }
  249|      0|  return (intptr_t) a - (intptr_t) b;
  250|  1.22G|}
pn_class_equals:
  253|  1.22G|{
  254|  1.22G|  return pn_class_compare(clazz, a, b) == 0;
  255|  1.22G|}
pn_incref:
  271|  24.1M|{
  272|  24.1M|  if (object) {
  ------------------
  |  Branch (272:7): [True: 24.1M, False: 30.6k]
  ------------------
  273|  24.1M|    const pn_class_t *clazz = pni_head(object)->clazz;
  ------------------
  |  |   62|  24.1M|#define pni_head(PTR) \
  |  |   63|  24.1M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  274|  24.1M|    pni_class_incref(clazz, object);
  275|  24.1M|  }
  276|  24.1M|  return object;
  277|  24.1M|}
pn_decref:
  280|  38.5M|{
  281|  38.5M|  if (object) {
  ------------------
  |  Branch (281:7): [True: 35.9M, False: 2.58M]
  ------------------
  282|  35.9M|    const pn_class_t *clazz = pni_head(object)->clazz;
  ------------------
  |  |   62|  35.9M|#define pni_head(PTR) \
  |  |   63|  35.9M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  283|  35.9M|    pni_class_decref(clazz, object);
  284|  35.9M|    int rc = pni_class_refcount(clazz, object);
  285|  35.9M|    if (rc == 0) {
  ------------------
  |  Branch (285:9): [True: 19.1M, False: 16.7M]
  ------------------
  286|  19.1M|      if (clazz->finalize) {
  ------------------
  |  Branch (286:11): [True: 19.1M, False: 0]
  ------------------
  287|  19.1M|        clazz->finalize(object);
  288|       |        // check the refcount again in case the finalizer created a
  289|       |        // new reference
  290|  19.1M|        rc = pni_class_refcount(clazz, object);
  291|  19.1M|      }
  292|  19.1M|      if (rc == 0) {
  ------------------
  |  Branch (292:11): [True: 4.16M, False: 15.0M]
  ------------------
  293|  4.16M|        pni_class_free(clazz, object);
  294|  4.16M|        return 0;
  295|  4.16M|      }
  296|  19.1M|    } else {
  297|  16.7M|      return rc;
  298|  16.7M|    }
  299|  35.9M|  }
  300|  17.5M|  return 0;
  301|  38.5M|}
pn_refcount:
  304|  21.5M|{
  305|  21.5M|  assert(object);
  306|  21.5M|  const pn_class_t *clazz = pni_head(object)->clazz;
  ------------------
  |  |   62|  21.5M|#define pni_head(PTR) \
  |  |   63|  21.5M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  307|  21.5M|  return pni_class_refcount(clazz, object);
  308|  21.5M|}
pn_free:
  311|  58.1M|{
  312|  58.1M|  if (object) {
  ------------------
  |  Branch (312:7): [True: 42.3M, False: 15.8M]
  ------------------
  313|  42.3M|    const pn_class_t *clazz = pni_head(object)->clazz;
  ------------------
  |  |   62|  42.3M|#define pni_head(PTR) \
  |  |   63|  42.3M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  314|  42.3M|    int rc = pni_class_refcount(clazz, object);
  315|  42.3M|    assert(rc == 1 || rc == -1);
  316|  42.3M|    if (rc == 1) {
  ------------------
  |  Branch (316:9): [True: 42.3M, False: 0]
  ------------------
  317|  42.3M|      pni_class_decref(clazz, object);
  318|  42.3M|      assert(pni_class_refcount(clazz, object) == 0);
  319|  42.3M|      if (clazz->finalize) {
  ------------------
  |  Branch (319:11): [True: 42.3M, False: 0]
  ------------------
  320|  42.3M|        clazz->finalize(object);
  321|  42.3M|      }
  322|  42.3M|      if (pni_class_refcount(clazz, object) == 0) {
  ------------------
  |  Branch (322:11): [True: 42.2M, False: 51.0k]
  ------------------
  323|  42.2M|        pni_class_free(clazz, object);
  324|  42.2M|      }
  325|  42.3M|    } 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|  42.3M|  }
  332|  58.1M|}
pn_class:
  335|  64.1M|{
  336|  64.1M|  if (object) {
  ------------------
  |  Branch (336:7): [True: 64.1M, False: 0]
  ------------------
  337|  64.1M|    return pni_head(object)->clazz;
  ------------------
  |  |   62|  64.1M|#define pni_head(PTR) \
  |  |   63|  64.1M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  338|  64.1M|  } else {
  339|      0|    return PN_DEFAULT;
  340|      0|  }
  341|  64.1M|}
pn_compare:
  357|  1.22G|{
  358|  1.22G|  if (a == b) return 0;
  ------------------
  |  Branch (358:7): [True: 0, False: 1.22G]
  ------------------
  359|       |
  360|  1.22G|  if (a && b) {
  ------------------
  |  Branch (360:7): [True: 1.22G, False: 0]
  |  Branch (360:12): [True: 1.22G, False: 0]
  ------------------
  361|  1.22G|    const pn_class_t *clazz = pni_head(a)->clazz;
  ------------------
  |  |   62|  1.22G|#define pni_head(PTR) \
  |  |   63|  1.22G|(((pni_head_t *) (PTR)) - 1)
  ------------------
  362|  1.22G|    if (clazz->compare) {
  ------------------
  |  Branch (362:9): [True: 0, False: 1.22G]
  ------------------
  363|      0|      return clazz->compare(a, b);
  364|      0|    }
  365|  1.22G|  }
  366|  1.22G|  return (intptr_t) a - (intptr_t) b;
  367|  1.22G|}
pn_finspect:
  398|   507k|{
  399|   507k|  if (!object) {
  ------------------
  |  Branch (399:7): [True: 0, False: 507k]
  ------------------
  400|      0|    pn_fixed_string_addf(dst, "pn_object<%p>", object);
  401|      0|    return;
  402|      0|  }
  403|       |
  404|   507k|  const pn_class_t *clazz = pni_head(object)->clazz;
  ------------------
  |  |   62|   507k|#define pni_head(PTR) \
  |  |   63|   507k|(((pni_head_t *) (PTR)) - 1)
  ------------------
  405|       |
  406|   507k|  if (clazz->inspect) {
  ------------------
  |  Branch (406:7): [True: 507k, False: 0]
  ------------------
  407|   507k|    clazz->inspect(object, dst);
  408|   507k|    return;
  409|   507k|  }
  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|   507k|}
pn_tostring:
  417|   507k|{
  418|   507k|  char buf[1024];
  419|   507k|  pn_fixed_string_t s = pn_fixed_string(buf, sizeof(buf));
  420|   507k|  pn_finspect(object, &s);
  421|   507k|  pn_fixed_string_terminate(&s);
  422|       |
  423|   507k|  int l = s.position+1; // include final null
  424|   507k|  char *r = malloc(l);
  425|   507k|  strncpy(r, buf, l);
  426|   507k|  return r;
  427|   507k|}
object.c:pni_default_incref:
  107|  38.3M|static inline void pni_default_incref(void *object) {
  108|  38.3M|  if (object) {
  ------------------
  |  Branch (108:7): [True: 38.3M, False: 0]
  ------------------
  109|  38.3M|    pni_head(object)->refcount++;
  ------------------
  |  |   62|  38.3M|#define pni_head(PTR) \
  |  |   63|  38.3M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  110|  38.3M|  }
  111|  38.3M|}
object.c:pni_class_new:
  136|  48.9M|static inline void *pni_class_new(const pn_class_t *clazz, size_t size) {
  137|  48.9M|  if (clazz->newinst) {
  ------------------
  |  Branch (137:7): [True: 0, False: 48.9M]
  ------------------
  138|      0|    return clazz->newinst(clazz, size);
  139|  48.9M|  } else {
  140|  48.9M|    return pni_default_new(clazz, size);
  141|  48.9M|  }
  142|  48.9M|}
object.c:pni_default_new:
   96|  48.9M|{
   97|  48.9M|  void *object = NULL;
   98|  48.9M|  pni_head_t *head = (pni_head_t *) pni_mem_zallocate(clazz, sizeof(pni_head_t) + size);
   99|  48.9M|  if (head != NULL) {
  ------------------
  |  Branch (99:7): [True: 48.9M, False: 0]
  ------------------
  100|  48.9M|    object = head + 1;
  101|  48.9M|    head->clazz = clazz;
  102|  48.9M|    head->refcount = 1;
  103|  48.9M|  }
  104|  48.9M|  return object;
  105|  48.9M|}
object.c:pni_class_incref:
  144|  46.9M|static inline void pni_class_incref(const pn_class_t *clazz, void *object) {
  145|  46.9M|  if (clazz->incref) {
  ------------------
  |  Branch (145:7): [True: 29.2M, False: 17.7M]
  ------------------
  146|  29.2M|    clazz->incref(object);
  147|  29.2M|  } else {
  148|  17.7M|    pni_default_incref(object);
  149|  17.7M|  }
  150|  46.9M|}
object.c:pni_class_refcount:
  160|   184M|static inline int pni_class_refcount(const pn_class_t *clazz, void *object) {
  161|   184M|  if (clazz->refcount) {
  ------------------
  |  Branch (161:7): [True: 8.68M, False: 175M]
  ------------------
  162|  8.68M|    return clazz->refcount(object);
  163|   175M|  } else {
  164|   175M|    return pni_default_refcount(object);
  165|   175M|  }
  166|   184M|}
object.c:pni_default_refcount:
  114|   175M|{
  115|   175M|  assert(object);
  116|   175M|  return pni_head(object)->refcount;
  ------------------
  |  |   62|   175M|#define pni_head(PTR) \
  |  |   63|   175M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  117|   175M|}
object.c:pni_class_decref:
  152|  96.0M|static inline void pni_class_decref(const pn_class_t *clazz, void *object) {
  153|  96.0M|  if (clazz->decref) {
  ------------------
  |  Branch (153:7): [True: 8.68M, False: 87.3M]
  ------------------
  154|  8.68M|    clazz->decref(object);
  155|  87.3M|  } else {
  156|  87.3M|    pni_default_decref(object);
  157|  87.3M|  }
  158|  96.0M|}
object.c:pni_default_decref:
  120|  87.3M|{
  121|  87.3M|  pni_head_t *head = pni_head(object);
  ------------------
  |  |   62|  87.3M|#define pni_head(PTR) \
  |  |   63|  87.3M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  122|  87.3M|  assert(head->refcount > 0);
  123|  87.3M|  head->refcount--;
  124|  87.3M|}
object.c:pni_class_free:
  168|  48.9M|static inline void pni_class_free(const pn_class_t *clazz, void *object) {
  169|  48.9M|  if (clazz->free) {
  ------------------
  |  Branch (169:7): [True: 0, False: 48.9M]
  ------------------
  170|      0|    clazz->free(object);
  171|  48.9M|  } else {
  172|  48.9M|    pni_default_free(object);
  173|  48.9M|  }
  174|  48.9M|}
object.c:pni_default_free:
  127|  48.9M|{
  128|  48.9M|  pni_head_t *head = pni_head(object);
  ------------------
  |  |   62|  48.9M|#define pni_head(PTR) \
  |  |   63|  48.9M|(((pni_head_t *) (PTR)) - 1)
  ------------------
  129|  48.9M|  pni_mem_deallocate(head->clazz, head);
  130|  48.9M|}

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

pn_string:
  102|  10.6M|{
  103|  10.6M|  return pn_stringn(bytes, bytes ? strlen(bytes) : 0);
  ------------------
  |  Branch (103:28): [True: 1.30M, False: 9.35M]
  ------------------
  104|  10.6M|}
pn_stringn:
  110|  10.6M|{
  111|  10.6M|  static const pn_class_t clazz = PN_CLASS(pn_string);
  ------------------
  |  |   66|  10.6M|#define PN_CLASS(PREFIX) {                      \
  |  |   67|  10.6M|    #PREFIX,                                    \
  |  |   68|  10.6M|    CID_ ## PREFIX,                             \
  |  |   69|  10.6M|    NULL,                                       \
  |  |   70|  10.6M|    PREFIX ## _initialize,                      \
  |  |   71|  10.6M|    NULL,                                       \
  |  |   72|  10.6M|    NULL,                                       \
  |  |   73|  10.6M|    NULL,                                       \
  |  |   74|  10.6M|    PREFIX ## _finalize,                        \
  |  |   75|  10.6M|    NULL,                                       \
  |  |   76|  10.6M|    PREFIX ## _hashcode,                        \
  |  |   77|  10.6M|    PREFIX ## _compare,                         \
  |  |   78|  10.6M|    PREFIX ## _inspect                          \
  |  |   79|  10.6M|}
  ------------------
  112|  10.6M|  pn_string_t *string = (pn_string_t *) pn_class_new(&clazz, sizeof(pn_string_t));
  113|  10.6M|  string->capacity = n ? n * sizeof(char) : 16;
  ------------------
  |  Branch (113:22): [True: 187k, False: 10.4M]
  ------------------
  114|  10.6M|  string->bytes = (char *) pni_mem_suballocate(&clazz, string, string->capacity);
  115|  10.6M|  pn_string_setn(string, bytes, n);
  116|  10.6M|  return string;
  117|  10.6M|}
pn_string_get:
  120|   444M|{
  121|   444M|  assert(string);
  122|   444M|  if (string->size == PNI_NULL_SIZE) {
  ------------------
  |  |   35|   444M|#define PNI_NULL_SIZE (-1)
  ------------------
  |  Branch (122:7): [True: 139k, False: 444M]
  ------------------
  123|   139k|    return NULL;
  124|   444M|  } else {
  125|   444M|    return string->bytes;
  126|   444M|  }
  127|   444M|}
pn_string_size:
  130|   444M|{
  131|   444M|  assert(string);
  132|   444M|  if (string->size == PNI_NULL_SIZE) {
  ------------------
  |  |   35|   444M|#define PNI_NULL_SIZE (-1)
  ------------------
  |  Branch (132:7): [True: 92.0k, False: 444M]
  ------------------
  133|  92.0k|    return 0;
  134|   444M|  } else {
  135|   444M|    return string->size;
  136|   444M|  }
  137|   444M|}
pn_string_set:
  140|   177k|{
  141|   177k|  return pn_string_setn(string, bytes, bytes ? strlen(bytes) : 0);
  ------------------
  |  Branch (141:40): [True: 30.6k, False: 147k]
  ------------------
  142|   177k|}
pn_string_grow:
  145|  11.2M|{
  146|  11.2M|  bool grow = false;
  147|  11.4M|  while (string->capacity < (capacity*sizeof(char) + 1)) {
  ------------------
  |  Branch (147:10): [True: 218k, False: 11.2M]
  ------------------
  148|   218k|    string->capacity *= 2;
  149|   218k|    grow = true;
  150|   218k|  }
  151|       |
  152|  11.2M|  if (grow) {
  ------------------
  |  Branch (152:7): [True: 218k, False: 11.0M]
  ------------------
  153|   218k|    char *growed = (char *) pni_mem_subreallocate(pn_class(string), string, string->bytes, string->capacity);
  154|   218k|    if (growed) {
  ------------------
  |  Branch (154:9): [True: 218k, False: 0]
  ------------------
  155|   218k|      string->bytes = growed;
  156|   218k|    } else {
  157|      0|      return PN_ERR;
  ------------------
  |  |   48|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
  158|      0|    }
  159|   218k|  }
  160|       |
  161|  11.2M|  return 0;
  162|  11.2M|}
pn_string_setn:
  165|  11.2M|{
  166|  11.2M|  int err = pn_string_grow(string, n);
  167|  11.2M|  if (err) return err;
  ------------------
  |  Branch (167:7): [True: 0, False: 11.2M]
  ------------------
  168|       |
  169|  11.2M|  if (bytes) {
  ------------------
  |  Branch (169:7): [True: 1.36M, False: 9.86M]
  ------------------
  170|  1.36M|    memcpy(string->bytes, bytes, n*sizeof(char));
  171|  1.36M|    string->bytes[n] = '\0';
  172|  1.36M|    string->size = n;
  173|  9.86M|  } else {
  174|  9.86M|    string->size = PNI_NULL_SIZE;
  ------------------
  |  |   35|  9.86M|#define PNI_NULL_SIZE (-1)
  ------------------
  175|  9.86M|  }
  176|       |
  177|  11.2M|  return 0;
  178|  11.2M|}
pn_string_clear:
  193|   116k|{
  194|   116k|  pn_string_set(string, NULL);
  195|   116k|}
string.c:pn_string_finalize:
   44|  10.6M|{
   45|  10.6M|  pn_string_t *string = (pn_string_t *) object;
   46|  10.6M|  pni_mem_subdeallocate(pn_class(string), string, string->bytes);
   47|  10.6M|}

pn_delivery_map_init:
   78|  1.24M|{
   79|  1.24M|  db->deliveries = pn_hash(PN_WEAKREF, 0, 0.75);
   80|  1.24M|  db->next = next;
   81|  1.24M|}
pn_delivery_map_free:
   84|  1.24M|{
   85|  1.24M|  pn_free(db->deliveries);
   86|  1.24M|}
pn_delivery_map_del:
  116|  2.06M|{
  117|  2.06M|  if (delivery->state.init) {
  ------------------
  |  Branch (117:7): [True: 1.03M, False: 1.03M]
  ------------------
  118|  1.03M|    delivery->state.init = false;
  119|  1.03M|    delivery->state.sending = false;
  120|  1.03M|    delivery->state.sent = false;
  121|  1.03M|    pn_hash_del(db->deliveries, pni_sequence_make_hash(delivery->state.id) );
  122|  1.03M|  }
  123|  2.06M|}
pn_transport:
  546|  30.6k|{
  547|  30.6k|#define pn_transport_free NULL
  548|  30.6k|  static const pn_class_t clazz = PN_METACLASS(pn_transport);
  ------------------
  |  |   81|  30.6k|#define PN_METACLASS(PREFIX) {                  \
  |  |   82|  30.6k|    #PREFIX,                                    \
  |  |   83|  30.6k|    CID_ ## PREFIX,                             \
  |  |   84|  30.6k|    PREFIX ## _new,                             \
  |  |   85|  30.6k|    PREFIX ## _initialize,                      \
  |  |   86|  30.6k|    PREFIX ## _incref,                          \
  |  |   87|  30.6k|    PREFIX ## _decref,                          \
  |  |   88|  30.6k|    PREFIX ## _refcount,                        \
  |  |   89|  30.6k|    PREFIX ## _finalize,                        \
  |  |   90|  30.6k|    PREFIX ## _free,                            \
  |  |   91|  30.6k|    PREFIX ## _hashcode,                        \
  |  |   92|  30.6k|    PREFIX ## _compare,                         \
  |  |   93|  30.6k|    PREFIX ## _inspect                          \
  |  |   94|  30.6k|}
  ------------------
  549|  30.6k|#undef pn_transport_free
  550|  30.6k|  pn_transport_t *transport =
  551|  30.6k|    (pn_transport_t *) pn_class_new(&clazz, sizeof(pn_transport_t));
  552|  30.6k|  if (!transport) return NULL;
  ------------------
  |  Branch (552:7): [True: 0, False: 30.6k]
  ------------------
  553|       |
  554|  30.6k|  transport->output_buf = (char *) pni_mem_suballocate(&clazz, transport, transport->output_size);
  555|  30.6k|  if (!transport->output_buf) {
  ------------------
  |  Branch (555:7): [True: 0, False: 30.6k]
  ------------------
  556|      0|    pn_transport_free(transport);
  557|      0|    return NULL;
  558|      0|  }
  559|       |
  560|  30.6k|  transport->input_buf = (char *) pni_mem_suballocate(&clazz, transport, transport->input_size);
  561|  30.6k|  if (!transport->input_buf) {
  ------------------
  |  Branch (561:7): [True: 0, False: 30.6k]
  ------------------
  562|      0|    pn_transport_free(transport);
  563|      0|    return NULL;
  564|      0|  }
  565|       |
  566|  30.6k|  transport->output_buffer = pn_buffer(4*1024);
  567|  30.6k|  if (!transport->output_buffer) {
  ------------------
  |  Branch (567:7): [True: 0, False: 30.6k]
  ------------------
  568|      0|    pn_transport_free(transport);
  569|      0|    return NULL;
  570|      0|  }
  571|       |
  572|  30.6k|  return transport;
  573|  30.6k|}
pn_transport_free:
  624|  30.6k|{
  625|  30.6k|  if (!transport) return;
  ------------------
  |  Branch (625:7): [True: 0, False: 30.6k]
  ------------------
  626|  30.6k|  assert(!transport->freed);
  627|  30.6k|  transport->freed = true;
  628|  30.6k|  pn_decref(transport);
  629|  30.6k|}
pn_transport_bind:
  677|  30.6k|{
  678|  30.6k|  assert(transport);
  679|  30.6k|  assert(connection);
  680|       |
  681|  30.6k|  if (transport->connection) return PN_STATE_ERR;
  ------------------
  |  |   51|      0|#define PN_STATE_ERR (-5)      /**< State error */
  ------------------
  |  Branch (681:7): [True: 0, False: 30.6k]
  ------------------
  682|  30.6k|  if (connection->transport) return PN_STATE_ERR;
  ------------------
  |  |   51|      0|#define PN_STATE_ERR (-5)      /**< State error */
  ------------------
  |  Branch (682:7): [True: 0, False: 30.6k]
  ------------------
  683|       |
  684|  30.6k|  transport->connection = connection;
  685|  30.6k|  connection->transport = transport;
  686|       |
  687|  30.6k|  pn_incref(connection);
  688|       |
  689|  30.6k|  pn_connection_bound(connection);
  690|       |
  691|       |  // set the hostname/user/password
  692|  30.6k|  if (pn_string_size(connection->auth_user) || pn_string_size(connection->authzid)) {
  ------------------
  |  Branch (692:7): [True: 0, False: 30.6k]
  |  Branch (692:48): [True: 0, False: 30.6k]
  ------------------
  693|      0|    pn_sasl(transport);
  694|      0|    pni_sasl_set_user_password(transport,
  695|      0|                               pn_string_get(connection->auth_user),
  696|      0|                               pn_string_get(connection->authzid),
  697|      0|                               pn_string_get(connection->auth_password));
  698|      0|  }
  699|       |
  700|  30.6k|  if (pn_string_size(connection->hostname)) {
  ------------------
  |  Branch (700:7): [True: 0, False: 30.6k]
  ------------------
  701|      0|      if (transport->sasl) {
  ------------------
  |  Branch (701:11): [True: 0, False: 0]
  ------------------
  702|      0|          pni_sasl_set_remote_hostname(transport, pn_string_get(connection->hostname));
  703|      0|      }
  704|       |
  705|       |      // be sure not to overwrite a hostname already set by the user via
  706|       |      // pn_ssl_set_peer_hostname() called before the bind
  707|      0|      if (transport->ssl) {
  ------------------
  |  Branch (707:11): [True: 0, False: 0]
  ------------------
  708|      0|          size_t name_len = 0;
  709|      0|          pn_ssl_get_peer_hostname((pn_ssl_t*) transport, NULL, &name_len);
  710|      0|          if (name_len == 0) {
  ------------------
  |  Branch (710:15): [True: 0, False: 0]
  ------------------
  711|      0|              pn_ssl_set_peer_hostname((pn_ssl_t*) transport, pn_string_get(connection->hostname));
  712|      0|          }
  713|      0|      }
  714|      0|  }
  715|       |
  716|  30.6k|  if (transport->open_rcvd) {
  ------------------
  |  Branch (716:7): [True: 0, False: 30.6k]
  ------------------
  717|      0|    PN_SET_REMOTE(connection->endpoint.state, PN_REMOTE_ACTIVE);
  ------------------
  |  |  358|      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)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  718|      0|    pni_post_remote_open_events(transport, connection);
  719|      0|    transport->halt = false;
  720|      0|    transport_consume(transport);        // blech - testBindAfterOpen
  721|      0|  }
  722|       |
  723|  30.6k|  return 0;
  724|  30.6k|}
pni_transport_unbind_handles:
  727|   122k|{
  728|   178k|  for (pn_handle_t h = pn_hash_head(handles); h; h = pn_hash_next(handles, h)) {
  ------------------
  |  Branch (728:47): [True: 55.9k, False: 122k]
  ------------------
  729|  55.9k|    uintptr_t key = pn_hash_key(handles, h);
  730|  55.9k|    pn_link_t *link = (pn_link_t *) pn_hash_value(handles, h);
  731|  55.9k|    if (reset_state) {
  ------------------
  |  Branch (731:9): [True: 53.0k, False: 2.87k]
  ------------------
  732|  53.0k|      pn_link_unbound(link);
  733|  53.0k|    }
  734|  55.9k|    pn_ep_decref(&link->endpoint);
  735|  55.9k|    pn_hash_del(handles, key);
  736|  55.9k|  }
  737|   122k|}
pni_transport_unbind_channels:
  740|  61.3k|{
  741|   120k|  for (pn_handle_t h = pn_hash_head(channels); h; h = pn_hash_next(channels, h)) {
  ------------------
  |  Branch (741:48): [True: 59.5k, False: 61.3k]
  ------------------
  742|  59.5k|    uintptr_t key = pn_hash_key(channels, h);
  743|  59.5k|    pn_session_t *ssn = (pn_session_t *) pn_hash_value(channels, h);
  744|  59.5k|    pni_delivery_map_clear(&ssn->state.incoming);
  745|  59.5k|    pni_delivery_map_clear(&ssn->state.outgoing);
  746|  59.5k|    pni_transport_unbind_handles(ssn->state.local_handles, true);
  747|  59.5k|    pni_transport_unbind_handles(ssn->state.remote_handles, true);
  748|  59.5k|    pn_session_unbound(ssn);
  749|  59.5k|    pn_ep_decref(&ssn->endpoint);
  750|  59.5k|    pn_hash_del(channels, key);
  751|  59.5k|  }
  752|  61.3k|}
pn_transport_unbind:
  755|  61.3k|{
  756|  61.3k|  assert(transport);
  757|  61.3k|  if (!transport->connection) return 0;
  ------------------
  |  Branch (757:7): [True: 30.6k, False: 30.6k]
  ------------------
  758|       |
  759|       |
  760|  30.6k|  pn_connection_t *conn = transport->connection;
  761|  30.6k|  transport->connection = NULL;
  762|  30.6k|  bool was_referenced = transport->referenced;
  763|       |
  764|  30.6k|  pn_collector_put_object(conn->collector, conn, PN_CONNECTION_UNBOUND);
  765|       |
  766|       |  // XXX: what happens if the endpoints are freed before we get here?
  767|  30.6k|  pn_session_t *ssn = pn_session_head(conn, 0);
  768|   652k|  while (ssn) {
  ------------------
  |  Branch (768:10): [True: 622k, False: 30.6k]
  ------------------
  769|   622k|    pni_delivery_map_clear(&ssn->state.incoming);
  770|   622k|    pni_delivery_map_clear(&ssn->state.outgoing);
  771|   622k|    ssn = pn_session_next(ssn, 0);
  772|   622k|  }
  773|       |
  774|  30.6k|  pn_endpoint_t *endpoint = conn->endpoint_head;
  775|  1.94M|  while (endpoint) {
  ------------------
  |  Branch (775:10): [True: 1.91M, False: 30.6k]
  ------------------
  776|  1.91M|    pn_condition_clear(&endpoint->remote_condition);
  777|  1.91M|    pn_modified(conn, endpoint, true);
  778|  1.91M|    endpoint = endpoint->endpoint_next;
  779|  1.91M|  }
  780|       |
  781|  30.6k|  pni_transport_unbind_channels(transport->local_channels);
  782|  30.6k|  pni_transport_unbind_channels(transport->remote_channels);
  783|       |
  784|  30.6k|  pn_connection_unbound(conn);
  785|  30.6k|  if (was_referenced) {
  ------------------
  |  Branch (785:7): [True: 30.6k, False: 0]
  ------------------
  786|  30.6k|    pn_decref(conn);
  787|  30.6k|  }
  788|  30.6k|  return 0;
  789|  61.3k|}
pn_transport_condition:
  805|  8.27k|{
  806|  8.27k|  assert(transport);
  807|  8.27k|  return &transport->condition;
  808|  8.27k|}
pni_disposition_batchable:
  840|   561k|{
  841|   561k|  switch (disposition->type) {
  842|   561k|  case PN_ACCEPTED:
  ------------------
  |  |   66|   561k|#define PN_ACCEPTED (0x0000000000000024)
  ------------------
  |  Branch (842:3): [True: 561k, False: 0]
  ------------------
  843|   561k|    return true;
  844|      0|  case PN_RELEASED:
  ------------------
  |  |   82|      0|#define PN_RELEASED (0x0000000000000026)
  ------------------
  |  Branch (844:3): [True: 0, False: 561k]
  ------------------
  845|      0|    return true;
  846|      0|  default:
  ------------------
  |  Branch (846:3): [True: 0, False: 561k]
  ------------------
  847|      0|    return false;
  848|   561k|  }
  849|   561k|}
pn_do_error:
  994|  20.9k|{
  995|  20.9k|  va_list ap;
  996|  20.9k|  va_start(ap, fmt);
  997|  20.9k|  char buf[1024];
  998|  20.9k|  if (fmt) {
  ------------------
  |  Branch (998:7): [True: 20.9k, False: 0]
  ------------------
  999|       |    // XXX: result
 1000|  20.9k|    vsnprintf(buf, 1024, fmt, ap);
 1001|  20.9k|  } else {
 1002|      0|    buf[0] = '\0';
 1003|      0|  }
 1004|  20.9k|  va_end(ap);
 1005|  20.9k|  pn_condition_t *cond = &transport->condition;
 1006|  20.9k|  if (!pn_condition_is_set(cond)) {
  ------------------
  |  Branch (1006:7): [True: 20.9k, False: 0]
  ------------------
 1007|  20.9k|    pn_condition_set_name(cond, condition);
 1008|  20.9k|    if (fmt) {
  ------------------
  |  Branch (1008:9): [True: 20.9k, False: 0]
  ------------------
 1009|  20.9k|      pn_condition_set_description(cond, buf);
 1010|  20.9k|    }
 1011|  20.9k|  } else {
 1012|      0|    const char *first = pn_condition_get_description(cond);
 1013|      0|    if (first && fmt) {
  ------------------
  |  Branch (1013:9): [True: 0, False: 0]
  |  Branch (1013:18): [True: 0, False: 0]
  ------------------
 1014|      0|      char extended[2048];
 1015|      0|      snprintf(extended, 2048, "%s (%s)", first, buf);
 1016|      0|      pn_condition_set_description(cond, extended);
 1017|      0|    } else if (fmt) {
  ------------------
  |  Branch (1017:16): [True: 0, False: 0]
  ------------------
 1018|      0|      pn_condition_set_description(cond, buf);
 1019|      0|    }
 1020|      0|  }
 1021|  20.9k|  pn_collector_t *collector = pni_transport_collector(transport);
 1022|  20.9k|  pn_collector_put_object(collector, transport, PN_TRANSPORT_ERROR);
 1023|       |  // Special case being called with no condition and no fmt to log the existing error condition
 1024|  20.9k|  if (fmt && condition) {
  ------------------
  |  Branch (1024:7): [True: 20.9k, False: 0]
  |  Branch (1024:14): [True: 20.9k, False: 0]
  ------------------
 1025|  20.9k|    PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "%s %s", condition, buf);
  ------------------
  |  |   54|  20.9k|    do { \
  |  |   55|  20.9k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   51|  20.9k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  |  |  Branch (51:38): [True: 20.9k, False: 0]
  |  |  |  |  |  Branch (51:73): [True: 0, False: 20.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|  20.9k|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   57|  20.9k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (57:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1026|  20.9k|  } else {
 1027|      0|    PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "%s %s",
  ------------------
  |  |   54|      0|    do { \
  |  |   55|      0|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   51|      0|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  |  |  Branch (51:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (51:73): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|      0|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   57|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (57:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1028|      0|           pn_condition_get_name(cond), pn_condition_get_description(cond));
 1029|      0|  }
 1030|       |
 1031|  83.6k|  for (int i = 0; i<PN_IO_LAYER_CT; ++i) {
  ------------------
  |  |  151|  83.6k|#define PN_IO_LAYER_CT 3
  ------------------
  |  Branch (1031:19): [True: 62.7k, False: 20.9k]
  ------------------
 1032|  62.7k|    if (transport->io_layers[i] && transport->io_layers[i]->handle_error)
  ------------------
  |  Branch (1032:9): [True: 20.9k, False: 41.8k]
  |  Branch (1032:36): [True: 20.9k, False: 0]
  ------------------
 1033|  20.9k|        transport->io_layers[i]->handle_error(transport, i);
 1034|  62.7k|  }
 1035|       |
 1036|  20.9k|  pni_close_tail(transport);
 1037|  20.9k|  return PN_ERR;
  ------------------
  |  |   48|  20.9k|#define PN_ERR (-2)            /**< General error */
  ------------------
 1038|  20.9k|}
pn_do_open:
 1046|   156k|{
 1047|   156k|  bool container_q, hostname_q, remote_channel_max_q, remote_max_frame_q;
 1048|   156k|  uint16_t remote_channel_max;
 1049|   156k|  uint32_t remote_max_frame;
 1050|   156k|  pn_bytes_t remote_container, remote_hostname;
 1051|   156k|  pn_data_clear(transport->remote_offered_capabilities);
 1052|   156k|  pn_data_clear(transport->remote_desired_capabilities);
 1053|   156k|  pn_data_clear(transport->remote_properties);
 1054|       |
 1055|   156k|  pn_amqp_decode_DqEQSQSQIQHIqqCCCe(payload,
 1056|   156k|                                    &container_q, &remote_container,
 1057|   156k|                                    &hostname_q, &remote_hostname,
 1058|   156k|                                    &remote_max_frame_q, &remote_max_frame,
 1059|   156k|                                    &remote_channel_max_q, &remote_channel_max,
 1060|   156k|                                    &transport->remote_idle_timeout,
 1061|   156k|                                    transport->remote_offered_capabilities,
 1062|   156k|                                    transport->remote_desired_capabilities,
 1063|   156k|                                    transport->remote_properties);
 1064|       |  /*
 1065|       |   * The default value is already stored in the variable.
 1066|       |   * But the scanner zeroes out values if it does not
 1067|       |   * find them in the args, so don't give the variable
 1068|       |   * directly to the scanner.
 1069|       |   */
 1070|   156k|  transport->remote_channel_max = remote_channel_max_q ? remote_channel_max : OPEN_CHANNEL_MAX_DEFAULT;
  ------------------
  |  |   11|   312k|#define OPEN_CHANNEL_MAX_DEFAULT (65535) /* ushort */
  ------------------
  |  Branch (1070:35): [True: 533, False: 156k]
  ------------------
 1071|   156k|  transport->remote_max_frame = remote_max_frame_q ? remote_max_frame : OPEN_MAX_FRAME_SIZE_DEFAULT;
  ------------------
  |  |    9|   302k|#define OPEN_MAX_FRAME_SIZE_DEFAULT (4294967295) /* uint */
  ------------------
  |  Branch (1071:33): [True: 10.4k, False: 146k]
  ------------------
 1072|       |
 1073|   156k|  if (transport->remote_max_frame > 0) {
  ------------------
  |  Branch (1073:7): [True: 152k, False: 3.71k]
  ------------------
 1074|   152k|    if (transport->remote_max_frame < AMQP_MIN_MAX_FRAME_SIZE) {
  ------------------
  |  |   34|   152k|#define AMQP_MIN_MAX_FRAME_SIZE ((uint32_t)512) // minimum allowable max-frame
  ------------------
  |  Branch (1074:9): [True: 5.83k, False: 146k]
  ------------------
 1075|  5.83k|      pn_logger_logf(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_WARNING,
 1076|  5.83k|                     "Peer advertised bad max-frame (%u), forcing to %u",
 1077|  5.83k|                     transport->remote_max_frame, AMQP_MIN_MAX_FRAME_SIZE);
  ------------------
  |  |   34|  5.83k|#define AMQP_MIN_MAX_FRAME_SIZE ((uint32_t)512) // minimum allowable max-frame
  ------------------
 1078|  5.83k|      transport->remote_max_frame = AMQP_MIN_MAX_FRAME_SIZE;
  ------------------
  |  |   34|  5.83k|#define AMQP_MIN_MAX_FRAME_SIZE ((uint32_t)512) // minimum allowable max-frame
  ------------------
 1079|  5.83k|    }
 1080|   152k|  }
 1081|   156k|  pni_mem_deallocate(PN_CLASSCLASS(pn_strdup), transport->remote_container);
  ------------------
  |  |  101|   156k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
 1082|   156k|  transport->remote_container = container_q ? pn_bytes_strdup(remote_container) : NULL;
  ------------------
  |  Branch (1082:33): [True: 3.46k, False: 153k]
  ------------------
 1083|   156k|  pni_mem_deallocate(PN_CLASSCLASS(pn_strdup), transport->remote_hostname);
  ------------------
  |  |  101|   156k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
 1084|   156k|  transport->remote_hostname = hostname_q ? pn_bytes_strdup(remote_hostname) : NULL;
  ------------------
  |  Branch (1084:32): [True: 4.93k, False: 151k]
  ------------------
 1085|       |
 1086|   156k|  pn_connection_t *conn = transport->connection;
 1087|   156k|  if (conn) {
  ------------------
  |  Branch (1087:7): [True: 156k, False: 0]
  ------------------
 1088|   156k|    PN_SET_REMOTE(conn->endpoint.state, PN_REMOTE_ACTIVE);
  ------------------
  |  |  358|   156k|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|   156k|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   156k|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   156k|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|   156k|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1089|   156k|    pni_post_remote_open_events(transport, conn);
 1090|   156k|  } else {
 1091|      0|    transport->halt = true;
 1092|      0|  }
 1093|   156k|  transport->open_rcvd = true;
 1094|   156k|  pni_calculate_channel_max(transport);
 1095|   156k|  return 0;
 1096|   156k|}
pn_do_begin:
 1099|   686k|{
 1100|   686k|  bool reply;
 1101|   686k|  uint16_t remote_channel;
 1102|   686k|  pn_sequence_t next;
 1103|   686k|  uint32_t incoming_window;
 1104|   686k|  uint32_t outgoing_window;
 1105|   686k|  bool handle_max_q;
 1106|   686k|  uint32_t handle_max;
 1107|       |
 1108|   686k|  pn_amqp_decode_DqEQHIIIQIe(payload, &reply, &remote_channel, &next, &incoming_window, &outgoing_window, &handle_max_q, &handle_max);
 1109|       |
 1110|       |  // AMQP 1.0 section 2.7.1 - if the peer doesn't honor our channel_max --
 1111|       |  // express our displeasure by closing the connection with a framing error.
 1112|   686k|  if (channel > transport->channel_max) {
  ------------------
  |  Branch (1112:7): [True: 24, False: 686k]
  ------------------
 1113|     24|    pn_do_error(transport,
 1114|     24|                "amqp:connection:framing-error",
 1115|     24|                "remote channel %d is above negotiated channel_max %d.",
 1116|     24|                channel,
 1117|     24|                transport->channel_max
 1118|     24|               );
 1119|     24|    return PN_ARG_ERR;
  ------------------
  |  |   52|     24|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
 1120|     24|  }
 1121|       |
 1122|   686k|  pn_session_t *ssn;
 1123|   686k|  if (reply) {
  ------------------
  |  Branch (1123:7): [True: 95.1k, False: 591k]
  ------------------
 1124|  95.1k|    ssn = (pn_session_t *) pn_hash_get(transport->local_channels, remote_channel);
 1125|  95.1k|    if (ssn == 0) {
  ------------------
  |  Branch (1125:9): [True: 5, False: 95.1k]
  ------------------
 1126|      5|      pn_do_error(transport,
 1127|      5|                "amqp:invalid-field",
 1128|      5|                "begin reply to unknown channel %d.",
 1129|      5|                remote_channel
 1130|      5|               );
 1131|      5|      return PN_ARG_ERR;
  ------------------
  |  |   52|      5|#define PN_ARG_ERR (-6)        /**< Argument error */
  ------------------
 1132|      5|    }
 1133|   591k|  } else {
 1134|   591k|    ssn = pn_session(transport->connection);
 1135|   591k|  }
 1136|   686k|  ssn->state.incoming_transfer_count = next;
 1137|   686k|  if (handle_max_q) {
  ------------------
  |  Branch (1137:7): [True: 83, False: 686k]
  ------------------
 1138|     83|    ssn->state.remote_handle_max = handle_max;
 1139|     83|  }
 1140|   686k|  pni_map_remote_channel(ssn, channel);
 1141|   686k|  PN_SET_REMOTE(ssn->endpoint.state, PN_REMOTE_ACTIVE);
  ------------------
  |  |  358|   686k|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|   686k|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   686k|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   686k|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|   686k|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1142|   686k|  pn_collector_put_object(transport->connection->collector, ssn, PN_SESSION_REMOTE_OPEN);
 1143|   686k|  return 0;
 1144|   686k|}
pn_terminus_set_address_bytes:
 1208|  61.8k|{
 1209|  61.8k|  assert(terminus);
 1210|  61.8k|  return pn_string_setn(terminus->address, address.start, address.size);
 1211|  61.8k|}
pn_do_attach:
 1214|  1.23M|{
 1215|  1.23M|  pn_bytes_t name;
 1216|  1.23M|  uint32_t handle;
 1217|  1.23M|  bool is_sender;
 1218|  1.23M|  pn_bytes_t source, target;
 1219|  1.23M|  pn_durability_t src_dr, tgt_dr;
 1220|  1.23M|  pn_bytes_t src_exp, tgt_exp;
 1221|  1.23M|  pn_seconds_t src_timeout, tgt_timeout;
 1222|  1.23M|  bool src_dynamic, tgt_dynamic;
 1223|  1.23M|  pn_sequence_t idc;
 1224|  1.23M|  pn_bytes_t dist_mode;
 1225|  1.23M|  bool snd_settle, rcv_settle;
 1226|  1.23M|  uint8_t snd_settle_mode, rcv_settle_mode;
 1227|  1.23M|  uint64_t max_msgsz;
 1228|  1.23M|  bool has_props;
 1229|  1.23M|  pn_data_t *rem_props = pn_data(0);
 1230|  1.23M|  pn_amqp_decode_DqESIoQBQBDqESIsIoqseDqESIsIoeqqILqqQCe(payload,
 1231|  1.23M|                                                         &name, &handle,
 1232|  1.23M|                                                         &is_sender,
 1233|  1.23M|                                                         &snd_settle, &snd_settle_mode,
 1234|  1.23M|                                                         &rcv_settle, &rcv_settle_mode,
 1235|  1.23M|                                                         &source, &src_dr, &src_exp, &src_timeout, &src_dynamic, &dist_mode,
 1236|  1.23M|                                                         &target, &tgt_dr, &tgt_exp, &tgt_timeout, &tgt_dynamic,
 1237|  1.23M|                                                         &idc, &max_msgsz, &has_props, rem_props);
 1238|  1.23M|  char strbuf[128];      // avoid malloc for most link names
 1239|  1.23M|  char *strheap = (name.size >= sizeof(strbuf)) ? (char *) malloc(name.size + 1) : NULL;
  ------------------
  |  Branch (1239:19): [True: 1.82k, False: 1.23M]
  ------------------
 1240|  1.23M|  char *strname = strheap ? strheap : strbuf;
  ------------------
  |  Branch (1240:19): [True: 1.82k, False: 1.23M]
  ------------------
 1241|  1.23M|  if (name.size > 0) strncpy(strname, name.start, name.size);
  ------------------
  |  Branch (1241:7): [True: 862k, False: 369k]
  ------------------
 1242|  1.23M|  strname[name.size] = '\0';
 1243|       |
 1244|  1.23M|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1245|  1.23M|  if (!ssn) {
  ------------------
  |  Branch (1245:7): [True: 1.54k, False: 1.23M]
  ------------------
 1246|  1.54k|    pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1247|  1.54k|    if (strheap) free(strheap);
  ------------------
  |  Branch (1247:9): [True: 1, False: 1.54k]
  ------------------
 1248|  1.54k|    pn_free(rem_props);
 1249|  1.54k|    return PN_EOS;
  ------------------
  |  |   47|  1.54k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 1250|  1.54k|  }
 1251|  1.23M|  if (handle > ssn->local_handle_max) {
  ------------------
  |  Branch (1251:7): [True: 41, False: 1.23M]
  ------------------
 1252|     41|    pn_do_error(transport, "amqp:connection:framing-error",
 1253|     41|                "remote handle %u is above handle_max %u", handle, ssn->local_handle_max);
 1254|     41|    if (strheap) free(strheap);
  ------------------
  |  Branch (1254:9): [True: 1, False: 40]
  ------------------
 1255|     41|    pn_free(rem_props);
 1256|     41|    return PN_EOS;
  ------------------
  |  |   47|     41|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 1257|     41|  }
 1258|  1.23M|  pn_link_t *link = pni_find_link(ssn, name, is_sender);
 1259|  1.23M|  if (link && (int32_t)link->state.remote_handle >= 0) {
  ------------------
  |  Branch (1259:7): [True: 500, False: 1.23M]
  |  Branch (1259:15): [True: 480, False: 20]
  ------------------
 1260|    480|    pn_do_error(transport, "amqp:invalid-field", "link name already attached: %s", strname);
 1261|    480|    if (strheap) free(strheap);
  ------------------
  |  Branch (1261:9): [True: 1, False: 479]
  ------------------
 1262|    480|    pn_free(rem_props);
 1263|    480|    return PN_EOS;
  ------------------
  |  |   47|    480|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 1264|    480|  }
 1265|  1.23M|  if (!link) {                  /* Make a new link for the attach */
  ------------------
  |  Branch (1265:7): [True: 1.23M, False: 20]
  ------------------
 1266|  1.23M|    if (is_sender) {
  ------------------
  |  Branch (1266:9): [True: 268k, False: 961k]
  ------------------
 1267|   268k|      link = (pn_link_t *) pn_sender(ssn, strname);
 1268|   961k|    } else {
 1269|   961k|      link = (pn_link_t *) pn_receiver(ssn, strname);
 1270|   961k|    }
 1271|  1.23M|  }
 1272|       |
 1273|  1.23M|  if (strheap) {
  ------------------
  |  Branch (1273:7): [True: 1.81k, False: 1.22M]
  ------------------
 1274|  1.81k|    free(strheap);
 1275|  1.81k|  }
 1276|       |
 1277|  1.23M|  if (has_props) {
  ------------------
  |  Branch (1277:7): [True: 2.92k, False: 1.22M]
  ------------------
 1278|  2.92k|    link->remote_properties = rem_props;
 1279|  1.22M|  } else {
 1280|  1.22M|    pn_free(rem_props);
 1281|  1.22M|  }
 1282|       |
 1283|  1.23M|  pni_map_remote_handle(link, handle);
 1284|  1.23M|  PN_SET_REMOTE(link->endpoint.state, PN_REMOTE_ACTIVE);
  ------------------
  |  |  358|  1.23M|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|  1.23M|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  1.23M|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.23M|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.23M|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1285|  1.23M|  pn_terminus_t *rsrc = &link->remote_source;
 1286|  1.23M|  if (source.start || src_dynamic) {
  ------------------
  |  Branch (1286:7): [True: 27.5k, False: 1.20M]
  |  Branch (1286:23): [True: 20.4k, False: 1.18M]
  ------------------
 1287|  47.9k|    pn_terminus_set_type(rsrc, PN_SOURCE);
 1288|  47.9k|    pn_terminus_set_address_bytes(rsrc, source);
 1289|  47.9k|    pn_terminus_set_durability(rsrc, src_dr);
 1290|  47.9k|    set_expiry_policy_from_symbol(rsrc, src_exp);
 1291|  47.9k|    pn_terminus_set_timeout(rsrc, src_timeout);
 1292|  47.9k|    pn_terminus_set_dynamic(rsrc, src_dynamic);
 1293|  47.9k|    pn_terminus_set_distribution_mode(rsrc, symbol2dist_mode(dist_mode));
 1294|  1.18M|  } else {
 1295|  1.18M|    pn_terminus_set_type(rsrc, PN_UNSPECIFIED);
 1296|  1.18M|  }
 1297|  1.23M|  pn_terminus_t *rtgt = &link->remote_target;
 1298|  1.23M|  if (target.start || tgt_dynamic) {
  ------------------
  |  Branch (1298:7): [True: 5.94k, False: 1.22M]
  |  Branch (1298:23): [True: 7.94k, False: 1.21M]
  ------------------
 1299|  13.8k|    pn_terminus_set_type(rtgt, PN_TARGET);
 1300|  13.8k|    pn_terminus_set_address_bytes(rtgt, target);
 1301|  13.8k|    pn_terminus_set_durability(rtgt, tgt_dr);
 1302|  13.8k|    set_expiry_policy_from_symbol(rtgt, tgt_exp);
 1303|  13.8k|    pn_terminus_set_timeout(rtgt, tgt_timeout);
 1304|  13.8k|    pn_terminus_set_dynamic(rtgt, tgt_dynamic);
 1305|  1.21M|  } else {
 1306|  1.21M|    uint64_t code = 0;
 1307|  1.21M|    pn_amqp_decode_DqEqqqqqDqqDLqqqqe(payload, &code);
 1308|  1.21M|    if (code == COORDINATOR) {
  ------------------
  |  |  187|  1.21M|#define COORDINATOR ((uint64_t) 48)
  ------------------
  |  Branch (1308:9): [True: 174k, False: 1.04M]
  ------------------
 1309|   174k|      pn_terminus_set_type(rtgt, PN_COORDINATOR);
 1310|  1.04M|    } else if (code == TARGET) {
  ------------------
  |  |  177|  1.04M|#define TARGET ((uint64_t) 41)
  ------------------
  |  Branch (1310:16): [True: 221, False: 1.04M]
  ------------------
 1311|    221|      pn_terminus_set_type(rtgt, PN_TARGET);
 1312|  1.04M|    } else {
 1313|  1.04M|      pn_terminus_set_type(rtgt, PN_UNSPECIFIED);
 1314|  1.04M|    }
 1315|  1.21M|  }
 1316|       |
 1317|  1.23M|  if (snd_settle)
  ------------------
  |  Branch (1317:7): [True: 60.9k, False: 1.16M]
  ------------------
 1318|  60.9k|    link->remote_snd_settle_mode = snd_settle_mode;
 1319|  1.23M|  if (rcv_settle)
  ------------------
  |  Branch (1319:7): [True: 42.7k, False: 1.18M]
  ------------------
 1320|  42.7k|    link->remote_rcv_settle_mode = rcv_settle_mode;
 1321|       |
 1322|  1.23M|  pn_data_clear(link->remote_source.properties);
 1323|  1.23M|  pn_data_clear(link->remote_source.filter);
 1324|  1.23M|  pn_data_clear(link->remote_source.outcomes);
 1325|  1.23M|  pn_data_clear(link->remote_source.capabilities);
 1326|       |
 1327|  1.23M|  pn_amqp_decode_DqEqqqqqDqEqqqqqCqCqCCee(payload,
 1328|  1.23M|                                          link->remote_source.properties,
 1329|  1.23M|                                          link->remote_source.filter,
 1330|  1.23M|                                          link->remote_source.outcomes,
 1331|  1.23M|                                          link->remote_source.capabilities);
 1332|       |
 1333|  1.23M|  pn_data_rewind(link->remote_source.properties);
 1334|  1.23M|  pn_data_rewind(link->remote_source.filter);
 1335|  1.23M|  pn_data_rewind(link->remote_source.outcomes);
 1336|  1.23M|  pn_data_rewind(link->remote_source.capabilities);
 1337|       |
 1338|  1.23M|  pn_data_clear(link->remote_target.properties);
 1339|  1.23M|  pn_data_clear(link->remote_target.capabilities);
 1340|       |
 1341|  1.23M|  if (pn_terminus_get_type(&link->remote_target) == PN_COORDINATOR) {
  ------------------
  |  Branch (1341:7): [True: 174k, False: 1.05M]
  ------------------
 1342|       |    // coordinator target only has a capabilities field
 1343|   174k|    pn_amqp_decode_DqEqqqqqDqqDqECeqqqe(payload,
 1344|   174k|                                        link->remote_target.capabilities);
 1345|  1.05M|  } else {
 1346|  1.05M|    pn_amqp_decode_DqEqqqqqDqqDqEqqqqqCCee(payload,
 1347|  1.05M|                                           link->remote_target.properties,
 1348|  1.05M|                                           link->remote_target.capabilities);
 1349|  1.05M|  }
 1350|       |
 1351|  1.23M|  pn_data_rewind(link->remote_target.properties);
 1352|  1.23M|  pn_data_rewind(link->remote_target.capabilities);
 1353|       |
 1354|  1.23M|  if (!is_sender) {
  ------------------
  |  Branch (1354:7): [True: 961k, False: 268k]
  ------------------
 1355|   961k|    link->state.delivery_count = idc;
 1356|   961k|  }
 1357|       |
 1358|  1.23M|  if (max_msgsz) {
  ------------------
  |  Branch (1358:7): [True: 10.4k, False: 1.22M]
  ------------------
 1359|  10.4k|    link->remote_max_message_size = max_msgsz;
 1360|  10.4k|  }
 1361|       |
 1362|  1.23M|  pn_collector_put_object(transport->connection->collector, link, PN_LINK_REMOTE_OPEN);
 1363|  1.23M|  return 0;
 1364|  1.23M|}
pn_do_transfer:
 1379|  1.07M|{
 1380|       |  // XXX: multi transfer
 1381|  1.07M|  uint32_t handle;
 1382|  1.07M|  pn_bytes_t tag;
 1383|  1.07M|  bool id_present;
 1384|  1.07M|  pn_sequence_t id;
 1385|  1.07M|  bool settled;
 1386|  1.07M|  bool more;
 1387|  1.07M|  bool has_type, settled_set;
 1388|  1.07M|  bool resume, aborted, batchable;
 1389|  1.07M|  uint64_t type;
 1390|       |
 1391|  1.07M|  pn_bytes_t disp_data;
 1392|  1.07M|  size_t dsize =
 1393|  1.07M|    pn_amqp_decode_DqEIQIzqQooqDQLRoooe(payload, &handle, &id_present, &id, &tag,
 1394|  1.07M|                                        &settled_set, &settled, &more, &has_type, &type, &disp_data,
 1395|  1.07M|                                        &resume, &aborted, &batchable);
 1396|  1.07M|  payload.size -= dsize;
 1397|  1.07M|  payload.start += dsize;
 1398|       |
 1399|  1.07M|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1400|  1.07M|  if (!ssn) {
  ------------------
  |  Branch (1400:7): [True: 734, False: 1.07M]
  ------------------
 1401|    734|    return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1402|    734|  }
 1403|       |
 1404|  1.07M|  if (!ssn->state.incoming_window) {
  ------------------
  |  Branch (1404:7): [True: 25, False: 1.07M]
  ------------------
 1405|     25|    return pn_do_error(transport, "amqp:session:window-violation", "incoming session window exceeded");
 1406|     25|  }
 1407|       |
 1408|  1.07M|  pn_link_t *link = pni_handle_state(ssn, handle);
 1409|  1.07M|  if (!link) {
  ------------------
  |  Branch (1409:7): [True: 2, False: 1.07M]
  ------------------
 1410|      2|    return pn_do_error(transport, "amqp:invalid-field", "no such handle: %u", handle);
 1411|      2|  }
 1412|  1.07M|  pn_delivery_t *delivery = NULL;
 1413|  1.07M|  bool new_delivery = false;
 1414|  1.07M|  if (link->more_pending) {
  ------------------
  |  Branch (1414:7): [True: 41.4k, False: 1.03M]
  ------------------
 1415|       |    // Ongoing multiframe delivery.
 1416|  41.4k|    if (link->unsettled_tail && !link->unsettled_tail->done) {
  ------------------
  |  Branch (1416:9): [True: 41.0k, False: 363]
  |  Branch (1416:33): [True: 20.8k, False: 20.2k]
  ------------------
 1417|  20.8k|      delivery = link->unsettled_tail;
 1418|  20.8k|      if (settled_set && !settled && delivery->remote.settled)
  ------------------
  |  Branch (1418:11): [True: 6.90k, False: 13.8k]
  |  Branch (1418:26): [True: 386, False: 6.51k]
  |  Branch (1418:38): [True: 1, False: 385]
  ------------------
 1419|      1|        return pn_do_error(transport, "amqp:invalid-field", "invalid transition from settled to unsettled");
 1420|  20.8k|      if (id_present && id != delivery->state.id)
  ------------------
  |  Branch (1420:11): [True: 1.10k, False: 19.6k]
  |  Branch (1420:25): [True: 8, False: 1.09k]
  ------------------
 1421|      8|        return pn_do_error(transport, "amqp:invalid-field", "invalid delivery-id for a continuation transfer");
 1422|  20.8k|    } else {
 1423|       |      // Application has already settled.  Delivery is no more.
 1424|       |      // Ignore content and look for transition to a new delivery.
 1425|  20.6k|      if (!id_present || id == link->more_id) {
  ------------------
  |  Branch (1425:11): [True: 18.8k, False: 1.82k]
  |  Branch (1425:26): [True: 1.81k, False: 7]
  ------------------
 1426|       |        // Still old delivery.
 1427|  20.6k|        if (!more || aborted)
  ------------------
  |  Branch (1427:13): [True: 14.7k, False: 5.91k]
  |  Branch (1427:22): [True: 204, False: 5.70k]
  ------------------
 1428|  14.9k|          link->more_pending = false;
 1429|  20.6k|      } else {
 1430|       |        // New id.
 1431|      7|        new_delivery = true;
 1432|      7|        link->more_pending = false;
 1433|      7|      }
 1434|  20.6k|    }
 1435|  1.03M|  } else {
 1436|  1.03M|    new_delivery = true;
 1437|  1.03M|  }
 1438|       |
 1439|  1.07M|  if (new_delivery) {
  ------------------
  |  Branch (1439:7): [True: 1.03M, False: 41.4k]
  ------------------
 1440|  1.03M|    assert(!link->more_pending);
 1441|  1.03M|    assert(delivery == NULL);
 1442|  1.03M|    pn_delivery_map_t *incoming = &ssn->state.incoming;
 1443|       |
 1444|  1.03M|    if (!ssn->state.incoming_init) {
  ------------------
  |  Branch (1444:9): [True: 6.02k, False: 1.02M]
  ------------------
 1445|  6.02k|      incoming->next = id;
 1446|  6.02k|      ssn->state.incoming_init = true;
 1447|  6.02k|      ssn->incoming_deliveries++;
 1448|  6.02k|    }
 1449|       |
 1450|  1.03M|    delivery = pn_delivery(link, pn_dtag(tag.start, tag.size));
 1451|  1.03M|    pn_delivery_state_t *state = pni_delivery_map_push(incoming, delivery);
 1452|  1.03M|    if (id_present && id != state->id) {
  ------------------
  |  Branch (1452:9): [True: 314, False: 1.03M]
  |  Branch (1452:23): [True: 16, False: 298]
  ------------------
 1453|     16|      return pn_do_error(transport, "amqp:session:invalid-field",
 1454|     16|                         "sequencing error, expected delivery-id %u, got %u",
 1455|     16|                         state->id, id);
 1456|     16|    }
 1457|  1.03M|    if (has_type) {
  ------------------
  |  Branch (1457:9): [True: 8.22k, False: 1.02M]
  ------------------
 1458|  8.22k|      delivery->remote.type = type;
 1459|  8.22k|      pn_data_clear(delivery->remote.data);
 1460|  8.22k|      pn_data_decode(delivery->remote.data, disp_data.start, disp_data.size);
 1461|  8.22k|    }
 1462|  1.03M|    link->state.delivery_count++;
 1463|  1.03M|    link->state.link_credit--;
 1464|  1.03M|    link->queued++;
 1465|  1.03M|  }
 1466|       |
 1467|  1.07M|  if (delivery) {
  ------------------
  |  Branch (1467:7): [True: 1.05M, False: 20.6k]
  ------------------
 1468|  1.05M|    pn_buffer_append(delivery->bytes, payload.start, payload.size);
 1469|  1.05M|    if (more) {
  ------------------
  |  Branch (1469:9): [True: 23.8k, False: 1.02M]
  ------------------
 1470|  23.8k|      if (!link->more_pending) {
  ------------------
  |  Branch (1470:11): [True: 19.2k, False: 4.62k]
  ------------------
 1471|       |        // First frame of a multi-frame transfer. Remember at link level.
 1472|  19.2k|        link->more_pending = true;
 1473|  19.2k|        assert(id_present);  // Id MUST be set on first frame, and already checked above.
 1474|  19.2k|        link->more_id = id;
 1475|  19.2k|      }
 1476|  23.8k|      delivery->done = false;
 1477|  23.8k|    }
 1478|  1.02M|    else
 1479|  1.02M|      delivery->done = true;
 1480|       |
 1481|       |    // XXX: need to fill in remote state: delivery->remote.state = ...;
 1482|  1.05M|    if (settled && !delivery->remote.settled) {
  ------------------
  |  Branch (1482:9): [True: 379k, False: 673k]
  |  Branch (1482:20): [True: 378k, False: 1.77k]
  ------------------
 1483|   378k|      delivery->remote.settled = settled;
 1484|   378k|      delivery->updated = true;
 1485|   378k|      pn_work_update(transport->connection, delivery);
 1486|   378k|    }
 1487|       |
 1488|  1.05M|    if ((delivery->aborted = aborted)) {
  ------------------
  |  Branch (1488:9): [True: 1.24k, False: 1.05M]
  ------------------
 1489|  1.24k|      delivery->remote.settled = true;
 1490|  1.24k|      delivery->done = true;
 1491|  1.24k|      delivery->updated = true;
 1492|  1.24k|      link->more_pending = false;
 1493|  1.24k|      pn_work_update(transport->connection, delivery);
 1494|  1.24k|    }
 1495|  1.05M|    pn_collector_put_object(transport->connection->collector, delivery, PN_DELIVERY);
 1496|  1.05M|  }
 1497|       |
 1498|  1.07M|  ssn->incoming_bytes += payload.size;
 1499|  1.07M|  ssn->state.incoming_transfer_count++;
 1500|  1.07M|  ssn->state.incoming_window--;
 1501|       |
 1502|       |  // XXX: need better policy for when to refresh window
 1503|  1.07M|  if (!ssn->state.incoming_window && (int32_t) link->state.local_handle >= 0) {
  ------------------
  |  Branch (1503:7): [True: 0, False: 1.07M]
  |  Branch (1503:38): [True: 0, False: 0]
  ------------------
 1504|      0|    pni_post_flow(transport, ssn, link);
 1505|      0|  }
 1506|       |
 1507|  1.07M|  return 0;
 1508|  1.07M|}
pn_do_flow:
 1511|  49.1k|{
 1512|  49.1k|  pn_sequence_t onext, inext, delivery_count;
 1513|  49.1k|  uint32_t iwin, owin, link_credit;
 1514|  49.1k|  uint32_t handle;
 1515|  49.1k|  bool inext_init, handle_init, dcount_init, drain;
 1516|       |
 1517|  49.1k|  pn_amqp_decode_DqEQIIIIQIQIIqoe(payload, &inext_init, &inext, &iwin,
 1518|  49.1k|                                  &onext, &owin, &handle_init, &handle, &dcount_init,
 1519|  49.1k|                                  &delivery_count, &link_credit, &drain);
 1520|       |
 1521|  49.1k|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1522|  49.1k|  if (!ssn) {
  ------------------
  |  Branch (1522:7): [True: 295, False: 48.8k]
  ------------------
 1523|    295|    return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1524|    295|  }
 1525|       |
 1526|  48.8k|  if (inext_init) {
  ------------------
  |  Branch (1526:7): [True: 3.77k, False: 45.0k]
  ------------------
 1527|  3.77k|    ssn->state.remote_incoming_window = inext + iwin - ssn->state.outgoing_transfer_count;
 1528|  45.0k|  } else {
 1529|  45.0k|    ssn->state.remote_incoming_window = iwin;
 1530|  45.0k|  }
 1531|       |
 1532|  48.8k|  if (handle_init) {
  ------------------
  |  Branch (1532:7): [True: 3.16k, False: 45.6k]
  ------------------
 1533|  3.16k|    pn_link_t *link = pni_handle_state(ssn, handle);
 1534|  3.16k|    if (!link) {
  ------------------
  |  Branch (1534:9): [True: 10, False: 3.15k]
  ------------------
 1535|     10|      return pn_do_error(transport, "amqp:invalid-field", "no such handle: %u", handle);
 1536|     10|    }
 1537|  3.15k|    if (link->endpoint.type == SENDER) {
  ------------------
  |  Branch (1537:9): [True: 2.03k, False: 1.12k]
  ------------------
 1538|  2.03k|      pn_sequence_t receiver_count;
 1539|  2.03k|      if (dcount_init) {
  ------------------
  |  Branch (1539:11): [True: 1.20k, False: 825]
  ------------------
 1540|  1.20k|        receiver_count = delivery_count;
 1541|  1.20k|      } else {
 1542|       |        // our initial delivery count
 1543|    825|        receiver_count = 0;
 1544|    825|      }
 1545|  2.03k|      pn_sequence_t old = link->state.link_credit;
 1546|  2.03k|      link->state.link_credit = receiver_count + link_credit - link->state.delivery_count;
 1547|  2.03k|      link->credit += link->state.link_credit - old;
 1548|  2.03k|      link->drain = drain;
 1549|  2.03k|      pn_delivery_t *delivery = pn_link_current(link);
 1550|  2.03k|      if (delivery) pn_work_update(transport->connection, delivery);
  ------------------
  |  Branch (1550:11): [True: 1.61k, False: 412]
  ------------------
 1551|  2.03k|    } else {
 1552|  1.12k|      pn_sequence_t delta = delivery_count - link->state.delivery_count;
 1553|  1.12k|      if (delta > 0) {
  ------------------
  |  Branch (1553:11): [True: 891, False: 234]
  ------------------
 1554|    891|        link->state.delivery_count += delta;
 1555|    891|        link->state.link_credit -= delta;
 1556|    891|        link->credit -= delta;
 1557|    891|        link->drained += delta;
 1558|    891|      }
 1559|  1.12k|    }
 1560|       |
 1561|  3.15k|    pn_collector_put_object(transport->connection->collector, link, PN_LINK_FLOW);
 1562|  3.15k|  }
 1563|       |
 1564|  48.8k|  return 0;
 1565|  48.8k|}
pn_do_disposition:
 1656|  69.2k|{
 1657|  69.2k|  bool role;
 1658|  69.2k|  pn_sequence_t first, last;
 1659|  69.2k|  bool last_init, settled;
 1660|  69.2k|  pn_bytes_t disp_data;
 1661|  69.2k|  pn_amqp_decode_DqEoIQIoRe(payload, &role, &first, &last_init,
 1662|  69.2k|                            &last, &settled, &disp_data);
 1663|  69.2k|  if (!last_init) last = first;
  ------------------
  |  Branch (1663:7): [True: 51.3k, False: 17.8k]
  ------------------
 1664|       |
 1665|  69.2k|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1666|  69.2k|  if (!ssn) {
  ------------------
  |  Branch (1666:7): [True: 344, False: 68.8k]
  ------------------
 1667|    344|    return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1668|    344|  }
 1669|       |
 1670|  68.8k|  if (!sequence_lte(first, last)) {
  ------------------
  |  Branch (1670:7): [True: 32, False: 68.8k]
  ------------------
 1671|     32|    return pn_do_error(transport, "amqp:not allowed", "illegal delivery range: %x-%x", first, last);
 1672|     32|  }
 1673|       |
 1674|  68.8k|  pn_delivery_map_t *deliveries;
 1675|  68.8k|  if (role) {
  ------------------
  |  Branch (1675:7): [True: 2.25k, False: 66.6k]
  ------------------
 1676|  2.25k|    deliveries = &ssn->state.outgoing;
 1677|  66.6k|  } else {
 1678|  66.6k|    deliveries = &ssn->state.incoming;
 1679|  66.6k|  }
 1680|       |
 1681|  68.8k|  bool type_init;
 1682|  68.8k|  uint64_t type;
 1683|  68.8k|  bool remote_data;
 1684|  68.8k|  pn_amqp_decode_DQLQq(disp_data, &type_init, &type, &remote_data);
 1685|       |
 1686|       |
 1687|       |  // Do some validation of received first and last values
 1688|       |  // TODO: We should really also clamp the first value here, but we're not keeping track of the earliest
 1689|       |  // unsettled delivery sequence no
 1690|  68.8k|  last = sequence_lte(last, deliveries->next) ? last : deliveries->next;
  ------------------
  |  Branch (1690:10): [True: 60.4k, False: 8.38k]
  ------------------
 1691|       |
 1692|       |  // If there are fewer deliveries in the session than the range then look at every delivery in the session
 1693|       |  // otherwise look at every delivery_id in the disposition performative
 1694|  68.8k|  pn_hash_t *dh = deliveries->deliveries;
 1695|  68.8k|  if (last-first+1 >= pn_hash_size(dh)) {
  ------------------
  |  Branch (1695:7): [True: 57.0k, False: 11.7k]
  ------------------
 1696|  1.83M|    for (pn_handle_t entry = pn_hash_head(dh); entry!=0 ; entry = pn_hash_next(dh, entry)) {
  ------------------
  |  Branch (1696:48): [True: 1.77M, False: 57.0k]
  ------------------
 1697|  1.77M|      pn_sequence_t key = pn_hash_key(dh, entry);
 1698|  1.77M|      if (sequence_lte(first, key) && sequence_lte(key, last)) {
  ------------------
  |  Branch (1698:11): [True: 1.77M, False: 2.05k]
  |  Branch (1698:39): [True: 1.22M, False: 549k]
  ------------------
 1699|  1.22M|        pn_delivery_t *delivery = (pn_delivery_t*) pn_hash_value(dh, entry);
 1700|  1.22M|        pni_do_delivery_disposition(transport, delivery, settled, remote_data, type_init, type, disp_data);
 1701|  1.22M|      }
 1702|  1.77M|    }
 1703|  57.0k|  } else {
 1704|   279k|    for (pn_sequence_t id = first; sequence_lte(id, last); ++id) {
  ------------------
  |  Branch (1704:36): [True: 267k, False: 11.7k]
  ------------------
 1705|   267k|      pn_delivery_t *delivery = pni_delivery_map_get(deliveries, id);
 1706|   267k|      if (delivery) {
  ------------------
  |  Branch (1706:11): [True: 61.8k, False: 206k]
  ------------------
 1707|  61.8k|        pni_do_delivery_disposition(transport, delivery, settled, remote_data, type_init, type, disp_data);
 1708|  61.8k|      }
 1709|   267k|    }
 1710|  11.7k|  }
 1711|  68.8k|  return 0;
 1712|  68.8k|}
pn_do_detach:
 1715|  44.0k|{
 1716|  44.0k|  uint32_t handle;
 1717|  44.0k|  bool closed;
 1718|       |
 1719|  44.0k|  pn_bytes_t error_condition;
 1720|  44.0k|  pn_amqp_decode_DqEIoRe(payload, &handle, &closed, &error_condition);
 1721|       |
 1722|  44.0k|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1723|  44.0k|  if (!ssn) {
  ------------------
  |  Branch (1723:7): [True: 296, False: 43.7k]
  ------------------
 1724|    296|    return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1725|    296|  }
 1726|  43.7k|  pn_link_t *link = pni_handle_state(ssn, handle);
 1727|  43.7k|  if (!link) {
  ------------------
  |  Branch (1727:7): [True: 148, False: 43.6k]
  ------------------
 1728|    148|    return pn_do_error(transport, "amqp:invalid-field", "no such handle: %u", handle);
 1729|    148|  }
 1730|       |
 1731|  43.6k|  pn_bytes_t cond;
 1732|  43.6k|  pn_bytes_t desc;
 1733|  43.6k|  pn_condition_t* condition = &link->endpoint.remote_condition;
 1734|  43.6k|  pn_condition_clear(condition);
 1735|  43.6k|  pn_amqp_decode_DqEsSCe(error_condition, &cond, &desc, pn_condition_info(condition));
 1736|  43.6k|  pn_condition_set(condition, cond, desc);
 1737|  43.6k|  pn_data_rewind(pn_condition_info(condition));
 1738|       |
 1739|  43.6k|  if (closed)
  ------------------
  |  Branch (1739:7): [True: 11.7k, False: 31.9k]
  ------------------
 1740|  11.7k|  {
 1741|  11.7k|    PN_SET_REMOTE(link->endpoint.state, PN_REMOTE_CLOSED);
  ------------------
  |  |  358|  11.7k|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|  11.7k|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  11.7k|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  11.7k|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  11.7k|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1742|  11.7k|    pn_collector_put_object(transport->connection->collector, link, PN_LINK_REMOTE_CLOSE);
 1743|  31.9k|  } else {
 1744|  31.9k|    pn_collector_put_object(transport->connection->collector, link, PN_LINK_REMOTE_DETACH);
 1745|  31.9k|  }
 1746|       |
 1747|  43.6k|  pni_unmap_remote_handle(link);
 1748|  43.6k|  return 0;
 1749|  43.7k|}
pn_do_end:
 1752|  3.41k|{
 1753|  3.41k|  pn_session_t *ssn = pni_channel_state(transport, channel);
 1754|  3.41k|  if (!ssn) {
  ------------------
  |  Branch (1754:7): [True: 5, False: 3.41k]
  ------------------
 1755|      5|    return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
 1756|      5|  }
 1757|       |
 1758|  3.41k|  pn_bytes_t cond;
 1759|  3.41k|  pn_bytes_t desc;
 1760|  3.41k|  pn_condition_t* condition = &ssn->endpoint.remote_condition;
 1761|  3.41k|  pn_condition_clear(condition);
 1762|  3.41k|  pn_amqp_decode_DqEDqEsSCee(payload, &cond, &desc, pn_condition_info(condition));
 1763|  3.41k|  pn_condition_set(condition, cond, desc);
 1764|  3.41k|  pn_data_rewind(pn_condition_info(condition));
 1765|  3.41k|  PN_SET_REMOTE(ssn->endpoint.state, PN_REMOTE_CLOSED);
  ------------------
  |  |  358|  3.41k|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|  3.41k|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  3.41k|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  3.41k|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  3.41k|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1766|  3.41k|  pn_collector_put_object(transport->connection->collector, ssn, PN_SESSION_REMOTE_CLOSE);
 1767|  3.41k|  pni_unmap_remote_channel(ssn);
 1768|  3.41k|  return 0;
 1769|  3.41k|}
pn_do_close:
 1772|  1.61k|{
 1773|  1.61k|  pn_connection_t *conn = transport->connection;
 1774|       |
 1775|  1.61k|  pn_bytes_t cond;
 1776|  1.61k|  pn_bytes_t desc;
 1777|  1.61k|  pn_condition_t* condition = &transport->remote_condition;
 1778|  1.61k|  pn_condition_clear(condition);
 1779|  1.61k|  pn_amqp_decode_DqEDqEsSCee(payload, &cond, &desc, pn_condition_info(condition));
 1780|  1.61k|  pn_condition_set(condition, cond, desc);
 1781|  1.61k|  pn_data_rewind(pn_condition_info(condition));
 1782|  1.61k|  transport->close_rcvd = true;
 1783|  1.61k|  PN_SET_REMOTE(conn->endpoint.state, PN_REMOTE_CLOSED);
  ------------------
  |  |  358|  1.61k|  (OLD) = ((OLD) & PN_LOCAL_MASK) | (NEW)
  |  |  ------------------
  |  |  |  |   81|  1.61k|#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  1.61k|#define PN_LOCAL_UNINIT (1)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.61k|#define PN_LOCAL_ACTIVE (2)
  |  |  |  |  ------------------
  |  |  |  |               #define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.61k|#define PN_LOCAL_CLOSED (4)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1784|  1.61k|  pn_collector_put_object(transport->connection->collector, conn, PN_CONNECTION_REMOTE_CLOSE);
 1785|  1.61k|  return 0;
 1786|  1.61k|}
pni_transport_grow_capacity:
 2942|    362|ssize_t pni_transport_grow_capacity(pn_transport_t *transport, size_t n) {
 2943|       |  // can we expand the size of the input buffer?
 2944|    362|  size_t size = pn_max(n, transport->input_size);
  ------------------
  |  |  164|    362|#define pn_max(X,Y) ((X) < (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (164:22): [True: 0, False: 362]
  |  |  ------------------
  ------------------
 2945|    362|  if (transport->local_max_frame) {  // there is a limit to buffer size
  ------------------
  |  Branch (2945:7): [True: 362, False: 0]
  ------------------
 2946|    362|    size = pn_min(size, transport->local_max_frame);
  ------------------
  |  |  163|    362|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 0, False: 362]
  |  |  ------------------
  ------------------
 2947|    362|  }
 2948|    362|  if (size > transport->input_size) {
  ------------------
  |  Branch (2948:7): [True: 362, False: 0]
  ------------------
 2949|    362|    char *newbuf = (char *) pni_mem_subreallocate(pn_class(transport), transport, transport->input_buf, size );
 2950|    362|    if (newbuf) {
  ------------------
  |  Branch (2950:9): [True: 362, False: 0]
  ------------------
 2951|    362|      transport->input_buf = newbuf;
 2952|    362|      transport->input_size = size;
 2953|    362|    }
 2954|    362|  }
 2955|    362|  return transport->input_size-transport->input_pending;
 2956|    362|}
pn_transport_capacity:
 2960|  45.2k|{
 2961|  45.2k|  if (transport->tail_closed) return PN_EOS;
  ------------------
  |  |   47|    301|#define PN_EOS (-1)            /**< End of stream */
  ------------------
  |  Branch (2961:7): [True: 301, False: 44.9k]
  ------------------
 2962|       |  //if (pn_error_code(transport->error)) return pn_error_code(transport->error);
 2963|       |
 2964|  44.9k|  ssize_t capacity = transport->input_size - transport->input_pending;
 2965|  44.9k|  if ( capacity<=0 ) {
  ------------------
  |  Branch (2965:8): [True: 362, False: 44.6k]
  ------------------
 2966|    362|    capacity = pni_transport_grow_capacity(transport, 2*transport->input_size);
 2967|    362|  }
 2968|  44.9k|  return capacity;
 2969|  45.2k|}
pn_transport_tail:
 2973|  44.9k|{
 2974|  44.9k|  if (transport && transport->input_pending < transport->input_size) {
  ------------------
  |  Branch (2974:7): [True: 44.9k, False: 0]
  |  Branch (2974:20): [True: 44.9k, False: 0]
  ------------------
 2975|  44.9k|    return &transport->input_buf[transport->input_pending];
 2976|  44.9k|  }
 2977|      0|  return NULL;
 2978|  44.9k|}
pn_transport_process:
 3004|  44.9k|{
 3005|  44.9k|  assert(transport);
 3006|  44.9k|  size = pn_min( size, (transport->input_size - transport->input_pending) );
  ------------------
  |  |  163|  44.9k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 0, False: 44.9k]
  |  |  ------------------
  ------------------
 3007|  44.9k|  transport->input_pending += size;
 3008|  44.9k|  transport->bytes_input += size;
 3009|       |
 3010|  44.9k|  ssize_t n = transport_consume( transport );
 3011|  44.9k|  if (n == PN_EOS) {
  ------------------
  |  |   47|  44.9k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
  |  Branch (3011:7): [True: 10.3k, False: 34.6k]
  ------------------
 3012|  10.3k|    pni_close_tail(transport);
 3013|  10.3k|  }
 3014|       |
 3015|  44.9k|  if (n < 0 && n != PN_EOS) return n;
  ------------------
  |  |   47|  10.3k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
  |  Branch (3015:7): [True: 10.3k, False: 34.6k]
  |  Branch (3015:16): [True: 0, False: 10.3k]
  ------------------
 3016|  44.9k|  return 0;
 3017|  44.9k|}
pn_transport_close_tail:
 3021|  20.3k|{
 3022|  20.3k|  pni_close_tail(transport);
 3023|  20.3k|  transport_consume( transport );
 3024|  20.3k|  return 0;
 3025|       |  // XXX: what if not all input processed at this point?  do we care???
 3026|  20.3k|}
pn_transport_pending:
 3030|   266k|{
 3031|   266k|  assert(transport);
 3032|   266k|  return transport_produce( transport );
 3033|   266k|}
pn_transport_head:
 3036|  67.3k|{
 3037|  67.3k|  if (transport && transport->output_pending) {
  ------------------
  |  Branch (3037:7): [True: 67.3k, False: 0]
  |  Branch (3037:20): [True: 67.3k, False: 0]
  ------------------
 3038|  67.3k|    return transport->output_buf;
 3039|  67.3k|  }
 3040|      0|  return NULL;
 3041|  67.3k|}
pn_transport_pop:
 3064|   129k|{
 3065|   129k|  if (transport) {
  ------------------
  |  Branch (3065:7): [True: 129k, False: 0]
  ------------------
 3066|   129k|    assert( transport->output_pending >= size );
 3067|   129k|    transport->output_pending -= size;
 3068|   129k|    transport->bytes_output += size;
 3069|   129k|    if (transport->output_pending) {
  ------------------
  |  Branch (3069:9): [True: 0, False: 129k]
  ------------------
 3070|       |      // TODO: This could be potentially inefficient if we often pop the output without emptying it
 3071|       |      // TODO: as we rotate the buffer here if we have any bytes left to write.
 3072|      0|      memmove( transport->output_buf,  &transport->output_buf[size],
 3073|      0|               transport->output_pending );
 3074|   129k|    } else {
 3075|       |      // If we emptied the output buffer then see if there's more output pending
 3076|   129k|      pn_transport_pending(transport);
 3077|   129k|    }
 3078|   129k|  }
 3079|   129k|}
pn_transport_close_head:
 3082|  30.3k|{
 3083|  30.3k|  ssize_t pending = pn_transport_pending(transport);
 3084|  30.3k|  pni_close_head(transport);
 3085|  30.3k|  if (pending > 0)
  ------------------
  |  Branch (3085:7): [True: 22.4k, False: 7.91k]
  ------------------
 3086|  22.4k|    pn_transport_pop(transport, pending);
 3087|  30.3k|  return 0;
 3088|  30.3k|}
pn_transport_head_closed:
 3107|  61.3k|bool pn_transport_head_closed(pn_transport_t *transport) { return transport->head_closed; }
pn_transport_tail_closed:
 3109|  61.3k|bool pn_transport_tail_closed(pn_transport_t *transport) { return transport->tail_closed; }
transport.c:pni_sequence_make_hash:
   89|  2.33M|{
   90|  2.33M|  return i & 0x00000000FFFFFFFFUL;
   91|  2.33M|}
transport.c:pn_io_layer_setup:
  231|  30.6k|{
  232|  30.6k|  assert(layer == 0);
  233|       |  // Figure out if we are server or not
  234|  30.6k|  if (transport->server) {
  ------------------
  |  Branch (234:7): [True: 0, False: 30.6k]
  ------------------
  235|      0|      transport->io_layers[layer++] = &pni_autodetect_layer;
  236|      0|      return;
  237|      0|  }
  238|  30.6k|  if (transport->ssl) {
  ------------------
  |  Branch (238:7): [True: 0, False: 30.6k]
  ------------------
  239|      0|    transport->io_layers[layer++] = &ssl_layer;
  240|      0|  }
  241|  30.6k|  if (transport->sasl) {
  ------------------
  |  Branch (241:7): [True: 0, False: 30.6k]
  ------------------
  242|      0|    transport->io_layers[layer++] = &sasl_header_layer;
  243|      0|  }
  244|  30.6k|  transport->io_layers[layer++] = &amqp_header_layer;
  245|  30.6k|}
transport.c:pn_io_layer_output_setup:
  254|  30.6k|{
  255|  30.6k|  pn_io_layer_setup(transport, layer);
  256|  30.6k|  return transport->io_layers[layer]->process_output(transport, layer, bytes, available);
  257|  30.6k|}
transport.c:pn_transport_initialize:
  400|  30.6k|{
  401|  30.6k|  pn_transport_t *transport = (pn_transport_t *)object;
  402|  30.6k|  transport->freed = false;
  403|  30.6k|  transport->output_buf = NULL;
  404|  30.6k|  transport->output_size = PN_TRANSPORT_INITIAL_BUFFER_SIZE;
  ------------------
  |  |  181|  30.6k|  #define PN_TRANSPORT_INITIAL_BUFFER_SIZE (8*1024)
  ------------------
  405|  30.6k|  transport->input_buf = NULL;
  406|  30.6k|  transport->input_size =  PN_TRANSPORT_INITIAL_BUFFER_SIZE;
  ------------------
  |  |  181|  30.6k|  #define PN_TRANSPORT_INITIAL_BUFFER_SIZE (8*1024)
  ------------------
  407|  30.6k|  pni_logger_init(&transport->logger);
  408|  30.6k|  transport->tracer = NULL;
  409|  30.6k|  transport->sasl = NULL;
  410|  30.6k|  transport->ssl = NULL;
  411|  30.6k|  transport->frame = pn_buffer(PN_TRANSPORT_INITIAL_FRAME_SIZE);
  ------------------
  |  |   25|  30.6k|# define PN_TRANSPORT_INITIAL_FRAME_SIZE (512) /* bytes */
  ------------------
  412|  30.6k|  transport->input_frames_ct = 0;
  413|  30.6k|  transport->output_frames_ct = 0;
  414|       |
  415|  30.6k|  transport->connection = NULL;
  416|  30.6k|  transport->context = pn_record();
  417|       |
  418|   122k|  for (int layer=0; layer<PN_IO_LAYER_CT; ++layer) {
  ------------------
  |  |  151|   122k|#define PN_IO_LAYER_CT 3
  ------------------
  |  Branch (418:21): [True: 92.0k, False: 30.6k]
  ------------------
  419|  92.0k|    transport->io_layers[layer] = NULL;
  420|  92.0k|  }
  421|       |
  422|  30.6k|  transport->allowed_layers = LAYER_AMQP1 | LAYER_AMQPSASL | LAYER_AMQPSSL | LAYER_SSL;
  ------------------
  |  |  123|  30.6k|#define LAYER_AMQP1    1
  ------------------
                transport->allowed_layers = LAYER_AMQP1 | LAYER_AMQPSASL | LAYER_AMQPSSL | LAYER_SSL;
  ------------------
  |  |  124|  30.6k|#define LAYER_AMQPSASL 2
  ------------------
                transport->allowed_layers = LAYER_AMQP1 | LAYER_AMQPSASL | LAYER_AMQPSSL | LAYER_SSL;
  ------------------
  |  |  125|  30.6k|#define LAYER_AMQPSSL  4
  ------------------
                transport->allowed_layers = LAYER_AMQP1 | LAYER_AMQPSASL | LAYER_AMQPSSL | LAYER_SSL;
  ------------------
  |  |  126|  30.6k|#define LAYER_SSL      8
  ------------------
  423|  30.6k|  transport->present_layers = LAYER_NONE;
  ------------------
  |  |  122|  30.6k|#define LAYER_NONE     0
  ------------------
  424|       |
  425|       |  // Defer setting up the layers until the first data arrives or is sent
  426|  30.6k|  transport->io_layers[0] = &pni_setup_layer;
  427|       |
  428|  30.6k|  transport->open_sent = false;
  429|  30.6k|  transport->open_rcvd = false;
  430|  30.6k|  transport->close_sent = false;
  431|  30.6k|  transport->close_rcvd = false;
  432|  30.6k|  transport->tail_closed = false;
  433|  30.6k|  transport->head_closed = false;
  434|  30.6k|  transport->remote_container = NULL;
  435|  30.6k|  transport->remote_hostname = NULL;
  436|  30.6k|  transport->local_max_frame = PN_DEFAULT_MAX_FRAME_SIZE;
  ------------------
  |  |  144|  30.6k|#define PN_DEFAULT_MAX_FRAME_SIZE (32*1024)
  ------------------
  437|  30.6k|  transport->remote_max_frame = OPEN_MAX_FRAME_SIZE_DEFAULT;
  ------------------
  |  |    9|  30.6k|#define OPEN_MAX_FRAME_SIZE_DEFAULT (4294967295) /* uint */
  ------------------
  438|       |
  439|       |  /*
  440|       |   * We set the local limit on channels to 2^15, because
  441|       |   * parts of the code use the topmost bit (of a short)
  442|       |   * as a flag.
  443|       |   * The peer that this transport connects to may also
  444|       |   * place its own limit on max channel number, and the
  445|       |   * application may also set a limit.
  446|       |   * The maximum that we use will be the minimum of all
  447|       |   * these constraints.
  448|       |   */
  449|       |  // There is no constraint yet from remote peer,
  450|       |  // so set to max possible.
  451|  30.6k|  transport->remote_channel_max = OPEN_CHANNEL_MAX_DEFAULT;
  ------------------
  |  |   11|  30.6k|#define OPEN_CHANNEL_MAX_DEFAULT (65535) /* ushort */
  ------------------
  452|  30.6k|  transport->local_channel_max  = PN_IMPL_CHANNEL_MAX;
  ------------------
  |  |  202|  30.6k|  #define PN_IMPL_CHANNEL_MAX  32767
  ------------------
  453|  30.6k|  transport->channel_max        = transport->local_channel_max;
  454|       |
  455|  30.6k|  transport->local_idle_timeout = 0;
  456|  30.6k|  transport->dead_remote_deadline = 0;
  457|  30.6k|  transport->last_bytes_input = 0;
  458|  30.6k|  transport->remote_idle_timeout = 0;
  459|  30.6k|  transport->keepalive_deadline = 0;
  460|  30.6k|  transport->last_bytes_output = 0;
  461|  30.6k|  transport->remote_offered_capabilities = pn_data(0);
  462|  30.6k|  transport->remote_desired_capabilities = pn_data(0);
  463|  30.6k|  transport->remote_properties = pn_data(0);
  464|  30.6k|  transport->disp_data = pn_data(0);
  465|  30.6k|  pn_condition_init(&transport->remote_condition);
  466|  30.6k|  pn_condition_init(&transport->condition);
  467|  30.6k|  transport->error = pn_error();
  468|       |
  469|  30.6k|  transport->local_channels = pn_hash(PN_WEAKREF, 0, 0.75);
  470|  30.6k|  transport->remote_channels = pn_hash(PN_WEAKREF, 0, 0.75);
  471|       |
  472|  30.6k|  transport->bytes_input = 0;
  473|  30.6k|  transport->bytes_output = 0;
  474|       |
  475|  30.6k|  transport->input_pending = 0;
  476|  30.6k|  transport->output_pending = 0;
  477|       |
  478|  30.6k|  transport->done_processing = false;
  479|       |
  480|  30.6k|  transport->posted_idle_timeout = false;
  481|       |
  482|  30.6k|  transport->server = false;
  483|  30.6k|  transport->halt = false;
  484|  30.6k|  transport->auth_required = false;
  485|  30.6k|  transport->authenticated = false;
  486|  30.6k|  transport->encryption_required = false;
  487|       |
  488|  30.6k|  transport->referenced = true;
  489|  30.6k|}
transport.c:pn_transport_incref:
  523|   166k|{
  524|   166k|  pn_transport_t *transport = (pn_transport_t *) object;
  525|   166k|  if (!transport->referenced) {
  ------------------
  |  Branch (525:7): [True: 0, False: 166k]
  ------------------
  526|      0|    transport->referenced = true;
  527|      0|    if (transport->connection) {
  ------------------
  |  Branch (527:9): [True: 0, False: 0]
  ------------------
  528|      0|      pn_incref(transport->connection);
  529|      0|    } else {
  530|      0|      pn_object_incref(object);
  531|      0|    }
  532|   166k|  } else {
  533|   166k|    pn_object_incref(object);
  534|   166k|  }
  535|   166k|}
transport.c:pn_transport_finalize:
  632|  30.6k|{
  633|  30.6k|  pn_transport_t *transport = (pn_transport_t *) object;
  634|       |
  635|  30.6k|  if (transport->referenced && transport->connection && pn_refcount(transport->connection) > 1) {
  ------------------
  |  Branch (635:7): [True: 30.6k, False: 0]
  |  Branch (635:32): [True: 0, False: 30.6k]
  |  Branch (635:57): [True: 0, False: 0]
  ------------------
  636|      0|    pn_object_incref(transport);
  637|      0|    transport->referenced = false;
  638|      0|    pn_decref(transport->connection);
  639|      0|    return;
  640|      0|  }
  641|       |
  642|       |  // once the application frees the transport, no further I/O
  643|       |  // processing can be done to the connection:
  644|  30.6k|  pn_transport_unbind(transport);
  645|       |  // we may have posted events, so stay alive until they are processed
  646|  30.6k|  if (pn_refcount(transport) > 0) return;
  ------------------
  |  Branch (646:7): [True: 0, False: 30.6k]
  ------------------
  647|       |
  648|  30.6k|  pn_ssl_free(transport);
  649|  30.6k|  pn_sasl_free(transport);
  650|  30.6k|  pni_mem_deallocate(PN_CLASSCLASS(pn_strdup), transport->remote_container);
  ------------------
  |  |  101|  30.6k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  651|  30.6k|  pni_mem_deallocate(PN_CLASSCLASS(pn_strdup), transport->remote_hostname);
  ------------------
  |  |  101|  30.6k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  652|  30.6k|  pn_free(transport->remote_offered_capabilities);
  653|  30.6k|  pn_free(transport->remote_desired_capabilities);
  654|  30.6k|  pn_free(transport->remote_properties);
  655|  30.6k|  pn_free(transport->disp_data);
  656|  30.6k|  pn_condition_tini(&transport->remote_condition);
  657|  30.6k|  pn_condition_tini(&transport->condition);
  658|  30.6k|  pn_error_free(transport->error);
  659|  30.6k|  pn_free(transport->local_channels);
  660|  30.6k|  pn_free(transport->remote_channels);
  661|  30.6k|  pni_mem_subdeallocate(pn_class(transport), transport, transport->input_buf);
  662|  30.6k|  pni_mem_subdeallocate(pn_class(transport), transport, transport->output_buf);
  663|  30.6k|  pn_buffer_free(transport->frame);
  664|  30.6k|  pn_free(transport->context);
  665|  30.6k|  pn_buffer_free(transport->output_buffer);
  666|  30.6k|  pni_logger_fini(&transport->logger);
  667|  30.6k|}
transport.c:pni_post_remote_open_events:
  669|   156k|static void pni_post_remote_open_events(pn_transport_t *transport, pn_connection_t *connection) {
  670|   156k|    pn_collector_put_object(connection->collector, connection, PN_CONNECTION_REMOTE_OPEN);
  671|   156k|    if (transport->remote_idle_timeout) {
  ------------------
  |  Branch (671:9): [True: 3.40k, False: 153k]
  ------------------
  672|  3.40k|      pn_collector_put_object(connection->collector, transport, PN_TRANSPORT);
  673|  3.40k|    }
  674|   156k|}
transport.c:pni_delivery_map_clear:
  126|  1.36M|{
  127|  1.36M|  pn_hash_t *hash = dm->deliveries;
  128|  1.36M|  for (pn_handle_t entry = pn_hash_head(hash);
  129|  1.48M|       entry;
  ------------------
  |  Branch (129:8): [True: 123k, False: 1.36M]
  ------------------
  130|  1.36M|       entry = pn_hash_next(hash, entry))
  131|   123k|  {
  132|   123k|    pn_delivery_t *dlv = (pn_delivery_t *) pn_hash_value(hash, entry);
  133|   123k|    pn_delivery_map_del(dm, dlv);
  134|   123k|  }
  135|  1.36M|  dm->next = 0;
  136|  1.36M|}
transport.c:pni_transport_collector:
  967|   143k|{
  968|   143k|  if (transport->connection && transport->connection->collector) {
  ------------------
  |  Branch (968:7): [True: 143k, False: 0]
  |  Branch (968:32): [True: 143k, False: 0]
  ------------------
  969|   143k|    return transport->connection->collector;
  970|   143k|  } else {
  971|      0|    return NULL;
  972|      0|  }
  973|   143k|}
transport.c:pni_close_tail:
  984|  51.5k|{
  985|  51.5k|  if (!transport->tail_closed) {
  ------------------
  |  Branch (985:7): [True: 30.6k, False: 20.9k]
  ------------------
  986|  30.6k|    transport->tail_closed = true;
  987|  30.6k|    pn_collector_t *collector = pni_transport_collector(transport);
  988|  30.6k|    pn_collector_put_object(collector, transport, PN_TRANSPORT_TAIL_CLOSED);
  989|  30.6k|    pni_maybe_post_closed(transport);
  990|  30.6k|  }
  991|  51.5k|}
transport.c:pni_maybe_post_closed:
  976|  61.3k|{
  977|  61.3k|  pn_collector_t *collector = pni_transport_collector(transport);
  978|  61.3k|  if (transport->head_closed && transport->tail_closed) {
  ------------------
  |  Branch (978:7): [True: 30.8k, False: 30.5k]
  |  Branch (978:33): [True: 30.6k, False: 145]
  ------------------
  979|  30.6k|    pn_collector_put_object(collector, transport, PN_TRANSPORT_CLOSED);
  980|  30.6k|  }
  981|  61.3k|}
transport.c:pn_bytes_strdup:
 1041|  8.39k|{
 1042|  8.39k|  return pn_strndup(str.start, str.size);
 1043|  8.39k|}
transport.c:pni_calculate_channel_max:
   57|   187k|static void pni_calculate_channel_max(pn_transport_t *transport) {
   58|       |  /*
   59|       |   * The application cannot make the limit larger than
   60|       |   * what this library will allow.
   61|       |   */
   62|   187k|  transport->channel_max = (PN_IMPL_CHANNEL_MAX < transport->local_channel_max)
  ------------------
  |  |  202|   187k|  #define PN_IMPL_CHANNEL_MAX  32767
  ------------------
  |  Branch (62:28): [True: 0, False: 187k]
  ------------------
   63|   187k|                           ? PN_IMPL_CHANNEL_MAX
  ------------------
  |  |  202|      0|  #define PN_IMPL_CHANNEL_MAX  32767
  ------------------
   64|   187k|                           : transport->local_channel_max;
   65|       |
   66|       |  /*
   67|       |   * The remote peer's constraint is not valid until the
   68|       |   * peer's open frame has been received.
   69|       |   */
   70|   187k|  if(transport->open_rcvd) {
  ------------------
  |  Branch (70:6): [True: 156k, False: 30.6k]
  ------------------
   71|   156k|    transport->channel_max = (transport->channel_max < transport->remote_channel_max)
  ------------------
  |  Branch (71:30): [True: 156k, False: 531]
  ------------------
   72|   156k|                             ? transport->channel_max
   73|   156k|                             : transport->remote_channel_max;
   74|   156k|  }
   75|   187k|}
transport.c:pni_map_remote_channel:
  498|   686k|{
  499|   686k|  pn_transport_t *transport = session->connection->transport;
  500|   686k|  pn_hash_put(transport->remote_channels, channel, session);
  501|   686k|  session->state.remote_channel = channel;
  502|   686k|  pn_ep_incref(&session->endpoint);
  503|   686k|}
transport.c:pni_channel_state:
  493|  2.47M|{
  494|  2.47M|  return (pn_session_t *) pn_hash_get(transport->remote_channels, channel);
  495|  2.47M|}
transport.c:pni_find_link:
 1147|  1.23M|{
 1148|  1.23M|  pn_endpoint_type_t type = is_sender ? SENDER : RECEIVER;
  ------------------
  |  Branch (1148:29): [True: 268k, False: 962k]
  ------------------
 1149|       |
 1150|   504M|  for (size_t i = 0; i < pn_list_size(ssn->links); i++)
  ------------------
  |  Branch (1150:22): [True: 503M, False: 1.23M]
  ------------------
 1151|   503M|  {
 1152|   503M|    pn_link_t *link = (pn_link_t *) pn_list_get(ssn->links, i);
 1153|   503M|    if (link->endpoint.type == type &&
  ------------------
  |  Branch (1153:9): [True: 464M, False: 38.9M]
  ------------------
 1154|       |        // This function is used to locate the link object for an
 1155|       |        // incoming attach. If a link object of the same name is found
 1156|       |        // which is remotely closed or detached, assume that is
 1157|       |        // no longer in use and a new link is intended.
 1158|   503M|        (!(link->endpoint.state & PN_REMOTE_CLOSED) && ((int32_t) link->state.remote_handle != -2)) &&
  ------------------
  |  |   75|   464M|#define PN_REMOTE_CLOSED (32)
  ------------------
  |  Branch (1158:10): [True: 455M, False: 9.04M]
  |  Branch (1158:56): [True: 444M, False: 10.9M]
  ------------------
 1159|   503M|        pn_bytes_equal(name, pn_string_bytes(link->name)))
  ------------------
  |  Branch (1159:9): [True: 500, False: 444M]
  ------------------
 1160|    500|    {
 1161|    500|      return link;
 1162|    500|    }
 1163|   503M|  }
 1164|  1.23M|  return NULL;
 1165|  1.23M|}
transport.c:pni_map_remote_handle:
  817|  1.23M|{
  818|  1.23M|  link->state.remote_handle = handle;
  819|  1.23M|  pn_hash_put(link->session->state.remote_handles, handle, link);
  820|  1.23M|  pn_ep_incref(&link->endpoint);
  821|  1.23M|}
transport.c:set_expiry_policy_from_symbol:
 1168|  61.8k|{
 1169|  61.8k|  if (symbol.start) {
  ------------------
  |  Branch (1169:7): [True: 12.1k, False: 49.7k]
  ------------------
 1170|  12.1k|    if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(link-detach)))
  ------------------
  |  |  102|  12.1k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1170:9): [True: 227, False: 11.8k]
  ------------------
 1171|    227|      pn_terminus_set_expiry_policy(terminus, PN_EXPIRE_WITH_LINK);
 1172|  12.1k|    if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(session-end)))
  ------------------
  |  |  102|  12.1k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1172:9): [True: 2.58k, False: 9.51k]
  ------------------
 1173|  2.58k|      pn_terminus_set_expiry_policy(terminus, PN_EXPIRE_WITH_SESSION);
 1174|  12.1k|    if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(connection-close)))
  ------------------
  |  |  102|  12.1k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1174:9): [True: 99, False: 12.0k]
  ------------------
 1175|     99|      pn_terminus_set_expiry_policy(terminus, PN_EXPIRE_WITH_CONNECTION);
 1176|  12.1k|    if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(never)))
  ------------------
  |  |  102|  12.1k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1176:9): [True: 111, False: 11.9k]
  ------------------
 1177|    111|      pn_terminus_set_expiry_policy(terminus, PN_EXPIRE_NEVER);
 1178|  12.1k|  }
 1179|  61.8k|}
transport.c:symbol2dist_mode:
 1182|  47.9k|{
 1183|  47.9k|  if (!symbol.start)
  ------------------
  |  Branch (1183:7): [True: 46.4k, False: 1.57k]
  ------------------
 1184|  46.4k|    return PN_DIST_MODE_UNSPECIFIED;
 1185|       |
 1186|  1.57k|  if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(move)))
  ------------------
  |  |  102|  1.57k|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1186:7): [True: 899, False: 676]
  ------------------
 1187|    899|    return PN_DIST_MODE_MOVE;
 1188|    676|  if (pn_bytes_equal(symbol, PN_BYTES_LITERAL(copy)))
  ------------------
  |  |  102|    676|#define PN_BYTES_LITERAL(X) (pn_bytes(sizeof(#X)-1, #X))
  ------------------
  |  Branch (1188:7): [True: 18, False: 658]
  ------------------
 1189|     18|    return PN_DIST_MODE_COPY;
 1190|       |
 1191|    658|  return PN_DIST_MODE_UNSPECIFIED;
 1192|    676|}
transport.c:pni_handle_state:
  835|  1.12M|{
  836|  1.12M|  return (pn_link_t *) pn_hash_get(ssn->state.remote_handles, handle);
  837|  1.12M|}
transport.c:pni_delivery_map_push:
  108|  1.03M|{
  109|  1.03M|  pn_delivery_state_t *ds = &delivery->state;
  110|  1.03M|  pn_delivery_state_init(ds, delivery, db->next++);
  111|  1.03M|  pn_hash_put(db->deliveries, pni_sequence_make_hash(ds->id), delivery);
  112|  1.03M|  return ds;
  113|  1.03M|}
transport.c:pn_delivery_state_init:
  100|  1.03M|{
  101|  1.03M|  ds->id = id;
  102|  1.03M|  ds->sending = false;
  103|  1.03M|  ds->sent = false;
  104|  1.03M|  ds->init = true;
  105|  1.03M|}
transport.c:sequence_lte:
 1579|  3.96M|static inline bool sequence_lte(pn_sequence_t a, pn_sequence_t b) {
 1580|  3.96M|  return b-a <= INT32_MAX;
 1581|  3.96M|}
transport.c:pni_do_delivery_disposition:
 1583|  1.28M|static int pni_do_delivery_disposition(pn_transport_t * transport, pn_delivery_t *delivery, bool settled, bool remote_data, bool type_init, uint64_t type, pn_bytes_t disp_data) {
 1584|  1.28M|  pn_disposition_t *remote = &delivery->remote;
 1585|       |
 1586|  1.28M|  if (type_init) remote->type = type;
  ------------------
  |  Branch (1586:7): [True: 221k, False: 1.06M]
  ------------------
 1587|       |
 1588|  1.28M|  if (remote_data) {
  ------------------
  |  Branch (1588:7): [True: 221k, False: 1.06M]
  ------------------
 1589|   221k|    switch (type) {
 1590|  6.15k|      case PN_RECEIVED: {
  ------------------
  |  |   58|  6.15k|#define PN_RECEIVED (0x0000000000000023)
  ------------------
  |  Branch (1590:7): [True: 6.15k, False: 215k]
  ------------------
 1591|  6.15k|        bool qnumber;
 1592|  6.15k|        uint32_t number;
 1593|  6.15k|        bool qoffset;
 1594|  6.15k|        uint64_t offset;
 1595|  6.15k|        pn_amqp_decode_DqEQIQLe(disp_data, &qnumber, &number, &qoffset, &offset);
 1596|       |
 1597|  6.15k|        if (qnumber) {
  ------------------
  |  Branch (1597:13): [True: 406, False: 5.74k]
  ------------------
 1598|    406|          remote->section_number = number;
 1599|    406|        }
 1600|  6.15k|        if (qoffset) {
  ------------------
  |  Branch (1600:13): [True: 366, False: 5.78k]
  ------------------
 1601|    366|          remote->section_offset = offset;
 1602|    366|        }
 1603|  6.15k|        break;
 1604|      0|      }
 1605|  1.43k|      case PN_ACCEPTED:
  ------------------
  |  |   66|  1.43k|#define PN_ACCEPTED (0x0000000000000024)
  ------------------
  |  Branch (1605:7): [True: 1.43k, False: 220k]
  ------------------
 1606|  1.43k|        break;
 1607|       |
 1608|  18.7k|      case PN_REJECTED: {
  ------------------
  |  |   74|  18.7k|#define PN_REJECTED (0x0000000000000025)
  ------------------
  |  Branch (1608:7): [True: 18.7k, False: 203k]
  ------------------
 1609|  18.7k|        pn_bytes_t cond;
 1610|  18.7k|        pn_bytes_t desc;
 1611|  18.7k|        pn_data_t *info = pn_condition_info(&remote->condition);
 1612|  18.7k|        pn_data_clear(info);
 1613|  18.7k|        pn_amqp_decode_DqEDqEsSCee(disp_data, &cond, &desc, info);
 1614|  18.7k|        pn_data_rewind(info);
 1615|  18.7k|        pn_condition_set(&remote->condition, cond, desc);
 1616|       |
 1617|  18.7k|        break;
 1618|      0|      }
 1619|    581|      case PN_RELEASED:
  ------------------
  |  |   82|    581|#define PN_RELEASED (0x0000000000000026)
  ------------------
  |  Branch (1619:7): [True: 581, False: 221k]
  ------------------
 1620|    581|        break;
 1621|       |
 1622|   167k|      case PN_MODIFIED: {
  ------------------
  |  |   91|   167k|#define PN_MODIFIED (0x0000000000000027)
  ------------------
  |  Branch (1622:7): [True: 167k, False: 53.8k]
  ------------------
 1623|   167k|        bool qfailed;
 1624|   167k|        bool failed;
 1625|   167k|        bool qundeliverable;
 1626|   167k|        bool undeliverable;
 1627|   167k|        pn_data_clear(remote->annotations);
 1628|   167k|        pn_amqp_decode_DqEQoQoCe(disp_data, &qfailed, &failed, &qundeliverable, &undeliverable, remote->annotations);
 1629|   167k|        pn_data_rewind(remote->annotations);
 1630|       |
 1631|   167k|        if (qfailed) {
  ------------------
  |  Branch (1631:13): [True: 44.7k, False: 123k]
  ------------------
 1632|  44.7k|          remote->failed = failed;
 1633|  44.7k|        }
 1634|   167k|        if (qundeliverable) {
  ------------------
  |  Branch (1634:13): [True: 54.9k, False: 112k]
  ------------------
 1635|  54.9k|          remote->undeliverable = undeliverable;
 1636|  54.9k|        }
 1637|   167k|        break;
 1638|      0|      }
 1639|  26.9k|      default:
  ------------------
  |  Branch (1639:7): [True: 26.9k, False: 194k]
  ------------------
 1640|  26.9k|        pn_data_clear(remote->data);
 1641|  26.9k|        pn_amqp_decode_DqC(disp_data, remote->data);
 1642|  26.9k|        pn_data_rewind(remote->data);
 1643|  26.9k|        break;
 1644|   221k|    }
 1645|   221k|  }
 1646|       |
 1647|  1.28M|  remote->settled = settled;
 1648|  1.28M|  delivery->updated = true;
 1649|  1.28M|  pn_work_update(transport->connection, delivery);
 1650|       |
 1651|  1.28M|  pn_collector_put_object(transport->connection->collector, delivery, PN_DELIVERY);
 1652|  1.28M|  return 0;
 1653|  1.28M|}
transport.c:pni_delivery_map_get:
   95|   267k|{
   96|   267k|  return (pn_delivery_t *) pn_hash_get(db->deliveries, pni_sequence_make_hash(id) );
   97|   267k|}
transport.c:pn_condition_set:
 1568|  67.4k|{
 1569|  67.4k|  if (condition->name == NULL) {
  ------------------
  |  Branch (1569:7): [True: 52.0k, False: 15.3k]
  ------------------
 1570|  52.0k|    condition->name = pn_string(NULL);
 1571|  52.0k|  }
 1572|  67.4k|  pn_string_setn(condition->name, cond.start, cond.size);
 1573|  67.4k|  if (condition->description == NULL) {
  ------------------
  |  Branch (1573:7): [True: 52.0k, False: 15.3k]
  ------------------
 1574|  52.0k|    condition->description = pn_string(NULL);
 1575|  52.0k|  }
 1576|  67.4k|  pn_string_setn(condition->description, desc.start, desc.size);
 1577|  67.4k|}
transport.c:pni_unmap_remote_handle:
  824|  43.6k|{
  825|  43.6k|  uintptr_t handle = link->state.remote_handle;
  826|  43.6k|  link->state.remote_handle = -2;
  827|  43.6k|  if (pn_hash_get(link->session->state.remote_handles, handle)) {
  ------------------
  |  Branch (827:7): [True: 43.6k, False: 0]
  ------------------
  828|  43.6k|    pn_ep_decref(&link->endpoint);
  829|  43.6k|  }
  830|       |  // may delete link:
  831|  43.6k|  pn_hash_del(link->session->state.remote_handles, handle);
  832|  43.6k|}
transport.c:pni_unmap_remote_channel:
  508|  3.41k|{
  509|       |  // XXX: should really update link state also
  510|  3.41k|  pni_delivery_map_clear(&ssn->state.incoming);
  511|  3.41k|  pni_transport_unbind_handles(ssn->state.remote_handles, false);
  512|  3.41k|  pn_transport_t *transport = ssn->connection->transport;
  513|  3.41k|  uint16_t channel = ssn->state.remote_channel;
  514|  3.41k|  ssn->state.remote_channel = -2;
  515|  3.41k|  if (pn_hash_get(transport->remote_channels, channel)) {
  ------------------
  |  Branch (515:7): [True: 3.19k, False: 211]
  ------------------
  516|  3.19k|    pn_ep_decref(&ssn->endpoint);
  517|  3.19k|  }
  518|       |  // note: may free the session:
  519|  3.41k|  pn_hash_del(transport->remote_channels, channel);
  520|  3.41k|}
transport.c:transport_consume:
 1816|  65.3k|{
 1817|       |  // This allows whatever is driving the I/O to set the error
 1818|       |  // condition on the transport before doing pn_transport_close_head()
 1819|       |  // or pn_transport_close_tail(). This allows all transport errors to
 1820|       |  // flow to the app the same way, but provides cleaner error messages
 1821|       |  // since we don't try to look for a protocol header when, e.g. the
 1822|       |  // connection was refused.
 1823|  65.3k|  if (!(transport->present_layers & LAYER_AMQP1) && transport->tail_closed &&
  ------------------
  |  |  123|  65.3k|#define LAYER_AMQP1    1
  ------------------
  |  Branch (1823:7): [True: 30.7k, False: 34.5k]
  |  Branch (1823:53): [True: 59, False: 30.6k]
  ------------------
 1824|  65.3k|      pn_condition_is_set(&transport->condition)) {
  ------------------
  |  Branch (1824:7): [True: 0, False: 59]
  ------------------
 1825|      0|    pn_do_error(transport, NULL, NULL);
 1826|      0|    return PN_EOS;
  ------------------
  |  |   47|      0|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 1827|      0|  }
 1828|       |
 1829|  65.3k|  size_t consumed = 0;
 1830|       |
 1831|   129k|  while (transport->input_pending || transport->tail_closed) {
  ------------------
  |  Branch (1831:10): [True: 104k, False: 25.2k]
  |  Branch (1831:38): [True: 12.5k, False: 12.6k]
  ------------------
 1832|   117k|    ssize_t n;
 1833|   117k|    n = transport->io_layers[0]->
 1834|   117k|      process_input( transport, 0,
 1835|   117k|                     transport->input_buf + consumed,
 1836|   117k|                     transport->input_pending );
 1837|   117k|    if (n > 0) {
  ------------------
  |  Branch (1837:9): [True: 64.4k, False: 52.6k]
  ------------------
 1838|  64.4k|      consumed += n;
 1839|  64.4k|      transport->input_pending -= n;
 1840|  64.4k|    } else if (n == 0) {
  ------------------
  |  Branch (1840:16): [True: 29.7k, False: 22.9k]
  ------------------
 1841|  29.7k|      break;
 1842|  29.7k|    } else {
 1843|  22.9k|      assert(n == PN_EOS);
 1844|  22.9k|      PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP | PN_SUBSYSTEM_IO, PN_LEVEL_FRAME | PN_LEVEL_RAW, "  <- EOS");
  ------------------
  |  |   54|  22.9k|    do { \
  |  |   55|  22.9k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   51|  22.9k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  |  |  Branch (51:38): [True: 22.9k, False: 0]
  |  |  |  |  |  Branch (51:73): [True: 0, False: 22.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|  22.9k|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   57|  22.9k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (57:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1845|  22.9k|      transport->input_pending = 0;  // XXX ???
 1846|  22.9k|      return n;
 1847|  22.9k|    }
 1848|   117k|  }
 1849|       |
 1850|  42.4k|  if (transport->input_pending && consumed) {
  ------------------
  |  Branch (1850:7): [True: 29.7k, False: 12.6k]
  |  Branch (1850:35): [True: 21.4k, False: 8.23k]
  ------------------
 1851|  21.4k|    memmove( transport->input_buf,  &transport->input_buf[consumed], transport->input_pending );
 1852|  21.4k|  }
 1853|       |
 1854|  42.4k|  return consumed;
 1855|  65.3k|}
transport.c:pni_post_flow:
 2086|  30.6k|{
 2087|  30.6k|  ssn->state.incoming_window = pni_session_incoming_window(ssn);
 2088|  30.6k|  ssn->state.outgoing_window = pni_session_outgoing_window(ssn);
 2089|  30.6k|  bool linkq = (bool) link;
 2090|  30.6k|  pn_link_state_t *state = &link->state;
 2091|       |  /* "DL[?IIII?I?I?In?o]" */
 2092|  30.6k|  pn_bytes_t buf = pn_amqp_encode_DLEQIIIIQIQIQInQoe(transport->frame, FLOW,
  ------------------
  |  |  147|  30.6k|#define FLOW ((uint64_t) 19)
  ------------------
 2093|  30.6k|                       (int16_t) ssn->state.remote_channel >= 0, ssn->state.incoming_transfer_count,
 2094|  30.6k|                       ssn->state.incoming_window,
 2095|  30.6k|                       ssn->state.outgoing_transfer_count,
 2096|  30.6k|                       ssn->state.outgoing_window,
 2097|  30.6k|                       linkq, linkq ? state->local_handle : 0,
  ------------------
  |  Branch (2097:31): [True: 30.6k, False: 0]
  ------------------
 2098|  30.6k|                       linkq, linkq ? state->delivery_count : 0,
  ------------------
  |  Branch (2098:31): [True: 30.6k, False: 0]
  ------------------
 2099|  30.6k|                       linkq, linkq ? state->link_credit : 0,
  ------------------
  |  Branch (2099:31): [True: 30.6k, False: 0]
  ------------------
 2100|  30.6k|                       linkq, linkq ? link->drain : false);
  ------------------
  |  Branch (2100:31): [True: 30.6k, False: 0]
  ------------------
 2101|  30.6k|  return pn_framing_send_amqp(transport, ssn->state.local_channel, buf);
 2102|  30.6k|}
transport.c:pni_session_incoming_window:
 1912|  61.3k|{
 1913|  61.3k|  pn_transport_t *t = ssn->connection->transport;
 1914|  61.3k|  uint32_t size = t->local_max_frame;
 1915|  61.3k|  size_t capacity = ssn->incoming_capacity;
 1916|  61.3k|  if (!size || !capacity) {     /* session flow control is not enabled */
  ------------------
  |  Branch (1916:7): [True: 0, False: 61.3k]
  |  Branch (1916:16): [True: 61.3k, False: 0]
  ------------------
 1917|  61.3k|    return AMQP_MAX_WINDOW_SIZE;
  ------------------
  |  |   35|  61.3k|#define AMQP_MAX_WINDOW_SIZE (2147483647)
  ------------------
 1918|  61.3k|  } else if (capacity >= size) { /* precondition */
  ------------------
  |  Branch (1918:14): [True: 0, False: 0]
  ------------------
 1919|      0|    return (capacity - ssn->incoming_bytes) / size;
 1920|      0|  } else {                     /* error: we will never have a non-zero window */
 1921|      0|    pn_condition_format(
 1922|      0|      pn_transport_condition(t),
 1923|      0|      "amqp:internal-error",
 1924|      0|      "session capacity %zu is less than frame size %" PRIu32,
 1925|      0|      capacity, size);
 1926|      0|    pn_transport_close_tail(t);
 1927|      0|    return 0;
 1928|      0|  }
 1929|  61.3k|}
transport.c:pni_session_outgoing_window:
 1907|  61.3k|{
 1908|  61.3k|  return ssn->outgoing_window;
 1909|  61.3k|}
transport.c:pn_error_amqp:
 2552|  20.9k|{
 2553|  20.9k|  if (!transport->close_sent) {
  ------------------
  |  Branch (2553:7): [True: 20.8k, False: 99]
  ------------------
 2554|  20.8k|    if (!transport->open_sent) {
  ------------------
  |  Branch (2554:9): [True: 0, False: 20.8k]
  ------------------
 2555|       |      /* "DL[S]" */
 2556|      0|      pn_bytes_t buf = pn_amqp_encode_DLESe(transport->frame, OPEN, "");
  ------------------
  |  |  141|      0|#define OPEN ((uint64_t) 16)
  ------------------
 2557|      0|      pn_framing_send_amqp(transport, 0, buf);
 2558|      0|    }
 2559|       |
 2560|  20.8k|    pni_post_close(transport, &transport->condition);
 2561|  20.8k|    transport->close_sent = true;
 2562|  20.8k|  }
 2563|  20.9k|  transport->halt = true;
 2564|  20.9k|  transport->done_processing = true;
 2565|  20.9k|}
transport.c:pni_post_close:
  948|  21.2k|{
  949|  21.2k|  if (!cond && transport->connection) {
  ------------------
  |  Branch (949:7): [True: 401, False: 20.8k]
  |  Branch (949:16): [True: 401, False: 0]
  ------------------
  950|    401|    cond = pn_connection_condition(transport->connection);
  951|    401|  }
  952|  21.2k|  const char *condition = NULL;
  953|  21.2k|  const char *description = NULL;
  954|  21.2k|  pn_data_t *info = NULL;
  955|  21.2k|  if (pn_condition_is_set(cond)) {
  ------------------
  |  Branch (955:7): [True: 20.8k, False: 401]
  ------------------
  956|  20.8k|    condition = pn_condition_get_name(cond);
  957|  20.8k|    description = pn_condition_get_description(cond);
  958|  20.8k|    info = pn_condition_info(cond);
  959|  20.8k|  }
  960|       |  /* "DL[?DL[sSC]]" */
  961|  21.2k|  pn_bytes_t buf = pn_amqp_encode_DLEQDLEsSCee(transport->frame, CLOSE,
  ------------------
  |  |  157|  21.2k|#define CLOSE ((uint64_t) 24)
  ------------------
  962|  21.2k|                       (bool) condition, ERROR, condition, description, info);
  ------------------
  |  |  159|  21.2k|#define ERROR ((uint64_t) 29)
  ------------------
  963|  21.2k|  return pn_framing_send_amqp(transport, 0, buf);
  964|  21.2k|}
transport.c:pn_input_read_amqp_header:
 2568|  30.7k|{
 2569|  30.7k|  bool eos = transport->tail_closed;
 2570|  30.7k|  if (eos && available==0) {
  ------------------
  |  Branch (2570:7): [True: 59, False: 30.6k]
  |  Branch (2570:14): [True: 0, False: 59]
  ------------------
 2571|      0|    pn_do_error(transport, "amqp:connection:framing-error",
 2572|      0|                "Expected AMQP protocol header: no protocol header found (connection aborted)");
 2573|      0|    return PN_EOS;
  ------------------
  |  |   47|      0|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2574|      0|  }
 2575|  30.7k|  pni_protocol_type_t protocol = pni_sniff_header(bytes, available);
 2576|  30.7k|  switch (protocol) {
 2577|  30.3k|  case PNI_PROTOCOL_AMQP1:
  ------------------
  |  Branch (2577:3): [True: 30.3k, False: 376]
  ------------------
 2578|  30.3k|    transport->present_layers |= LAYER_AMQP1;
  ------------------
  |  |  123|  30.3k|#define LAYER_AMQP1    1
  ------------------
 2579|  30.3k|    if (transport->io_layers[layer] == &amqp_read_header_layer) {
  ------------------
  |  Branch (2579:9): [True: 30.3k, False: 0]
  ------------------
 2580|  30.3k|      transport->io_layers[layer] = &amqp_layer;
 2581|  30.3k|    } else {
 2582|      0|      transport->io_layers[layer] = &amqp_write_header_layer;
 2583|      0|    }
 2584|  30.3k|    PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_FRAME, "  <- %s", "AMQP");
  ------------------
  |  |   54|  30.3k|    do { \
  |  |   55|  30.3k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   51|  30.3k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  |  |  Branch (51:38): [True: 30.3k, False: 0]
  |  |  |  |  |  Branch (51:73): [True: 0, False: 30.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|  30.3k|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   57|  30.3k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (57:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2585|  30.3k|    return 8;
 2586|    118|  case PNI_PROTOCOL_INSUFFICIENT:
  ------------------
  |  Branch (2586:3): [True: 118, False: 30.6k]
  ------------------
 2587|    118|    if (!eos) return 0;
  ------------------
  |  Branch (2587:9): [True: 59, False: 59]
  ------------------
 2588|       |    /* Fallthru */
 2589|    317|  default:
  ------------------
  |  Branch (2589:3): [True: 258, False: 30.4k]
  ------------------
 2590|    317|    break;
 2591|  30.7k|  }
 2592|    317|  char quoted[1024];
 2593|    317|  pn_quote_data(quoted, 1024, bytes, available);
 2594|    317|  pn_do_error(transport, "amqp:connection:framing-error",
 2595|    317|              "Expected AMQP protocol header got: %s ['%s']%s", pni_protocol_name(protocol), quoted,
 2596|    317|              !eos ? "" : " (connection aborted)");
  ------------------
  |  Branch (2596:15): [True: 258, False: 59]
  ------------------
 2597|    317|  return PN_EOS;
  ------------------
  |  |   47|    317|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2598|  30.7k|}
transport.c:pn_input_read_amqp:
 2601|  86.4k|{
 2602|  86.4k|  if (transport->close_rcvd) {
  ------------------
  |  Branch (2602:7): [True: 0, False: 86.4k]
  ------------------
 2603|      0|    if (available > 0) {
  ------------------
  |  Branch (2603:9): [True: 0, False: 0]
  ------------------
 2604|      0|      pn_do_error(transport, "amqp:connection:framing-error", "data after close");
 2605|      0|      return PN_EOS;
  ------------------
  |  |   47|      0|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2606|      0|    }
 2607|      0|  }
 2608|       |
 2609|  86.4k|  if (!transport->close_rcvd && !available) {
  ------------------
  |  Branch (2609:7): [True: 86.4k, False: 0]
  |  Branch (2609:33): [True: 12.5k, False: 73.8k]
  ------------------
 2610|  12.5k|    pn_do_error(transport, "amqp:connection:framing-error", "connection aborted");
 2611|  12.5k|    return PN_EOS;
  ------------------
  |  |   47|  12.5k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2612|  12.5k|  }
 2613|       |
 2614|       |
 2615|  73.8k|  ssize_t n = pn_dispatcher_input(transport, bytes, available, true, &transport->halt);
 2616|  73.8k|  if (n < 0 || transport->close_rcvd) {
  ------------------
  |  Branch (2616:7): [True: 9.89k, False: 63.9k]
  |  Branch (2616:16): [True: 165, False: 63.7k]
  ------------------
 2617|  10.0k|    return PN_EOS;
  ------------------
  |  |   47|  10.0k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2618|  63.7k|  } else {
 2619|  63.7k|    return n;
 2620|  63.7k|  }
 2621|  73.8k|}
transport.c:pn_output_write_amqp_header:
 2666|  30.6k|{
 2667|  30.6k|  PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_FRAME, "  -> %s", "AMQP");
  ------------------
  |  |   54|  30.6k|    do { \
  |  |   55|  30.6k|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   51|  30.6k|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  |  |  Branch (51:38): [True: 30.6k, False: 0]
  |  |  |  |  |  Branch (51:73): [True: 0, False: 30.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|  30.6k|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   57|  30.6k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (57:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2668|  30.6k|  assert(available >= 8);
 2669|  30.6k|  memmove(bytes, AMQP_HEADER, 8);
  ------------------
  |  | 2549|  30.6k|#define AMQP_HEADER ("AMQP\x00\x01\x00\x00")
  ------------------
 2670|  30.6k|  if (pn_condition_is_set(&transport->condition)) {
  ------------------
  |  Branch (2670:7): [True: 0, False: 30.6k]
  ------------------
 2671|      0|      pn_error_amqp(transport, layer);
 2672|      0|    transport->io_layers[layer] = &pni_error_layer;
 2673|      0|    return pn_dispatcher_output(transport, bytes+8, available-8) + 8;
 2674|      0|  }
 2675|       |
 2676|  30.6k|  if (transport->io_layers[layer] == &amqp_write_header_layer) {
  ------------------
  |  Branch (2676:7): [True: 0, False: 30.6k]
  ------------------
 2677|      0|    transport->io_layers[layer] = &amqp_layer;
 2678|  30.6k|  } else {
 2679|  30.6k|    transport->io_layers[layer] = &amqp_read_header_layer;
 2680|  30.6k|  }
 2681|  30.6k|  return 8;
 2682|  30.6k|}
transport.c:pn_output_write_amqp:
 2685|   299k|{
 2686|   299k|  if (transport->connection && !transport->done_processing) {
  ------------------
  |  Branch (2686:7): [True: 237k, False: 61.3k]
  |  Branch (2686:32): [True: 196k, False: 41.7k]
  ------------------
 2687|   196k|    int err = pni_process(transport);
 2688|   196k|    if (err) {
  ------------------
  |  Branch (2688:9): [True: 0, False: 196k]
  ------------------
 2689|      0|      pn_logger_logf(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_ERROR, "process error %i", err);
 2690|      0|      transport->done_processing = true;
 2691|      0|    }
 2692|   196k|  }
 2693|       |
 2694|       |  // write out any buffered data _before_ returning PN_EOS, else we
 2695|       |  // could truncate an outgoing Close frame containing a useful error
 2696|       |  // status
 2697|   299k|  if (!pn_buffer_size(transport->output_buffer) && transport->close_sent) {
  ------------------
  |  Branch (2697:7): [True: 240k, False: 58.6k]
  |  Branch (2697:52): [True: 21.5k, False: 219k]
  ------------------
 2698|  21.5k|    return PN_EOS;
  ------------------
  |  |   47|  21.5k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
 2699|  21.5k|  }
 2700|       |
 2701|   277k|  return pn_dispatcher_output(transport, bytes, available);
 2702|   299k|}
transport.c:pni_process:
 2522|   196k|{
 2523|   196k|  int err;
 2524|   196k|  if ((err = pni_phase(transport, pni_process_conn_setup))) return err;
  ------------------
  |  Branch (2524:7): [True: 0, False: 196k]
  ------------------
 2525|   196k|  if ((err = pni_phase(transport, pni_process_ssn_setup))) return err;
  ------------------
  |  Branch (2525:7): [True: 0, False: 196k]
  ------------------
 2526|   196k|  if ((err = pni_phase(transport, pni_process_link_setup))) return err;
  ------------------
  |  Branch (2526:7): [True: 0, False: 196k]
  ------------------
 2527|   196k|  if ((err = pni_phase(transport, pni_process_flow_receiver))) return err;
  ------------------
  |  Branch (2527:7): [True: 0, False: 196k]
  ------------------
 2528|       |
 2529|       |  // XXX: this has to happen two times because we might settle stuff
 2530|       |  // on the first pass and create space for more work to be done on the
 2531|       |  // second pass
 2532|   196k|  if ((err = pni_phase(transport, pni_process_tpwork))) return err;
  ------------------
  |  Branch (2532:7): [True: 0, False: 196k]
  ------------------
 2533|   196k|  if ((err = pni_phase(transport, pni_process_tpwork))) return err;
  ------------------
  |  Branch (2533:7): [True: 0, False: 196k]
  ------------------
 2534|       |
 2535|   196k|  if ((err = pni_phase(transport, pni_process_flush_disp))) return err;
  ------------------
  |  Branch (2535:7): [True: 0, False: 196k]
  ------------------
 2536|       |
 2537|   196k|  if ((err = pni_phase(transport, pni_process_flow_sender))) return err;
  ------------------
  |  Branch (2537:7): [True: 0, False: 196k]
  ------------------
 2538|   196k|  if ((err = pni_phase(transport, pni_process_link_teardown))) return err;
  ------------------
  |  Branch (2538:7): [True: 0, False: 196k]
  ------------------
 2539|   196k|  if ((err = pni_phase(transport, pni_process_ssn_teardown))) return err;
  ------------------
  |  Branch (2539:7): [True: 0, False: 196k]
  ------------------
 2540|   196k|  if ((err = pni_phase(transport, pni_process_conn_teardown))) return err;
  ------------------
  |  Branch (2540:7): [True: 0, False: 196k]
  ------------------
 2541|       |
 2542|   196k|  if (transport->connection->tpwork_head) {
  ------------------
  |  Branch (2542:7): [True: 10, False: 196k]
  ------------------
 2543|     10|    pn_modified(transport->connection, &transport->connection->endpoint, false);
 2544|     10|  }
 2545|       |
 2546|   196k|  return 0;
 2547|   196k|}
transport.c:pni_phase:
 2508|  2.15M|{
 2509|  2.15M|  pn_connection_t *conn = transport->connection;
 2510|  2.15M|  pn_endpoint_t *endpoint = conn->transport_head;
 2511|  3.23M|  while (endpoint)
  ------------------
  |  Branch (2511:10): [True: 1.07M, False: 2.15M]
  ------------------
 2512|  1.07M|  {
 2513|  1.07M|    pn_endpoint_t *next = endpoint->transport_next;
 2514|  1.07M|    int err = phase(transport, endpoint);
 2515|  1.07M|    if (err) return err;
  ------------------
  |  Branch (2515:9): [True: 0, False: 1.07M]
  ------------------
 2516|  1.07M|    endpoint = next;
 2517|  1.07M|  }
 2518|  2.15M|  return 0;
 2519|  2.15M|}
transport.c:pni_process_conn_setup:
 1858|   103k|{
 1859|   103k|  if (endpoint->type == CONNECTION)
  ------------------
  |  Branch (1859:7): [True: 41.6k, False: 61.3k]
  ------------------
 1860|  41.6k|  {
 1861|  41.6k|    if (!(endpoint->state & PN_LOCAL_UNINIT) && !transport->open_sent)
  ------------------
  |  |   50|  41.6k|#define PN_LOCAL_UNINIT (1)
  ------------------
  |  Branch (1861:9): [True: 41.6k, False: 0]
  |  Branch (1861:49): [True: 30.6k, False: 10.9k]
  ------------------
 1862|  30.6k|    {
 1863|       |      // as per the recommendation in the spec, advertise half our
 1864|       |      // actual timeout to the remote
 1865|  30.6k|      const pn_millis_t idle_timeout = transport->local_idle_timeout
  ------------------
  |  Branch (1865:40): [True: 0, False: 30.6k]
  ------------------
 1866|  30.6k|          ? (transport->local_idle_timeout/2)
 1867|  30.6k|          : 0;
 1868|  30.6k|      pn_connection_t *connection = (pn_connection_t *) endpoint;
 1869|  30.6k|      const char *cid = pn_string_get(connection->container);
 1870|  30.6k|      pni_calculate_channel_max(transport);
 1871|       |      /*  "DL[SS?I?H?InnMMC]" */
 1872|  30.6k|      pn_bytes_t buf = pn_amqp_encode_DLESSQIQHQInnMMCe(transport->frame, OPEN,
  ------------------
  |  |  141|  30.6k|#define OPEN ((uint64_t) 16)
  ------------------
 1873|  30.6k|                              cid ? cid : "",
  ------------------
  |  Branch (1873:31): [True: 30.6k, False: 0]
  ------------------
 1874|  30.6k|                              pn_string_get(connection->hostname),
 1875|       |                              // TODO: This is messy, because we also have to allow local_max_frame_ to be 0 to mean unlimited
 1876|       |                              // otherwise flow control goes wrong
 1877|  30.6k|                              transport->local_max_frame!=0 && transport->local_max_frame!=OPEN_MAX_FRAME_SIZE_DEFAULT,
  ------------------
  |  |    9|  61.3k|#define OPEN_MAX_FRAME_SIZE_DEFAULT (4294967295) /* uint */
  ------------------
  |  Branch (1877:31): [True: 30.6k, False: 0]
  |  Branch (1877:64): [True: 30.6k, False: 0]
  ------------------
 1878|  30.6k|                              transport->local_max_frame,
 1879|  30.6k|                              transport->channel_max!=OPEN_CHANNEL_MAX_DEFAULT, transport->channel_max,
  ------------------
  |  |   11|  30.6k|#define OPEN_CHANNEL_MAX_DEFAULT (65535) /* ushort */
  ------------------
 1880|  30.6k|                              (bool)idle_timeout, idle_timeout,
 1881|  30.6k|                              connection->offered_capabilities,
 1882|  30.6k|                              connection->desired_capabilities,
 1883|  30.6k|                              connection->properties);
 1884|  30.6k|      int err = pn_framing_send_amqp(transport, 0, buf);
 1885|  30.6k|      if (err) return err;
  ------------------
  |  Branch (1885:11): [True: 0, False: 30.6k]
  ------------------
 1886|  30.6k|      transport->open_sent = true;
 1887|  30.6k|    }
 1888|  41.6k|  }
 1889|       |
 1890|   103k|  return 0;
 1891|   103k|}
transport.c:pni_process_ssn_setup:
 1947|   103k|{
 1948|   103k|  if (endpoint->type == SESSION && transport->open_sent)
  ------------------
  |  Branch (1948:7): [True: 30.6k, False: 72.3k]
  |  Branch (1948:36): [True: 30.6k, False: 0]
  ------------------
 1949|  30.6k|  {
 1950|  30.6k|    pn_session_t *ssn = (pn_session_t *) endpoint;
 1951|  30.6k|    pn_session_state_t *state = &ssn->state;
 1952|  30.6k|    if (!(endpoint->state & PN_LOCAL_UNINIT) && state->local_channel == (uint16_t) -1)
  ------------------
  |  |   50|  30.6k|#define PN_LOCAL_UNINIT (1)
  ------------------
  |  Branch (1952:9): [True: 30.6k, False: 0]
  |  Branch (1952:49): [True: 30.6k, False: 0]
  ------------------
 1953|  30.6k|    {
 1954|  30.6k|      if (! pni_map_local_channel(ssn)) {
  ------------------
  |  Branch (1954:11): [True: 0, False: 30.6k]
  ------------------
 1955|      0|        pn_logger_logf(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_WARNING, "unable to find an open available channel within limit of %d", transport->channel_max );
 1956|      0|        return PN_ERR;
  ------------------
  |  |   48|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
 1957|      0|      }
 1958|  30.6k|      state->incoming_window = pni_session_incoming_window(ssn);
 1959|  30.6k|      state->outgoing_window = pni_session_outgoing_window(ssn);
 1960|       |      /* "DL[?HIIII]" */
 1961|  30.6k|      pn_bytes_t buf = pn_amqp_encode_DLEQHIIIIe(transport->frame, BEGIN,
  ------------------
  |  |  143|  30.6k|#define BEGIN ((uint64_t) 17)
  ------------------
 1962|  30.6k|                    ((int16_t) state->remote_channel >= 0), state->remote_channel,
 1963|  30.6k|                    state->outgoing_transfer_count,
 1964|  30.6k|                    state->incoming_window,
 1965|  30.6k|                    state->outgoing_window,
 1966|  30.6k|                    ssn->local_handle_max);
 1967|  30.6k|      pn_framing_send_amqp(transport, state->local_channel, buf);
 1968|  30.6k|    }
 1969|  30.6k|  }
 1970|       |
 1971|   103k|  return 0;
 1972|   103k|}
transport.c:pni_map_local_channel:
 1932|  30.6k|{
 1933|  30.6k|  pn_transport_t *transport = ssn->connection->transport;
 1934|  30.6k|  pn_session_state_t *state = &ssn->state;
 1935|  30.6k|  int valid;
 1936|  30.6k|  uint16_t channel = allocate_alias(transport->local_channels, transport->channel_max, & valid);
 1937|  30.6k|  if (!valid) {
  ------------------
  |  Branch (1937:7): [True: 0, False: 30.6k]
  ------------------
 1938|      0|    return 0;
 1939|      0|  }
 1940|  30.6k|  state->local_channel = channel;
 1941|  30.6k|  pn_hash_put(transport->local_channels, channel, ssn);
 1942|  30.6k|  pn_ep_incref(&ssn->endpoint);
 1943|  30.6k|  return 1;
 1944|  30.6k|}
transport.c:allocate_alias:
 1894|  61.3k|{
 1895|  61.3k|  for (uint32_t i = 0; i <= max_index; i++) {
  ------------------
  |  Branch (1895:24): [True: 61.3k, False: 0]
  ------------------
 1896|  61.3k|    if (!pn_hash_get(aliases, i)) {
  ------------------
  |  Branch (1896:9): [True: 61.3k, False: 0]
  ------------------
 1897|  61.3k|      * valid = 1;
 1898|  61.3k|      return i;
 1899|  61.3k|    }
 1900|  61.3k|  }
 1901|       |
 1902|      0|  * valid = 0;
 1903|      0|  return 0;
 1904|  61.3k|}
transport.c:pni_process_link_setup:
 2005|   103k|{
 2006|   103k|  if (transport->open_sent && (endpoint->type == SENDER ||
  ------------------
  |  Branch (2006:7): [True: 103k, False: 0]
  |  Branch (2006:32): [True: 0, False: 103k]
  ------------------
 2007|   103k|                               endpoint->type == RECEIVER))
  ------------------
  |  Branch (2007:32): [True: 30.6k, False: 72.3k]
  ------------------
 2008|  30.6k|  {
 2009|  30.6k|    pn_link_t *link = (pn_link_t *) endpoint;
 2010|  30.6k|    pn_session_state_t *ssn_state = &link->session->state;
 2011|  30.6k|    pn_link_state_t *state = &link->state;
 2012|  30.6k|    if (((int16_t) ssn_state->local_channel >= 0) &&
  ------------------
  |  Branch (2012:9): [True: 30.6k, False: 0]
  ------------------
 2013|  30.6k|        !(endpoint->state & PN_LOCAL_UNINIT) && state->local_handle == (uint32_t) -1)
  ------------------
  |  |   50|  30.6k|#define PN_LOCAL_UNINIT (1)
  ------------------
  |  Branch (2013:9): [True: 30.6k, False: 0]
  |  Branch (2013:49): [True: 30.6k, False: 0]
  ------------------
 2014|  30.6k|    {
 2015|  30.6k|      if (! pni_map_local_handle(link)) {
  ------------------
  |  Branch (2015:11): [True: 0, False: 30.6k]
  ------------------
 2016|      0|        pn_logger_logf(&transport->logger, PN_SUBSYSTEM_AMQP, PN_LEVEL_WARNING, "unable to find an open available handle within limit of %d", ssn_state->remote_handle_max );
 2017|      0|        return PN_ERR;
  ------------------
  |  |   48|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
 2018|      0|      }
 2019|  30.6k|      const pn_distribution_mode_t dist_mode = (pn_distribution_mode_t) link->source.distribution_mode;
 2020|  30.6k|      if (link->target.type == PN_COORDINATOR) {
  ------------------
  |  Branch (2020:11): [True: 0, False: 30.6k]
  ------------------
 2021|       |        /* "DL[SIoBB?DL[SIsIoC?sCnCC]DL[C]nnI]" */
 2022|      0|        pn_bytes_t buf = pn_amqp_encode_DLESIoBBQDLESIsIoCQsCnCCeDLECennIe(transport->frame, ATTACH,
  ------------------
  |  |  145|      0|#define ATTACH ((uint64_t) 18)
  ------------------
 2023|      0|                                pn_string_get(link->name),
 2024|      0|                                state->local_handle,
 2025|      0|                                endpoint->type == RECEIVER,
 2026|      0|                                link->snd_settle_mode,
 2027|      0|                                link->rcv_settle_mode,
 2028|      0|                                (bool) link->source.type, SOURCE,
  ------------------
  |  |  175|      0|#define SOURCE ((uint64_t) 40)
  ------------------
 2029|      0|                                pn_string_get(link->source.address),
 2030|      0|                                link->source.durability,
 2031|      0|                                expiry_symbol(&link->source),
 2032|      0|                                link->source.timeout,
 2033|      0|                                link->source.dynamic,
 2034|      0|                                link->source.properties,
 2035|      0|                                (dist_mode != PN_DIST_MODE_UNSPECIFIED), dist_mode2symbol(dist_mode),
 2036|      0|                                link->source.filter,
 2037|      0|                                link->source.outcomes,
 2038|      0|                                link->source.capabilities,
 2039|      0|                                COORDINATOR, link->target.capabilities,
  ------------------
  |  |  187|      0|#define COORDINATOR ((uint64_t) 48)
  ------------------
 2040|      0|                                0);
 2041|      0|        int err = pn_framing_send_amqp(transport, ssn_state->local_channel, buf);
 2042|      0|        if (err) return err;
  ------------------
  |  Branch (2042:13): [True: 0, False: 0]
  ------------------
 2043|  30.6k|      } else {
 2044|       |        /* "DL[SIoBB?DL[SIsIoC?sCnMM]?DL[SIsIoCM]nnILnnC]" */
 2045|  30.6k|        pn_bytes_t buf = pn_amqp_encode_DLESIoBBQDLESIsIoCQsCnMMeQDLESIsIoCMennILnnCe(transport->frame, ATTACH,
  ------------------
  |  |  145|  30.6k|#define ATTACH ((uint64_t) 18)
  ------------------
 2046|  30.6k|                                pn_string_get(link->name),
 2047|  30.6k|                                state->local_handle,
 2048|  30.6k|                                endpoint->type == RECEIVER,
 2049|  30.6k|                                link->snd_settle_mode,
 2050|  30.6k|                                link->rcv_settle_mode,
 2051|       |
 2052|  30.6k|                                (bool) link->source.type, SOURCE,
  ------------------
  |  |  175|  30.6k|#define SOURCE ((uint64_t) 40)
  ------------------
 2053|  30.6k|                                pn_string_get(link->source.address),
 2054|  30.6k|                                link->source.durability,
 2055|  30.6k|                                expiry_symbol(&link->source),
 2056|  30.6k|                                link->source.timeout,
 2057|  30.6k|                                link->source.dynamic,
 2058|  30.6k|                                link->source.properties,
 2059|  30.6k|                                (dist_mode != PN_DIST_MODE_UNSPECIFIED), dist_mode2symbol(dist_mode),
 2060|  30.6k|                                link->source.filter,
 2061|  30.6k|                                link->source.outcomes,
 2062|  30.6k|                                link->source.capabilities,
 2063|       |
 2064|  30.6k|                                (bool) link->target.type, TARGET,
  ------------------
  |  |  177|  30.6k|#define TARGET ((uint64_t) 41)
  ------------------
 2065|  30.6k|                                pn_string_get(link->target.address),
 2066|  30.6k|                                link->target.durability,
 2067|  30.6k|                                expiry_symbol(&link->target),
 2068|  30.6k|                                link->target.timeout,
 2069|  30.6k|                                link->target.dynamic,
 2070|  30.6k|                                link->target.properties,
 2071|  30.6k|                                link->target.capabilities,
 2072|       |
 2073|  30.6k|                                0,
 2074|  30.6k|                                link->max_message_size,
 2075|  30.6k|                                link->properties);
 2076|  30.6k|        int err = pn_framing_send_amqp(transport, ssn_state->local_channel, buf);
 2077|  30.6k|        if (err) return err;
  ------------------
  |  Branch (2077:13): [True: 0, False: 30.6k]
  ------------------
 2078|  30.6k|      }
 2079|  30.6k|    }
 2080|  30.6k|  }
 2081|       |
 2082|   103k|  return 0;
 2083|   103k|}
transport.c:pni_map_local_handle:
 1992|  30.6k|static int pni_map_local_handle(pn_link_t *link) {
 1993|  30.6k|  pn_link_state_t *state = &link->state;
 1994|  30.6k|  pn_session_state_t *ssn_state = &link->session->state;
 1995|  30.6k|  int valid;
 1996|  30.6k|  state->local_handle = allocate_alias(ssn_state->local_handles, ssn_state->remote_handle_max, &valid);
 1997|  30.6k|  if ( !valid )
  ------------------
  |  Branch (1997:8): [True: 0, False: 30.6k]
  ------------------
 1998|      0|    return 0;
 1999|  30.6k|  pn_hash_put(ssn_state->local_handles, state->local_handle, link);
 2000|  30.6k|  pn_ep_incref(&link->endpoint);
 2001|  30.6k|  return 1;
 2002|  30.6k|}
transport.c:expiry_symbol:
 1975|  61.3k|{
 1976|  61.3k|  if (!terminus->has_expiry_policy) return NULL;
  ------------------
  |  Branch (1976:7): [True: 61.3k, False: 0]
  ------------------
 1977|       |
 1978|      0|  switch (terminus->expiry_policy)
  ------------------
  |  Branch (1978:11): [True: 0, False: 0]
  ------------------
 1979|      0|  {
 1980|      0|  case PN_EXPIRE_WITH_LINK:
  ------------------
  |  Branch (1980:3): [True: 0, False: 0]
  ------------------
 1981|      0|    return "link-detach";
 1982|      0|  case PN_EXPIRE_WITH_SESSION:
  ------------------
  |  Branch (1982:3): [True: 0, False: 0]
  ------------------
 1983|      0|    return "session-end";
 1984|      0|  case PN_EXPIRE_WITH_CONNECTION:
  ------------------
  |  Branch (1984:3): [True: 0, False: 0]
  ------------------
 1985|      0|    return "connection-close";
 1986|      0|  case PN_EXPIRE_NEVER:
  ------------------
  |  Branch (1986:3): [True: 0, False: 0]
  ------------------
 1987|      0|    return "never";
 1988|      0|  }
 1989|      0|  return NULL;
 1990|      0|}
transport.c:dist_mode2symbol:
 1195|  30.6k|{
 1196|  30.6k|  switch (mode)
 1197|  30.6k|  {
 1198|      0|  case PN_DIST_MODE_COPY:
  ------------------
  |  Branch (1198:3): [True: 0, False: 30.6k]
  ------------------
 1199|      0|    return "copy";
 1200|      0|  case PN_DIST_MODE_MOVE:
  ------------------
  |  Branch (1200:3): [True: 0, False: 30.6k]
  ------------------
 1201|      0|    return "move";
 1202|  30.6k|  default:
  ------------------
  |  Branch (1202:3): [True: 30.6k, False: 0]
  ------------------
 1203|  30.6k|    return NULL;
 1204|  30.6k|  }
 1205|  30.6k|}
transport.c:pni_process_flow_receiver:
 2105|   103k|{
 2106|   103k|  if (endpoint->type == RECEIVER && endpoint->state & PN_LOCAL_ACTIVE)
  ------------------
  |  |   55|  30.6k|#define PN_LOCAL_ACTIVE (2)
  ------------------
  |  Branch (2106:7): [True: 30.6k, False: 72.3k]
  |  Branch (2106:37): [True: 30.6k, False: 0]
  ------------------
 2107|  30.6k|  {
 2108|  30.6k|    pn_link_t *rcv = (pn_link_t *) endpoint;
 2109|  30.6k|    pn_session_t *ssn = rcv->session;
 2110|  30.6k|    pn_link_state_t *state = &rcv->state;
 2111|  30.6k|    if ((int16_t) ssn->state.local_channel >= 0 &&
  ------------------
  |  Branch (2111:9): [True: 30.6k, False: 0]
  ------------------
 2112|  30.6k|        (int32_t) state->local_handle >= 0 &&
  ------------------
  |  Branch (2112:9): [True: 30.6k, False: 0]
  ------------------
 2113|  30.6k|        ((rcv->drain || state->link_credit != rcv->credit - rcv->queued) || !ssn->state.incoming_window)) {
  ------------------
  |  Branch (2113:11): [True: 0, False: 30.6k]
  |  Branch (2113:25): [True: 30.6k, False: 0]
  |  Branch (2113:77): [True: 0, False: 0]
  ------------------
 2114|  30.6k|      state->link_credit = rcv->credit - rcv->queued;
 2115|  30.6k|      return pni_post_flow(transport, ssn, rcv);
 2116|  30.6k|    }
 2117|  30.6k|  }
 2118|       |
 2119|  72.3k|  return 0;
 2120|   103k|}
transport.c:pni_process_tpwork:
 2294|   212k|{
 2295|   212k|  if (endpoint->type == CONNECTION && !transport->close_sent)
  ------------------
  |  Branch (2295:7): [True: 83.3k, False: 129k]
  |  Branch (2295:39): [True: 83.2k, False: 20]
  ------------------
 2296|  83.2k|  {
 2297|  83.2k|    pn_connection_t *conn = (pn_connection_t *) endpoint;
 2298|  83.2k|    pn_delivery_t *delivery = conn->tpwork_head;
 2299|   996k|    while (delivery)
  ------------------
  |  Branch (2299:12): [True: 912k, False: 83.2k]
  ------------------
 2300|   912k|    {
 2301|   912k|      pn_delivery_t *tp_next = delivery->tpwork_next;
 2302|   912k|      bool settle = false;
 2303|       |
 2304|   912k|      pn_link_t *link = delivery->link;
 2305|   912k|      pn_delivery_map_t *dm = NULL;
 2306|   912k|      if (pn_link_is_sender(link)) {
  ------------------
  |  Branch (2306:11): [True: 0, False: 912k]
  ------------------
 2307|      0|        dm = &link->session->state.outgoing;
 2308|      0|        int err = pni_process_tpwork_sender(transport, delivery, &settle);
 2309|      0|        if (err) return err;
  ------------------
  |  Branch (2309:13): [True: 0, False: 0]
  ------------------
 2310|   912k|      } else {
 2311|   912k|        dm = &link->session->state.incoming;
 2312|   912k|        int err = pni_process_tpwork_receiver(transport, delivery, &settle);
 2313|   912k|        if (err) return err;
  ------------------
  |  Branch (2313:13): [True: 0, False: 912k]
  ------------------
 2314|   912k|      }
 2315|       |
 2316|   912k|      if (settle) {
  ------------------
  |  Branch (2316:11): [True: 912k, False: 0]
  ------------------
 2317|   912k|        pn_full_settle(dm, delivery);
 2318|   912k|      } else if (!pn_delivery_buffered(delivery)) {
  ------------------
  |  Branch (2318:18): [True: 0, False: 0]
  ------------------
 2319|      0|        pn_clear_tpwork(delivery);
 2320|      0|      }
 2321|       |
 2322|   912k|      delivery = tp_next;
 2323|   912k|    }
 2324|  83.2k|  }
 2325|       |
 2326|   212k|  return 0;
 2327|   212k|}
transport.c:pni_post_disp:
 2147|   561k|{
 2148|   561k|  pn_link_t *link = delivery->link;
 2149|   561k|  pn_session_t *ssn = link->session;
 2150|   561k|  pn_session_state_t *ssn_state = &ssn->state;
 2151|   561k|  pn_modified(transport->connection, &link->session->endpoint, false);
 2152|   561k|  pn_delivery_state_t *state = &delivery->state;
 2153|   561k|  assert(state->init);
 2154|   561k|  bool role = (link->endpoint.type == RECEIVER);
 2155|   561k|  uint64_t code = delivery->local.type;
 2156|       |
 2157|   561k|  if (!code && !delivery->local.settled) {
  ------------------
  |  Branch (2157:7): [True: 0, False: 561k]
  |  Branch (2157:16): [True: 0, False: 0]
  ------------------
 2158|      0|    return 0;
 2159|      0|  }
 2160|       |
 2161|   561k|  if (!pni_disposition_batchable(&delivery->local)) {
  ------------------
  |  Branch (2161:7): [True: 0, False: 561k]
  ------------------
 2162|      0|    pn_data_clear(transport->disp_data);
 2163|      0|    PN_RETURN_IF_ERROR(pni_disposition_encode(&delivery->local, transport->disp_data));
  ------------------
  |  |  116|      0|#define PN_RETURN_IF_ERROR(x) \
  |  |  117|      0|do {\
  |  |  118|      0|int r = (x);\
  |  |  119|      0|if (r < 0) return r; \
  |  |  ------------------
  |  |  |  Branch (119:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  120|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (120:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2164|       |    /* "DL[oIn?o?DLC]" */
 2165|      0|    pn_bytes_t buf = pn_amqp_encode_DLEoInQoQDLCe(transport->frame,DISPOSITION,
  ------------------
  |  |  151|      0|#define DISPOSITION ((uint64_t) 21)
  ------------------
 2166|      0|      role, state->id,
 2167|      0|      delivery->local.settled, delivery->local.settled,
 2168|      0|      (bool)code, code, transport->disp_data);
 2169|      0|    return pn_framing_send_amqp(transport, ssn->state.local_channel, buf);
 2170|      0|  }
 2171|       |
 2172|   561k|  if (ssn_state->disp && code == ssn_state->disp_code &&
  ------------------
  |  Branch (2172:7): [True: 554k, False: 6.66k]
  |  Branch (2172:26): [True: 554k, False: 0]
  ------------------
 2173|   561k|      delivery->local.settled == ssn_state->disp_settled &&
  ------------------
  |  Branch (2173:7): [True: 554k, False: 0]
  ------------------
 2174|   561k|      ssn_state->disp_type == role) {
  ------------------
  |  Branch (2174:7): [True: 554k, False: 0]
  ------------------
 2175|   554k|    if (state->id == ssn_state->disp_first - 1) {
  ------------------
  |  Branch (2175:9): [True: 1, False: 554k]
  ------------------
 2176|      1|      ssn_state->disp_first = state->id;
 2177|      1|      return 0;
 2178|   554k|    } else if (state->id == ssn_state->disp_last + 1) {
  ------------------
  |  Branch (2178:16): [True: 253k, False: 300k]
  ------------------
 2179|   253k|      ssn_state->disp_last = state->id;
 2180|   253k|      return 0;
 2181|   253k|    }
 2182|   554k|  }
 2183|       |
 2184|   307k|  if (ssn_state->disp) {
  ------------------
  |  Branch (2184:7): [True: 300k, False: 6.66k]
  ------------------
 2185|   300k|    int err = pni_flush_disp(transport, ssn);
 2186|   300k|    if (err) return err;
  ------------------
  |  Branch (2186:9): [True: 0, False: 300k]
  ------------------
 2187|   300k|  }
 2188|       |
 2189|   307k|  ssn_state->disp_type = role;
 2190|   307k|  ssn_state->disp_code = code;
 2191|   307k|  ssn_state->disp_settled = delivery->local.settled;
 2192|   307k|  ssn_state->disp_first = state->id;
 2193|   307k|  ssn_state->disp_last = state->id;
 2194|   307k|  ssn_state->disp = true;
 2195|       |
 2196|   307k|  return 0;
 2197|   307k|}
transport.c:pni_flush_disp:
 2123|   338k|{
 2124|   338k|  uint64_t code = ssn->state.disp_code;
 2125|   338k|  bool settled = ssn->state.disp_settled;
 2126|   338k|  if (ssn->state.disp) {
  ------------------
  |  Branch (2126:7): [True: 307k, False: 30.6k]
  ------------------
 2127|       |    /* "DL[oI?I?o?DL[]]" */
 2128|   307k|    pn_bytes_t buf = pn_amqp_encode_DLEoIQIQoQDLEee(transport->frame, DISPOSITION,
  ------------------
  |  |  151|   307k|#define DISPOSITION ((uint64_t) 21)
  ------------------
 2129|   307k|                            ssn->state.disp_type,
 2130|   307k|                            ssn->state.disp_first,
 2131|   307k|                            ssn->state.disp_last!=ssn->state.disp_first, ssn->state.disp_last,
 2132|   307k|                            settled, settled,
 2133|   307k|                            (bool)code, code);
 2134|   307k|    int err = pn_framing_send_amqp(transport, ssn->state.local_channel, buf);
 2135|   307k|    if (err) return err;
  ------------------
  |  Branch (2135:9): [True: 0, False: 307k]
  ------------------
 2136|   307k|    ssn->state.disp_type = 0;
 2137|   307k|    ssn->state.disp_code = 0;
 2138|   307k|    ssn->state.disp_settled = 0;
 2139|   307k|    ssn->state.disp_first = 0;
 2140|   307k|    ssn->state.disp_last = 0;
 2141|   307k|    ssn->state.disp = false;
 2142|   307k|  }
 2143|   338k|  return 0;
 2144|   338k|}
transport.c:pni_process_tpwork_receiver:
 2273|   912k|{
 2274|   912k|  *settle = false;
 2275|   912k|  pn_link_t *link = delivery->link;
 2276|       |  // XXX: need to prevent duplicate disposition sending
 2277|   912k|  pn_session_t *ssn = link->session;
 2278|   912k|  if ((int16_t) ssn->state.local_channel >= 0 && !delivery->remote.settled && delivery->state.init) {
  ------------------
  |  Branch (2278:7): [True: 912k, False: 0]
  |  Branch (2278:50): [True: 563k, False: 349k]
  |  Branch (2278:79): [True: 561k, False: 2.83k]
  ------------------
 2279|   561k|    int err = pni_post_disp(transport, delivery);
 2280|   561k|    if (err) return err;
  ------------------
  |  Branch (2280:9): [True: 0, False: 561k]
  ------------------
 2281|   561k|  }
 2282|       |
 2283|       |  // XXX: need to centralize this policy and improve it
 2284|   912k|  if (!ssn->state.incoming_window) {
  ------------------
  |  Branch (2284:7): [True: 0, False: 912k]
  ------------------
 2285|      0|    int err = pni_post_flow(transport, ssn, link);
 2286|      0|    if (err) return err;
  ------------------
  |  Branch (2286:9): [True: 0, False: 0]
  ------------------
 2287|      0|  }
 2288|       |
 2289|   912k|  *settle = delivery->local.settled;
 2290|   912k|  return 0;
 2291|   912k|}
transport.c:pn_full_settle:
 1370|   912k|{
 1371|   912k|  assert(!delivery->work);
 1372|   912k|  pn_clear_tpwork(delivery);
 1373|   912k|  pn_delivery_map_del(db, delivery);
 1374|   912k|  pn_incref(delivery);
 1375|   912k|  pn_decref(delivery);
 1376|   912k|}
transport.c:pni_process_flush_disp:
 2330|   109k|{
 2331|   109k|  if (endpoint->type == SESSION) {
  ------------------
  |  Branch (2331:7): [True: 37.3k, False: 72.3k]
  ------------------
 2332|  37.3k|    pn_session_t *session = (pn_session_t *) endpoint;
 2333|  37.3k|    pn_session_state_t *state = &session->state;
 2334|  37.3k|    if ((int16_t) state->local_channel >= 0 && !transport->close_sent)
  ------------------
  |  Branch (2334:9): [True: 37.3k, False: 0]
  |  Branch (2334:48): [True: 37.3k, False: 0]
  ------------------
 2335|  37.3k|    {
 2336|  37.3k|      int err = pni_flush_disp(transport, session);
 2337|  37.3k|      if (err) return err;
  ------------------
  |  Branch (2337:11): [True: 0, False: 37.3k]
  ------------------
 2338|  37.3k|    }
 2339|  37.3k|  }
 2340|       |
 2341|   109k|  return 0;
 2342|   109k|}
transport.c:pni_process_flow_sender:
 2345|   109k|{
 2346|   109k|  if (endpoint->type == SENDER && endpoint->state & PN_LOCAL_ACTIVE)
  ------------------
  |  |   55|      0|#define PN_LOCAL_ACTIVE (2)
  ------------------
  |  Branch (2346:7): [True: 0, False: 109k]
  |  Branch (2346:35): [True: 0, False: 0]
  ------------------
 2347|      0|  {
 2348|      0|    pn_link_t *snd = (pn_link_t *) endpoint;
 2349|      0|    pn_session_t *ssn = snd->session;
 2350|      0|    pn_link_state_t *state = &snd->state;
 2351|      0|    if ((int16_t) ssn->state.local_channel >= 0 &&
  ------------------
  |  Branch (2351:9): [True: 0, False: 0]
  ------------------
 2352|      0|        (int32_t) state->local_handle >= 0 &&
  ------------------
  |  Branch (2352:9): [True: 0, False: 0]
  ------------------
 2353|      0|        snd->drain && snd->drained) {
  ------------------
  |  Branch (2353:9): [True: 0, False: 0]
  |  Branch (2353:23): [True: 0, False: 0]
  ------------------
 2354|      0|      pn_delivery_t *tail = snd->unsettled_tail;
 2355|      0|      if (!tail || !pn_delivery_buffered(tail)) {
  ------------------
  |  Branch (2355:11): [True: 0, False: 0]
  |  Branch (2355:20): [True: 0, False: 0]
  ------------------
 2356|      0|        state->delivery_count += state->link_credit;
 2357|      0|        state->link_credit = 0;
 2358|      0|        snd->drained = 0;
 2359|      0|        return pni_post_flow(transport, ssn, snd);
 2360|      0|      }
 2361|      0|    }
 2362|      0|  }
 2363|       |
 2364|   109k|  return 0;
 2365|   109k|}
transport.c:pni_process_link_teardown:
 2379|   109k|{
 2380|   109k|  if (endpoint->type == SENDER || endpoint->type == RECEIVER)
  ------------------
  |  Branch (2380:7): [True: 0, False: 109k]
  |  Branch (2380:35): [True: 30.6k, False: 79.0k]
  ------------------
 2381|  30.6k|  {
 2382|  30.6k|    pn_link_t *link = (pn_link_t *) endpoint;
 2383|  30.6k|    pn_session_t *session = link->session;
 2384|  30.6k|    pn_session_state_t *ssn_state = &session->state;
 2385|  30.6k|    pn_link_state_t *state = &link->state;
 2386|  30.6k|    if (((endpoint->state & PN_LOCAL_CLOSED) || link->detached) && (int32_t) state->local_handle >= 0 &&
  ------------------
  |  |   60|  30.6k|#define PN_LOCAL_CLOSED (4)
  ------------------
  |  Branch (2386:10): [True: 0, False: 30.6k]
  |  Branch (2386:49): [True: 0, False: 30.6k]
  |  Branch (2386:68): [True: 0, False: 0]
  ------------------
 2387|  30.6k|        (int16_t) ssn_state->local_channel >= 0 && !transport->close_sent) {
  ------------------
  |  Branch (2387:9): [True: 0, False: 0]
  |  Branch (2387:52): [True: 0, False: 0]
  ------------------
 2388|      0|      if (pn_link_is_sender(link) && pn_link_queued(link) &&
  ------------------
  |  Branch (2388:11): [True: 0, False: 0]
  |  Branch (2388:38): [True: 0, False: 0]
  ------------------
 2389|      0|          (int32_t) state->remote_handle != -2 &&
  ------------------
  |  Branch (2389:11): [True: 0, False: 0]
  ------------------
 2390|      0|          (int16_t) ssn_state->remote_channel != -2 &&
  ------------------
  |  Branch (2390:11): [True: 0, False: 0]
  ------------------
 2391|      0|          !transport->close_rcvd) return 0;
  ------------------
  |  Branch (2391:11): [True: 0, False: 0]
  ------------------
 2392|       |
 2393|      0|      const char *name = NULL;
 2394|      0|      const char *description = NULL;
 2395|      0|      pn_data_t *info = NULL;
 2396|       |
 2397|      0|      if (pn_condition_is_set(&endpoint->condition)) {
  ------------------
  |  Branch (2397:11): [True: 0, False: 0]
  ------------------
 2398|      0|        name = pn_condition_get_name(&endpoint->condition);
 2399|      0|        description = pn_condition_get_description(&endpoint->condition);
 2400|      0|        info = pn_condition_info(&endpoint->condition);
 2401|      0|      }
 2402|       |      /* "DL[I?o?DL[sSC]]" */
 2403|      0|      pn_bytes_t buf = pn_amqp_encode_DLEIQoQDLEsSCee(transport->frame, DETACH,
  ------------------
  |  |  153|      0|#define DETACH ((uint64_t) 22)
  ------------------
 2404|      0|                                            state->local_handle,
 2405|      0|                                            !link->detached, !link->detached,
 2406|      0|                                            (bool)name, ERROR, name, description, info);
  ------------------
  |  |  159|      0|#define ERROR ((uint64_t) 29)
  ------------------
 2407|      0|      int err = pn_framing_send_amqp(transport, ssn_state->local_channel, buf);
 2408|      0|      if (err) return err;
  ------------------
  |  Branch (2408:11): [True: 0, False: 0]
  ------------------
 2409|      0|      pni_unmap_local_handle(link);
 2410|      0|    }
 2411|       |
 2412|  30.6k|    pn_clear_modified(transport->connection, endpoint);
 2413|  30.6k|  }
 2414|       |
 2415|   109k|  return 0;
 2416|   109k|}
transport.c:pni_process_ssn_teardown:
 2457|  79.0k|{
 2458|  79.0k|  if (endpoint->type == SESSION)
  ------------------
  |  Branch (2458:7): [True: 37.3k, False: 41.6k]
  ------------------
 2459|  37.3k|  {
 2460|  37.3k|    pn_session_t *session = (pn_session_t *) endpoint;
 2461|  37.3k|    pn_session_state_t *state = &session->state;
 2462|  37.3k|    if (endpoint->state & PN_LOCAL_CLOSED && (int16_t) state->local_channel >= 0
  ------------------
  |  |   60|  74.7k|#define PN_LOCAL_CLOSED (4)
  ------------------
  |  Branch (2462:9): [True: 0, False: 37.3k]
  |  Branch (2462:46): [True: 0, False: 0]
  ------------------
 2463|  37.3k|        && !transport->close_sent)
  ------------------
  |  Branch (2463:12): [True: 0, False: 0]
  ------------------
 2464|      0|    {
 2465|      0|      if (pni_pointful_buffering(transport, session)) {
  ------------------
  |  Branch (2465:11): [True: 0, False: 0]
  ------------------
 2466|      0|        return 0;
 2467|      0|      }
 2468|       |
 2469|      0|      const char *name = NULL;
 2470|      0|      const char *description = NULL;
 2471|      0|      pn_data_t *info = NULL;
 2472|       |
 2473|      0|      if (pn_condition_is_set(&endpoint->condition)) {
  ------------------
  |  Branch (2473:11): [True: 0, False: 0]
  ------------------
 2474|      0|        name = pn_condition_get_name(&endpoint->condition);
 2475|      0|        description = pn_condition_get_description(&endpoint->condition);
 2476|      0|        info = pn_condition_info(&endpoint->condition);
 2477|      0|      }
 2478|       |      /* "DL[?DL[sSC]]" */
 2479|      0|      pn_bytes_t buf = pn_amqp_encode_DLEQDLEsSCee(transport->frame, END,
  ------------------
  |  |  155|      0|#define END ((uint64_t) 23)
  ------------------
 2480|      0|                              (bool) name, ERROR, name, description, info);
  ------------------
  |  |  159|      0|#define ERROR ((uint64_t) 29)
  ------------------
 2481|      0|      int err = pn_framing_send_amqp(transport, state->local_channel, buf);
 2482|      0|      if (err) return err;
  ------------------
  |  Branch (2482:11): [True: 0, False: 0]
  ------------------
 2483|      0|      pni_unmap_local_channel(session);
 2484|      0|    }
 2485|       |
 2486|  37.3k|    pn_clear_modified(transport->connection, endpoint);
 2487|  37.3k|  }
 2488|  79.0k|  return 0;
 2489|  79.0k|}
transport.c:pni_pointful_buffering:
 2419|  5.39k|{
 2420|  5.39k|  if (transport->close_rcvd) return false;
  ------------------
  |  Branch (2420:7): [True: 186, False: 5.20k]
  ------------------
 2421|  5.20k|  if (!transport->open_rcvd) return true;
  ------------------
  |  Branch (2421:7): [True: 4.99k, False: 215]
  ------------------
 2422|       |
 2423|    215|  pn_connection_t *conn = transport->connection;
 2424|    215|  pn_link_t *link = pn_link_head(conn, 0);
 2425|  29.3k|  while (link) {
  ------------------
  |  Branch (2425:10): [True: 29.1k, False: 215]
  ------------------
 2426|  29.1k|    if (pn_link_is_sender(link) && pn_link_queued(link) > 0) {
  ------------------
  |  Branch (2426:9): [True: 4.29k, False: 24.8k]
  |  Branch (2426:36): [True: 392, False: 3.90k]
  ------------------
 2427|    392|      pn_session_t *ssn = link->session;
 2428|    392|      if (session && session == ssn) {
  ------------------
  |  Branch (2428:11): [True: 0, False: 392]
  |  Branch (2428:22): [True: 0, False: 0]
  ------------------
 2429|      0|        if ((int32_t) link->state.remote_handle != -2 &&
  ------------------
  |  Branch (2429:13): [True: 0, False: 0]
  ------------------
 2430|      0|            (int16_t) session->state.remote_channel != -2) {
  ------------------
  |  Branch (2430:13): [True: 0, False: 0]
  ------------------
 2431|      0|          return true;
 2432|      0|        }
 2433|      0|      }
 2434|    392|    }
 2435|  29.1k|    link = pn_link_next(link, 0);
 2436|  29.1k|  }
 2437|       |
 2438|    215|  return false;
 2439|    215|}
transport.c:pni_process_conn_teardown:
 2492|  41.6k|{
 2493|  41.6k|  if (endpoint->type == CONNECTION)
  ------------------
  |  Branch (2493:7): [True: 41.6k, False: 0]
  ------------------
 2494|  41.6k|  {
 2495|  41.6k|    if (endpoint->state & PN_LOCAL_CLOSED && !transport->close_sent) {
  ------------------
  |  |   60|  83.3k|#define PN_LOCAL_CLOSED (4)
  ------------------
  |  Branch (2495:9): [True: 5.40k, False: 36.2k]
  |  Branch (2495:46): [True: 5.39k, False: 10]
  ------------------
 2496|  5.39k|      if (pni_pointful_buffering(transport, NULL)) return 0;
  ------------------
  |  Branch (2496:11): [True: 4.99k, False: 401]
  ------------------
 2497|    401|      int err = pni_post_close(transport, NULL);
 2498|    401|      if (err) return err;
  ------------------
  |  Branch (2498:11): [True: 0, False: 401]
  ------------------
 2499|    401|      transport->close_sent = true;
 2500|    401|    }
 2501|       |
 2502|  36.6k|    pn_clear_modified(transport->connection, endpoint);
 2503|  36.6k|  }
 2504|  36.6k|  return 0;
 2505|  41.6k|}
transport.c:transport_produce:
 2717|   266k|{
 2718|   266k|  if (transport->head_closed) return PN_EOS;
  ------------------
  |  |   47|  24.4k|#define PN_EOS (-1)            /**< End of stream */
  ------------------
  |  Branch (2718:7): [True: 24.4k, False: 241k]
  ------------------
 2719|       |
 2720|   241k|  ssize_t space = transport->output_size - transport->output_pending;
 2721|       |
 2722|   241k|  if (space <= 0) {     // can we expand the buffer?
  ------------------
  |  Branch (2722:7): [True: 445, False: 241k]
  ------------------
 2723|    445|    int more = 0;
 2724|    445|    if (!transport->remote_max_frame)   // no limit, so double it
  ------------------
  |  Branch (2724:9): [True: 3, False: 442]
  ------------------
 2725|      3|      more = transport->output_size;
 2726|    442|    else if (transport->remote_max_frame > transport->output_size)
  ------------------
  |  Branch (2726:14): [True: 38, False: 404]
  ------------------
 2727|     38|      more = pn_min(transport->output_size, transport->remote_max_frame - transport->output_size);
  ------------------
  |  |  163|     38|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 0, False: 38]
  |  |  ------------------
  ------------------
 2728|    445|    if (more) {
  ------------------
  |  Branch (2728:9): [True: 41, False: 404]
  ------------------
 2729|     41|      char *newbuf = (char *)pni_mem_subreallocate(pn_class(transport), transport, transport->output_buf, transport->output_size + more );
 2730|     41|      if (newbuf) {
  ------------------
  |  Branch (2730:11): [True: 41, False: 0]
  ------------------
 2731|     41|        transport->output_buf = newbuf;
 2732|     41|        transport->output_size += more;
 2733|     41|        space += more;
 2734|     41|      }
 2735|     41|    }
 2736|    445|  }
 2737|       |
 2738|   331k|  while (space > 0) {
  ------------------
  |  Branch (2738:10): [True: 329k, False: 1.06k]
  ------------------
 2739|   329k|    ssize_t n;
 2740|   329k|    n = transport->io_layers[0]->
 2741|   329k|      process_output( transport, 0,
 2742|   329k|                      &transport->output_buf[transport->output_pending],
 2743|   329k|                      space );
 2744|   329k|    if (n > 0) {
  ------------------
  |  Branch (2744:9): [True: 89.3k, False: 240k]
  ------------------
 2745|  89.3k|      space -= n;
 2746|  89.3k|      transport->output_pending += n;
 2747|   240k|    } else if (n == 0) {
  ------------------
  |  Branch (2747:16): [True: 219k, False: 21.5k]
  ------------------
 2748|   219k|      break;
 2749|   219k|    } else {
 2750|  21.5k|      if (transport->output_pending)
  ------------------
  |  Branch (2750:11): [True: 21.2k, False: 320]
  ------------------
 2751|  21.2k|        break;   // return what is available
 2752|    320|      PN_LOG(&transport->logger, PN_SUBSYSTEM_AMQP | PN_SUBSYSTEM_IO, PN_LEVEL_FRAME | PN_LEVEL_RAW, "  -> EOS");
  ------------------
  |  |   54|    320|    do { \
  |  |   55|    320|        if (PN_SHOULD_LOG(logger, subsys, sev)) \
  |  |  ------------------
  |  |  |  |   51|    320|    (((sev) & PN_LEVEL_CRITICAL) || (((logger)->sub_mask & (subsys)) && ((logger)->sev_mask & (sev))))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (51:6): [Folded - Ignored]
  |  |  |  |  |  Branch (51:38): [True: 320, False: 0]
  |  |  |  |  |  Branch (51:73): [True: 0, False: 320]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   56|    320|            pn_logger_logf(logger, (pn_log_subsystem_t) (subsys), (pn_log_level_t) (sev), __VA_ARGS__); \
  |  |   57|    320|    } while(0)
  |  |  ------------------
  |  |  |  Branch (57:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2753|    320|      pni_close_head(transport);
 2754|    320|      return n;
 2755|  21.5k|    }
 2756|   329k|  }
 2757|       |
 2758|   241k|  return transport->output_pending;
 2759|   241k|}
transport.c:pni_close_head:
 2706|  30.6k|{
 2707|  30.6k|  if (!transport->head_closed) {
  ------------------
  |  Branch (2707:7): [True: 30.6k, False: 0]
  ------------------
 2708|  30.6k|    transport->head_closed = true;
 2709|  30.6k|    pn_collector_t *collector = pni_transport_collector(transport);
 2710|  30.6k|    pn_collector_put_object(collector, transport, PN_TRANSPORT_HEAD_CLOSED);
 2711|  30.6k|    pni_maybe_post_closed(transport);
 2712|  30.6k|  }
 2713|  30.6k|}

pn_bytes:
   28|   444M|{
   29|   444M|  pn_bytes_t bytes = {size, start};
   30|   444M|  return bytes;
   31|   444M|}
pn_rwbytes:
   34|  45.2k|{
   35|  45.2k|  pn_rwbytes_t bytes = {size, start};
   36|  45.2k|  return bytes;
   37|  45.2k|}

pn_quote_data:
   38|  4.72k|{
   39|  4.72k|  int idx = 0;
   40|  40.3k|  for (unsigned i = 0; i < size; i++)
  ------------------
  |  Branch (40:24): [True: 36.8k, False: 3.50k]
  ------------------
   41|  36.8k|  {
   42|  36.8k|    uint8_t c = src[i];
   43|       |    // output printable ASCII, ensure '\' always introduces hex escape, escape quote marks
   44|  36.8k|    if (c < 128 && c != '\\' && c != '\"' && c != '\'' && isprint(c)) {
  ------------------
  |  Branch (44:9): [True: 31.5k, False: 5.26k]
  |  Branch (44:20): [True: 31.1k, False: 429]
  |  Branch (44:33): [True: 30.7k, False: 368]
  |  Branch (44:46): [True: 30.4k, False: 314]
  ------------------
   45|  15.8k|      if (idx < (int) (capacity - 1)) {
  ------------------
  |  Branch (45:11): [True: 15.1k, False: 706]
  ------------------
   46|  15.1k|        dst[idx++] = c;
   47|  15.1k|      } else {
   48|    706|        if (idx > 0) {
  ------------------
  |  Branch (48:13): [True: 535, False: 171]
  ------------------
   49|    535|          dst[idx] = '\0';
   50|    535|        }
   51|    706|        return PN_OVERFLOW;
  ------------------
  |  |   49|    706|#define PN_OVERFLOW (-3)       /**< Overflow error */
  ------------------
   52|    706|      }
   53|  20.9k|    } else {
   54|  20.9k|      if (idx < (int) (capacity - 4)) {
  ------------------
  |  Branch (54:11): [True: 20.4k, False: 515]
  ------------------
   55|  20.4k|        idx += sprintf(dst + idx, "\\x%.2x", c);
   56|  20.4k|      } else {
   57|    515|        if (idx > 0) {
  ------------------
  |  Branch (57:13): [True: 239, False: 276]
  ------------------
   58|    239|          dst[idx] = '\0';
   59|    239|        }
   60|    515|        return PN_OVERFLOW;
  ------------------
  |  |   49|    515|#define PN_OVERFLOW (-3)       /**< Overflow error */
  ------------------
   61|    515|      }
   62|  20.9k|    }
   63|  36.8k|  }
   64|       |
   65|  3.50k|  dst[idx] = '\0';
   66|  3.50k|  return idx;
   67|  4.72k|}
pn_strdup:
  120|   776k|{
  121|   776k|  if (!src) return NULL;
  ------------------
  |  Branch (121:7): [True: 0, False: 776k]
  ------------------
  122|   776k|  char *dest = (char *) pni_mem_allocate(PN_CLASSCLASS(pn_strdup), strlen(src)+1);
  ------------------
  |  |  101|   776k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  123|   776k|  if (!dest) return NULL;
  ------------------
  |  Branch (123:7): [True: 0, False: 776k]
  ------------------
  124|   776k|  return strcpy(dest, src);
  125|   776k|}
pn_strndup:
  128|  8.39k|{
  129|  8.39k|  if (src) {
  ------------------
  |  Branch (129:7): [True: 8.39k, False: 0]
  ------------------
  130|  8.39k|    unsigned size = 0;
  131|  10.5k|    for (const char *c = src; size < n && *c; c++) {
  ------------------
  |  Branch (131:31): [True: 5.16k, False: 5.36k]
  |  Branch (131:43): [True: 2.13k, False: 3.02k]
  ------------------
  132|  2.13k|      size++;
  133|  2.13k|    }
  134|       |
  135|  8.39k|    char *dest = (char *) pni_mem_allocate(PN_CLASSCLASS(pn_strdup), size + 1);
  ------------------
  |  |  101|  8.39k|#define PN_CLASSCLASS(PREFIX) PREFIX ## __class
  ------------------
  136|  8.39k|    if (!dest) return NULL;
  ------------------
  |  Branch (136:9): [True: 0, False: 8.39k]
  ------------------
  137|  8.39k|    strncpy(dest, src, pn_min(n, size));
  ------------------
  |  |  163|  8.39k|#define pn_min(X,Y) ((X) > (Y) ? (Y) : (X))
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 3.02k, False: 5.36k]
  |  |  ------------------
  ------------------
  138|  8.39k|    dest[size] = '\0';
  139|  8.39k|    return dest;
  140|  8.39k|  } else {
  141|      0|    return NULL;
  142|      0|  }
  143|  8.39k|}

transport.c:pn_bytes_equal:
   55|   444M|static inline bool pn_bytes_equal(const pn_bytes_t a, const pn_bytes_t b) {
   56|   444M|  return (a.size == b.size && !memcmp(a.start, b.start, a.size));
  ------------------
  |  Branch (56:11): [True: 109k, False: 444M]
  |  Branch (56:31): [True: 4.44k, False: 104k]
  ------------------
   57|   444M|}
transport.c:pn_string_bytes:
   59|   444M|static inline pn_bytes_t pn_string_bytes(struct pn_string_t *s) {
   60|   444M|  return pn_bytes(pn_string_size(s), pn_string_get(s));
   61|   444M|}
framing.c:pni_read32:
   86|  3.35M|{
   87|  3.35M|  uint32_t a = pni_read16(bytes);
   88|  3.35M|  uint32_t b = pni_read16(&bytes[2]);
   89|  3.35M|  uint32_t r = a << 16 | b;
   90|  3.35M|  return r;
   91|  3.35M|}
framing.c:pni_read16:
   78|  10.0M|{
   79|  10.0M|  uint16_t a = (uint8_t) bytes[0];
   80|  10.0M|  uint16_t b = (uint8_t) bytes[1];
   81|  10.0M|  uint16_t r = a << 8 | b;
   82|  10.0M|  return r;
   83|  10.0M|}
framing.c:pni_write32:
   70|   451k|{
   71|   451k|  bytes[0] = 0xFF & (value >> 24);
   72|   451k|  bytes[1] = 0xFF & (value >> 16);
   73|   451k|  bytes[2] = 0xFF & (value >>  8);
   74|   451k|  bytes[3] = 0xFF & (value      );
   75|   451k|}
framing.c:pni_write16:
   64|   451k|{
   65|   451k|  bytes[0] = 0xFF & (value >> 8);
   66|   451k|  bytes[1] = 0xFF & (value     );
   67|   451k|}

pn_sasl_free:
  790|  30.6k|{
  791|  30.6k|  if (transport) {
  ------------------
  |  Branch (791:7): [True: 30.6k, False: 0]
  ------------------
  792|  30.6k|    pni_sasl_t *sasl = transport->sasl;
  793|  30.6k|    if (sasl) {
  ------------------
  |  Branch (793:9): [True: 0, False: 30.6k]
  ------------------
  794|      0|      free(sasl->selected_mechanism);
  795|      0|      free(sasl->included_mechanisms);
  796|      0|      free(sasl->password);
  797|      0|      free(sasl->external_auth);
  798|      0|      free(sasl->local_fqdn);
  799|       |
  800|      0|      if (sasl->impl_context) {
  ------------------
  |  Branch (800:11): [True: 0, False: 0]
  ------------------
  801|      0|        pni_sasl_impl_free(transport);
  802|      0|      }
  803|      0|      pn_buffer_free(sasl->decoded_buffer);
  804|      0|      pn_buffer_free(sasl->encoded_buffer);
  805|      0|      free(sasl);
  806|      0|    }
  807|  30.6k|  }
  808|  30.6k|}
pn_do_init:
  892|      1|{
  893|      1|  pni_sasl_t *sasl = transport->sasl;
  894|       |
  895|       |  // If we haven't got an sasl struct yet we've in an error state
  896|       |  // This can only happen if our peer sent SASL frames even though he didn't send the SASL header
  897|      1|  if (!sasl) return PN_ERR;
  ------------------
  |  |   48|      1|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (897:7): [True: 1, False: 0]
  ------------------
  898|       |
  899|       |  // We should only receive this if we are a sasl server
  900|      0|  if (sasl->client) return PN_ERR;
  ------------------
  |  |   48|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (900:7): [True: 0, False: 0]
  ------------------
  901|       |
  902|      0|  pn_bytes_t mech;
  903|      0|  pn_bytes_t recv;
  904|       |
  905|      0|  pn_amqp_decode_DqEsze(payload, &mech, &recv);
  906|      0|  sasl->selected_mechanism = pn_strndup(mech.start, mech.size);
  907|       |
  908|       |  // We need to filter out a supplied mech in in the inclusion list
  909|       |  // as the client could have used a mech that we support, but that
  910|       |  // wasn't on the list we sent.
  911|      0|  if (!pni_sasl_server_included_mech(sasl->included_mechanisms, mech)) {
  ------------------
  |  Branch (911:7): [True: 0, False: 0]
  ------------------
  912|      0|    pnx_sasl_error(transport, "Client mechanism not in mechanism inclusion list.", "amqp:unauthorized-access");
  913|      0|    sasl->outcome = PN_SASL_AUTH;
  914|      0|    pnx_sasl_set_desired_state(transport, SASL_POSTED_OUTCOME);
  915|      0|  } else {
  916|      0|    pni_sasl_impl_process_init(transport, sasl->selected_mechanism, &recv);
  917|      0|  }
  918|       |
  919|      0|  return 0;
  920|      0|}
pn_do_mechanisms:
  924|      1|{
  925|      1|  pni_sasl_t *sasl = transport->sasl;
  926|       |
  927|       |  // If we haven't got an sasl struct yet we've in an error state
  928|       |  // This can only happen if our peer sent SASL frames even though we didn't send the SASL header
  929|      1|  if (!sasl) return PN_ERR;
  ------------------
  |  |   48|      1|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (929:7): [True: 1, False: 0]
  ------------------
  930|       |
  931|       |  // We should only receive this if we are a sasl client
  932|      0|  if (!sasl->client) return PN_ERR;
  ------------------
  |  |   48|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (932:7): [True: 0, False: 0]
  ------------------
  933|       |
  934|      0|  pn_string_t *mechs = pn_string("");
  935|       |
  936|      0|  pn_bytes_t subpayload;
  937|      0|  pn_amqp_decode_DqERe(payload, &subpayload);
  938|      0|  pni_consumer_t consumer = make_consumer_from_bytes(subpayload);
  939|       |
  940|      0|  uint8_t element_type;
  941|      0|  uint32_t element_count;
  942|      0|  pni_consumer_t subconsumer;
  943|      0|  if (consume_array(&consumer, &subconsumer, &element_count, &element_type) && (element_type==PNE_SYM32 || element_type==PNE_SYM8)) {
  ------------------
  |  |   37|      0|#define PNE_SYM32           (0xb3)
  ------------------
                if (consume_array(&consumer, &subconsumer, &element_count, &element_type) && (element_type==PNE_SYM32 || element_type==PNE_SYM8)) {
  ------------------
  |  |   36|      0|#define PNE_SYM8            (0xa3)
  ------------------
  |  Branch (943:7): [True: 0, False: 0]
  |  Branch (943:81): [True: 0, False: 0]
  |  Branch (943:108): [True: 0, False: 0]
  ------------------
  944|       |    // If this is an array of symbols decode each symbol
  945|      0|    pn_bytes_t symbol;
  946|      0|    switch (element_type) {
  ------------------
  |  Branch (946:13): [True: 0, False: 0]
  ------------------
  947|      0|      case PNE_SYM8:
  ------------------
  |  |   36|      0|#define PNE_SYM8            (0xa3)
  ------------------
  |  Branch (947:7): [True: 0, False: 0]
  ------------------
  948|      0|        while (element_count) {
  ------------------
  |  Branch (948:16): [True: 0, False: 0]
  ------------------
  949|      0|          if (!pni_consumer_readv8(&subconsumer, &symbol)) break;
  ------------------
  |  Branch (949:15): [True: 0, False: 0]
  ------------------
  950|      0|          if (pni_sasl_client_included_mech(sasl->included_mechanisms, symbol)) {
  ------------------
  |  Branch (950:15): [True: 0, False: 0]
  ------------------
  951|      0|            pn_string_addf(mechs, "%.*s ", (int)symbol.size, symbol.start);
  952|      0|          }
  953|      0|          --element_count;
  954|      0|        }
  955|      0|        break;
  956|      0|      case PNE_SYM32:
  ------------------
  |  |   37|      0|#define PNE_SYM32           (0xb3)
  ------------------
  |  Branch (956:7): [True: 0, False: 0]
  ------------------
  957|      0|        while (element_count) {
  ------------------
  |  Branch (957:16): [True: 0, False: 0]
  ------------------
  958|      0|          if (!pni_consumer_readv32(&subconsumer, &symbol)) break;
  ------------------
  |  Branch (958:15): [True: 0, False: 0]
  ------------------
  959|      0|          if (pni_sasl_client_included_mech(sasl->included_mechanisms, symbol)) {
  ------------------
  |  Branch (959:15): [True: 0, False: 0]
  ------------------
  960|      0|            pn_string_addf(mechs, "%.*s ", (int)symbol.size, symbol.start);
  961|      0|          }
  962|      0|          --element_count;
  963|      0|        }
  964|      0|        break;
  965|      0|    }
  966|      0|    if (pn_string_size(mechs)) {
  ------------------
  |  Branch (966:9): [True: 0, False: 0]
  ------------------
  967|      0|      pn_string_buffer(mechs)[pn_string_size(mechs)-1] = 0;
  968|      0|    }
  969|      0|  } else {
  970|       |    // If not then see if it is a single symbol
  971|      0|    pn_bytes_t symbol;
  972|      0|    pn_amqp_decode_DqEse(payload, &symbol);
  973|       |
  974|      0|    if (pni_sasl_client_included_mech(sasl->included_mechanisms, symbol)) {
  ------------------
  |  Branch (974:9): [True: 0, False: 0]
  ------------------
  975|      0|      pn_string_setn(mechs, symbol.start, symbol.size);
  976|      0|    }
  977|      0|  }
  978|       |
  979|      0|  if (!(pni_sasl_impl_init_client(transport) &&
  ------------------
  |  Branch (979:9): [True: 0, False: 0]
  ------------------
  980|      0|        pn_string_size(mechs) &&
  ------------------
  |  Branch (980:9): [True: 0, False: 0]
  ------------------
  981|      0|        pni_sasl_impl_process_mechanisms(transport, pn_string_get(mechs)))) {
  ------------------
  |  Branch (981:9): [True: 0, False: 0]
  ------------------
  982|      0|    sasl->outcome = PN_SASL_PERM;
  983|      0|    pnx_sasl_set_desired_state(transport, SASL_RECVED_FAILURE);
  984|      0|  }
  985|       |
  986|      0|  pn_free(mechs);
  987|      0|  return 0;
  988|      0|}
pn_do_challenge:
  992|      1|{
  993|      1|  pni_sasl_t *sasl = transport->sasl;
  994|       |
  995|       |  // If we haven't got an sasl struct yet we've in an error state
  996|       |  // This can only happen if our peer sent SASL frames even though we didn't send the SASL header
  997|      1|  if (!sasl) return PN_ERR;
  ------------------
  |  |   48|      1|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (997:7): [True: 1, False: 0]
  ------------------
  998|       |
  999|       |  // We should only receive this if we are a sasl client
 1000|      0|  if (!sasl->client) return PN_ERR;
  ------------------
  |  |   48|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (1000:7): [True: 0, False: 0]
  ------------------
 1001|       |
 1002|      0|  pn_bytes_t recv;
 1003|       |
 1004|      0|  pn_amqp_decode_DqEze(payload, &recv);
 1005|       |
 1006|      0|  pni_sasl_impl_process_challenge(transport, &recv);
 1007|       |
 1008|      0|  return 0;
 1009|      0|}
pn_do_response:
 1013|      1|{
 1014|      1|  pni_sasl_t *sasl = transport->sasl;
 1015|       |
 1016|       |  // If we haven't got an sasl struct yet we've in an error state
 1017|       |  // This can only happen if our peer sent SASL frames even though he didn't send the SASL header
 1018|      1|  if (!sasl) return PN_ERR;
  ------------------
  |  |   48|      1|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (1018:7): [True: 1, False: 0]
  ------------------
 1019|       |
 1020|       |  // We should only receive this if we are a sasl server
 1021|      0|  if (sasl->client) return PN_ERR;
  ------------------
  |  |   48|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (1021:7): [True: 0, False: 0]
  ------------------
 1022|       |
 1023|      0|  pn_bytes_t recv;
 1024|       |
 1025|      0|  pn_amqp_decode_DqEze(payload, &recv);
 1026|       |
 1027|      0|  pni_sasl_impl_process_response(transport, &recv);
 1028|       |
 1029|      0|  return 0;
 1030|      0|}
pn_do_outcome:
 1034|      1|{
 1035|      1|  pni_sasl_t *sasl = transport->sasl;
 1036|       |
 1037|       |  // If we haven't got an sasl struct yet we've in an error state
 1038|       |  // This can only happen if our peer sent SASL frames even though we didn't send the SASL header
 1039|      1|  if (!sasl) return PN_ERR;
  ------------------
  |  |   48|      1|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (1039:7): [True: 1, False: 0]
  ------------------
 1040|       |
 1041|       |  // We should only receive this if we are a sasl client
 1042|      0|  if (!sasl->client) return PN_ERR;
  ------------------
  |  |   48|      0|#define PN_ERR (-2)            /**< General error */
  ------------------
  |  Branch (1042:7): [True: 0, False: 0]
  ------------------
 1043|       |
 1044|      0|  uint8_t outcome;
 1045|      0|  pn_bytes_t recv;
 1046|       |
 1047|      0|  pn_amqp_decode_DqEBze(payload, &outcome, &recv);
 1048|       |
 1049|       |  // Preset the outcome to what the server sent us - the plugin can alter this.
 1050|       |  // In practise the plugin processing here should only fail because it fails
 1051|       |  // to authenticate the server id after the server authenticates our user.
 1052|       |  // It should never succeed after the server outcome was failure.
 1053|      0|  sasl->outcome = (pn_sasl_outcome_t) outcome;
 1054|       |
 1055|      0|  pni_sasl_impl_process_outcome(transport, &recv);
 1056|       |
 1057|      0|  bool authenticated = sasl->outcome==PN_SASL_OK;
 1058|      0|  transport->authenticated = authenticated;
 1059|      0|  pnx_sasl_set_desired_state(transport, authenticated ? SASL_RECVED_SUCCESS : SASL_RECVED_FAILURE);
  ------------------
  |  Branch (1059:41): [True: 0, False: 0]
  ------------------
 1060|      0|  return 0;
 1061|      0|}

pn_ssl_free:
  952|  30.6k|{
  953|  30.6k|  pni_ssl_t *ssl = transport->ssl;
  954|  30.6k|  if (!ssl) return;
  ------------------
  |  Branch (954:7): [True: 30.6k, False: 0]
  ------------------
  955|      0|  ssl_log(transport, PN_LEVEL_TRACE, "SSL socket freed." );
  956|      0|  release_ssl_socket( ssl );
  957|      0|  if (ssl->session_id) free((void *)ssl->session_id);
  ------------------
  |  Branch (957:7): [True: 0, False: 0]
  ------------------
  958|      0|  if (ssl->peer_hostname) free((void *)ssl->peer_hostname);
  ------------------
  |  Branch (958:7): [True: 0, False: 0]
  ------------------
  959|      0|  if (ssl->inbuf) free((void *)ssl->inbuf);
  ------------------
  |  Branch (959:7): [True: 0, False: 0]
  ------------------
  960|      0|  if (ssl->outbuf) free((void *)ssl->outbuf);
  ------------------
  |  Branch (960:7): [True: 0, False: 0]
  ------------------
  961|      0|  if (ssl->subject) free(ssl->subject);
  ------------------
  |  Branch (961:7): [True: 0, False: 0]
  ------------------
  962|      0|  if (ssl->peer_certificate) X509_free(ssl->peer_certificate);
  ------------------
  |  Branch (962:7): [True: 0, False: 0]
  ------------------
  963|      0|  free(ssl);
  964|      0|}

devnull:
   60|  5.83k|void devnull(intptr_t context, pn_log_subsystem_t sub,  pn_log_level_t sev, const char *message) {}
LLVMFuzzerTestOneInput:
   62|  30.6k|int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   63|  30.6k|  if (VERBOSE)
  ------------------
  |  Branch (63:7): [Folded - Ignored]
  ------------------
   64|      0|    printf("BEGIN LLVMFuzzerTestOneInput\n");
   65|  30.6k|  app_data_t app = {{0}};
   66|  30.6k|  sprintf(app.container_id, "%s:%06x",
   67|  30.6k|           "fuzz_connection_driver", rand() & 0xffffff);
   68|       |
   69|  30.6k|  pn_connection_driver_t driver;
   70|  30.6k|  if (pn_connection_driver_init(&driver, NULL, NULL) != 0) {
  ------------------
  |  Branch (70:7): [True: 0, False: 30.6k]
  ------------------
   71|      0|    printf("pn_connection_driver_init\n");
   72|      0|    exit(1);
   73|      0|  }
   74|       |
   75|  30.6k|  pn_logger_set_log_sink(pn_default_logger(), devnull, 0);
   76|       |
   77|  30.6k|  uint8_t *data = (uint8_t *)Data;
   78|  30.6k|  size_t size = Size;
   79|       |
   80|  30.6k|  fdc_write(&driver);
   81|       |
   82|  30.6k|  pn_event_t *event;
   83|   245k|  while ((event = pn_connection_driver_next_event(&driver)) != NULL) {
  ------------------
  |  Branch (83:10): [True: 214k, False: 30.6k]
  ------------------
   84|   214k|    handle(&app, event);
   85|   214k|  }
   86|       |
   87|  30.6k|  fdc_write(&driver);
   88|       |
   89|  45.2k|  do {
   90|  45.2k|    fdc_write(&driver);
   91|  45.2k|    fcd_read(&driver, &data, &size);
   92|  45.2k|    if (VERBOSE)
  ------------------
  |  Branch (92:9): [Folded - Ignored]
  ------------------
   93|      0|      printf("size is %d, data is %p\n", (int)size, (void *)data);
   94|  6.21M|    while ((event = pn_connection_driver_next_event(&driver)) != NULL) {
  ------------------
  |  Branch (94:12): [True: 6.16M, False: 45.2k]
  ------------------
   95|  6.16M|      handle(&app, event);
   96|  6.16M|    }
   97|  45.2k|  } while (size > 0);
  ------------------
  |  Branch (97:12): [True: 14.5k, False: 30.6k]
  ------------------
   98|       |
   99|  30.6k|  pn_connection_driver_close(&driver);
  100|  30.6k|  pn_connection_driver_destroy(&driver);
  101|  30.6k|  if (VERBOSE)
  ------------------
  |  Branch (101:7): [Folded - Ignored]
  ------------------
  102|      0|    printf("END LLVMFuzzerTestOneInput\n");
  103|  30.6k|  return 0;
  104|  30.6k|}
fcd_read:
  198|  45.2k|size_t fcd_read(pn_connection_driver_t *driver, uint8_t **data, size_t *size) {
  199|  45.2k|  pn_rwbytes_t buf = pn_connection_driver_read_buffer(driver);
  200|  45.2k|  size_t s = (*size < buf.size) ? *size : buf.size;
  ------------------
  |  Branch (200:14): [True: 30.3k, False: 14.9k]
  ------------------
  201|  45.2k|  if (buf.start == NULL) {
  ------------------
  |  Branch (201:7): [True: 301, False: 44.9k]
  ------------------
  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|    301|    *size = 0;
  206|    301|    return *size;
  207|    301|  }
  208|  44.9k|  memcpy(buf.start, *data, s);
  209|       |
  210|  44.9k|  pn_connection_driver_read_done(driver, s);
  211|  44.9k|  *data += s;
  212|  44.9k|  *size -= s;
  213|       |
  214|  44.9k|  return *size;
  215|  45.2k|}
fuzz-connection-driver.c:handle:
  106|  6.38M|static void handle(app_data_t *app, pn_event_t *event) {
  107|  6.38M|  switch (pn_event_type(event)) {
  108|       |
  109|  30.6k|  case PN_CONNECTION_INIT: {
  ------------------
  |  Branch (109:3): [True: 30.6k, False: 6.35M]
  ------------------
  110|  30.6k|    pn_connection_t *c = pn_event_connection(event);
  111|  30.6k|    pn_connection_set_container(c, app->container_id);
  112|  30.6k|    pn_connection_open(c);
  113|  30.6k|    pn_session_t *s = pn_session(c);
  114|  30.6k|    pn_session_open(s);
  115|  30.6k|    pn_link_t *l = pn_receiver(s, "my_receiver");
  116|  30.6k|    pn_terminus_set_address(pn_link_source(l), NULL);
  117|  30.6k|    pn_link_open(l);
  118|  30.6k|    pn_link_flow(l, 20);
  119|  30.6k|  } break;
  120|       |
  121|  2.31M|  case PN_DELIVERY: {
  ------------------
  |  Branch (121:3): [True: 2.31M, False: 4.06M]
  ------------------
  122|       |    /* A message has been received */
  123|  2.31M|    pn_link_t *link = NULL;
  124|  2.31M|    pn_delivery_t *dlv = pn_event_delivery(event);
  125|  2.31M|    if (pn_delivery_readable(dlv) && !pn_delivery_partial(dlv)) {
  ------------------
  |  Branch (125:9): [True: 978k, False: 1.33M]
  |  Branch (125:38): [True: 964k, False: 14.9k]
  ------------------
  126|   964k|      link = pn_delivery_link(dlv);
  127|   964k|      decode_message(dlv);
  128|       |      /* Accept the delivery */
  129|   964k|      pn_delivery_update(dlv, PN_ACCEPTED);
  ------------------
  |  |   66|   964k|#define PN_ACCEPTED (0x0000000000000024)
  ------------------
  130|       |      /* done with the delivery, move to the next and free it */
  131|   964k|      pn_link_advance(link);
  132|   964k|      pn_delivery_settle(dlv); /* dlv is now freed */
  133|   964k|    }
  134|  2.31M|  } break;
  135|       |
  136|  8.27k|  case PN_TRANSPORT_ERROR:
  ------------------
  |  Branch (136:3): [True: 8.27k, False: 6.37M]
  ------------------
  137|  8.27k|    check_condition(event, pn_transport_condition(pn_event_transport(event)));
  138|  8.27k|    pn_connection_close(pn_event_connection(event));
  139|  8.27k|    break;
  140|       |
  141|  1.52k|  case PN_CONNECTION_REMOTE_CLOSE:
  ------------------
  |  Branch (141:3): [True: 1.52k, False: 6.38M]
  ------------------
  142|  1.52k|    check_condition(event,
  143|  1.52k|                    pn_connection_remote_condition(pn_event_connection(event)));
  144|  1.52k|    pn_connection_close(pn_event_connection(event));
  145|  1.52k|    break;
  146|       |
  147|  3.20k|  case PN_SESSION_REMOTE_CLOSE:
  ------------------
  |  Branch (147:3): [True: 3.20k, False: 6.38M]
  ------------------
  148|  3.20k|    check_condition(event,
  149|  3.20k|                    pn_session_remote_condition(pn_event_session(event)));
  150|  3.20k|    pn_connection_close(pn_event_connection(event));
  151|  3.20k|    break;
  152|       |
  153|  11.7k|  case PN_LINK_REMOTE_CLOSE:
  ------------------
  |  Branch (153:3): [True: 11.7k, False: 6.37M]
  ------------------
  154|  43.6k|  case PN_LINK_REMOTE_DETACH:
  ------------------
  |  Branch (154:3): [True: 31.9k, False: 6.35M]
  ------------------
  155|  43.6k|    check_condition(event, pn_link_remote_condition(pn_event_link(event)));
  156|  43.6k|    pn_connection_close(pn_event_connection(event));
  157|  43.6k|    break;
  158|       |
  159|  3.98M|  default:
  ------------------
  |  Branch (159:3): [True: 3.98M, False: 2.40M]
  ------------------
  160|  3.98M|    break;
  161|  6.38M|  }
  162|  6.38M|}
fuzz-connection-driver.c:decode_message:
  174|   964k|static void decode_message(pn_delivery_t *dlv) {
  175|   964k|  static char buffer[MAX_SIZE];
  176|   964k|  ssize_t len;
  177|       |  // try to decode the message body
  178|   964k|  if (pn_delivery_pending(dlv) < MAX_SIZE) {
  ------------------
  |  |   37|   964k|#define MAX_SIZE 1024
  ------------------
  |  Branch (178:7): [True: 961k, False: 2.83k]
  ------------------
  179|       |    // read in the raw data
  180|   961k|    len = pn_link_recv(pn_delivery_link(dlv), buffer, MAX_SIZE);
  ------------------
  |  |   37|   961k|#define MAX_SIZE 1024
  ------------------
  181|   961k|    if (len > 0) {
  ------------------
  |  Branch (181:9): [True: 507k, False: 454k]
  ------------------
  182|       |      // decode it into a proton message
  183|   507k|      pn_message_t *m = pn_message();
  184|   507k|      if (PN_OK == pn_message_decode(m, buffer, len)) {
  ------------------
  |  |   46|   507k|#define PN_OK (0)              /**< No error */
  ------------------
  |  Branch (184:11): [True: 507k, False: 0]
  ------------------
  185|   507k|        char *s = pn_tostring(pn_message_body(m));
  186|   507k|        if (ERRORS)
  ------------------
  |  Branch (186:13): [Folded - Ignored]
  ------------------
  187|      0|          printf("%s\n", s);
  188|   507k|        free(s);
  189|   507k|      }
  190|   507k|      pn_message_free(m);
  191|   507k|    }
  192|   961k|  }
  193|   964k|}
fuzz-connection-driver.c:check_condition:
  164|  56.6k|static void check_condition(pn_event_t *e, pn_condition_t *cond) {
  165|  56.6k|  if (VERBOSE)
  ------------------
  |  Branch (165:7): [Folded - Ignored]
  ------------------
  166|      0|    printf("beginning check_condition\n");
  167|  56.6k|  if (pn_condition_is_set(cond)) {
  ------------------
  |  Branch (167:7): [True: 9.09k, False: 47.5k]
  ------------------
  168|  9.09k|    if (VERBOSE || ERRORS)
  ------------------
  |  Branch (168:9): [Folded - Ignored]
  |  Branch (168:20): [Folded - Ignored]
  ------------------
  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|  9.09k|  }
  172|  56.6k|}
fuzz-connection-driver.c:fdc_write:
  218|   106k|static void fdc_write(pn_connection_driver_t *driver) {
  219|   106k|  pn_bytes_t buffer = pn_connection_driver_write_buffer(driver);
  220|   106k|  pn_connection_driver_write_done(driver, buffer.size);
  221|   106k|}

