run_burl_normalize:
   26|  1.70k|						size_t in_len) {
   27|  1.70k|    int qs;
   28|  1.70k|    buffer_copy_string_len(psrc, in, in_len);
   29|  1.70k|    qs = burl_normalize(psrc, ptmp, flags);
   30|  1.70k|}
LLVMFuzzerTestOneInput:
   32|  1.71k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   33|  1.71k|    if (size <= 4) {
  ------------------
  |  Branch (33:9): [True: 4, False: 1.70k]
  ------------------
   34|      4|        return 0;
   35|      4|    }
   36|  1.70k|    int flags = ((int*)data)[0];
   37|  1.70k|    data += 4;
   38|  1.70k|    size -= 4;
   39|  1.70k|    char *new_str = (char *)malloc(size+1);
   40|  1.70k|    if (new_str == NULL){
  ------------------
  |  Branch (40:9): [True: 0, False: 1.70k]
  ------------------
   41|      0|        return 0;
   42|      0|    }
   43|  1.70k|    memcpy(new_str, data, size);
   44|  1.70k|    new_str[size] = '\0';
   45|       |
   46|       |    /* main fuzzer entrypoint for library */
   47|  1.70k|    buffer *psrc = buffer_init();
   48|  1.70k|    buffer *ptmp = buffer_init();
   49|  1.70k|    run_burl_normalize(psrc, ptmp, flags, __LINE__, new_str, size);
   50|  1.70k|    buffer_urldecode_path(psrc);
   51|       |
   52|  1.70k|    buffer_free(psrc);
   53|  1.70k|    buffer_free(ptmp);
   54|  1.70k|    free(new_str);
   55|  1.70k|    return 0;     
   56|  1.70k|}

buffer_init:
   14|  3.41k|buffer* buffer_init(void) {
   15|       |  #if 0 /* buffer_init() and chunk_init() can be hot,
   16|       |	 * so avoid the additional hop of indirection */
   17|       |	return ck_calloc(1, sizeof(buffer));
   18|       |  #else
   19|  3.41k|	buffer * const b = calloc(1, sizeof(*b));
   20|  3.41k|	force_assert(b);
  ------------------
  |  |  448|  3.41k|#define force_assert(x) ck_assert(x)
  |  |  ------------------
  |  |  |  |  115|  3.41k|        do { if (!(x)) ck_assert_failed(__FILE__, __LINE__, #x); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (115:18): [True: 0, False: 3.41k]
  |  |  |  |  |  Branch (115:75): [Folded, False: 3.41k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   21|  3.41k|	return b;
   22|  3.41k|  #endif
   23|  3.41k|}
buffer_free:
   25|  3.41k|void buffer_free(buffer *b) {
   26|  3.41k|	if (NULL == b) return;
  ------------------
  |  Branch (26:6): [True: 0, False: 3.41k]
  ------------------
   27|  3.41k|	free(b->ptr);
   28|  3.41k|	free(b);
   29|  3.41k|}
buffer_string_prepare_copy:
   82|  1.31k|char* buffer_string_prepare_copy(buffer * const b, const size_t size) {
   83|  1.31k|    b->used = 0;
   84|       |  #ifdef __COVERITY__ /*(b->ptr is not NULL if b->size is not 0)*/
   85|       |    force_assert(size >= b->size || b->ptr);
   86|       |  #endif
   87|  1.31k|    return (size < b->size)
  ------------------
  |  Branch (87:12): [True: 0, False: 1.31k]
  ------------------
   88|  1.31k|      ? b->ptr
   89|  1.31k|      : buffer_alloc_replace(b, size);
   90|  1.31k|}
buffer_extend:
  127|    145|{
  128|       |    /* extend buffer to append x (reallocate by power-2 (or larger), if needed)
  129|       |     * (combine buffer_string_prepare_append() and buffer_commit())
  130|       |     * (future: might make buffer.h static inline func for HTTP/1.1 performance)
  131|       |     * pre-sets '\0' byte and b->used (unlike buffer_string_prepare_append())*/
  132|       |  #if 0
  133|       |    char * const s = buffer_string_prepare_append(b, x);
  134|       |    b->used += x + (0 == b->used);
  135|       |  #else
  136|    145|    const uint32_t len = b->used ? b->used-1 : 0;
  ------------------
  |  Branch (136:26): [True: 145, False: 0]
  ------------------
  137|    145|    char * const s = (b->size - len >= x + 1)
  ------------------
  |  Branch (137:22): [True: 145, False: 0]
  ------------------
  138|    145|      ? b->ptr + len
  139|    145|      : buffer_string_prepare_append_resize(b, x);
  140|    145|    b->used = len+x+1;
  141|    145|  #endif
  142|    145|    s[x] = '\0';
  143|    145|    return s;
  144|    145|}
buffer_copy_string_len:
  172|  3.16k|void buffer_copy_string_len(buffer * const restrict b, const char * const restrict s, const size_t len) {
  173|  3.16k|    b->used = len + 1;
  174|  3.16k|    char * const restrict d = (len < b->size)
  ------------------
  |  Branch (174:31): [True: 960, False: 2.20k]
  ------------------
  175|  3.16k|      ? b->ptr
  176|  3.16k|      : buffer_alloc_replace(b, len);
  177|  3.16k|    d[len] = '\0';
  178|  3.16k|    memcpy(d, s, len);
  179|  3.16k|}
buffer_append_string_len:
  198|    145|void buffer_append_string_len(buffer * const restrict b, const char * const restrict s, const size_t len) {
  199|    145|    memcpy(buffer_extend(b, len), s, len);
  200|    145|}
hex2int:
  386|   104M|char hex2int(unsigned char hex) {
  387|   104M|	unsigned char n;
  388|   104M|	return li_cton(hex,n) ? (char)n : 0xFF;
  ------------------
  |  |  381|   104M|  (((n) = (c) - '0') <= 9 || (((n) = ((c)&0xdf) - 'A') <= 5 ? ((n) += 10) : 0))
  |  |  ------------------
  |  |  |  Branch (381:4): [True: 90.2M, False: 14.6M]
  |  |  |  Branch (381:30): [True: 14.6M, False: 0]
  |  |  |  Branch (381:31): [True: 14.6M, False: 0]
  |  |  ------------------
  ------------------
  389|   104M|}
buffer_urldecode_path:
  792|  1.70k|void buffer_urldecode_path(buffer * const b) {
  793|  1.70k|    const size_t len = buffer_clen(b);
  794|  1.70k|    char *src = len ? memchr(b->ptr, '%', len) : NULL;
  ------------------
  |  Branch (794:17): [True: 1.69k, False: 8]
  ------------------
  795|  1.70k|    if (NULL == src) return;
  ------------------
  |  Branch (795:9): [True: 365, False: 1.34k]
  ------------------
  796|       |
  797|  1.34k|    char *dst = src;
  798|  52.4M|    do {
  799|       |        /* *src == '%' */
  800|  52.4M|        unsigned char high = ((unsigned char *)src)[1];
  801|  52.4M|        unsigned char low = high ? hex2int(((unsigned char *)src)[2]) : 0xFF;
  ------------------
  |  Branch (801:29): [True: 52.4M, False: 0]
  ------------------
  802|  52.4M|        if (0xFF != (high = hex2int(high)) && 0xFF != low) {
  ------------------
  |  Branch (802:13): [True: 52.4M, False: 0]
  |  Branch (802:47): [True: 52.4M, False: 0]
  ------------------
  803|  52.4M|            high = (high << 4) | low;   /* map ctrls to '_' */
  804|  52.4M|            *dst = (high >= 32 && high != 127) ? high : '_';
  ------------------
  |  Branch (804:21): [True: 12.1M, False: 40.2M]
  |  Branch (804:35): [True: 11.1M, False: 1.05M]
  ------------------
  805|  52.4M|            src += 2;
  806|  52.4M|        } /* else ignore this '%'; leave as-is and move on */
  807|       |
  808|  56.2M|        while ((*++dst = *++src) != '%' && *src) ;
  ------------------
  |  Branch (808:16): [True: 3.77M, False: 52.4M]
  |  Branch (808:44): [True: 3.77M, False: 1.34k]
  ------------------
  809|  52.4M|    } while (*src);
  ------------------
  |  Branch (809:14): [True: 52.4M, False: 1.34k]
  ------------------
  810|  1.34k|    b->used = (dst - b->ptr) + 1;
  811|  1.34k|}
buffer_path_simplify:
  859|    404|{
  860|    404|    char *out = b->ptr;
  861|    404|    char * const end = b->ptr + b->used - 1;
  862|       |
  863|    404|    if (__builtin_expect( (buffer_is_blank(b)), 0)) {
  ------------------
  |  Branch (863:9): [True: 0, False: 404]
  ------------------
  864|      0|        buffer_blank(b);
  865|      0|        return;
  866|      0|    }
  867|       |
  868|       |  #if defined(_WIN32) || defined(__CYGWIN__)
  869|       |    /* cygwin is treating \ and / the same, so we have to that too */
  870|       |    for (char *p = b->ptr; *p; p++) {
  871|       |        if (*p == '\\') *p = '/';
  872|       |    }
  873|       |  #endif
  874|       |
  875|    404|    *end = '/'; /*(end of path modified to avoid need to check '\0')*/
  876|       |
  877|    404|    char *walk = out;
  878|    404|    if (__builtin_expect( (*walk == '/'), 1)) {
  ------------------
  |  Branch (878:9): [True: 148, False: 256]
  ------------------
  879|       |        /* scan to detect (potential) need for path simplification
  880|       |         * (repeated '/' or "/.") */
  881|    552|        do {
  882|    552|            if (*++walk == '.' || *walk == '/')
  ------------------
  |  Branch (882:17): [True: 85, False: 467]
  |  Branch (882:35): [True: 63, False: 404]
  ------------------
  883|    148|                break;
  884|   322k|            do { ++walk; } while (*walk != '/');
  ------------------
  |  Branch (884:35): [True: 322k, False: 404]
  ------------------
  885|    404|        } while (walk != end);
  ------------------
  |  Branch (885:18): [True: 404, False: 0]
  ------------------
  886|    148|        if (__builtin_expect( (walk == end), 1)) {
  ------------------
  |  Branch (886:13): [True: 0, False: 148]
  ------------------
  887|       |            /* common case: no repeated '/' or "/." */
  888|      0|            *end = '\0'; /* overwrite extra '/' added to end of path */
  889|      0|            return;
  890|      0|        }
  891|    148|        out = walk-1;
  892|    148|    }
  893|    256|    else {
  894|    256|        if (walk[0] == '.' && walk[1] == '/')
  ------------------
  |  Branch (894:13): [True: 115, False: 141]
  |  Branch (894:31): [True: 69, False: 46]
  ------------------
  895|     69|            *out = *++walk;
  896|    187|        else if (walk[0] == '.' && walk[1] == '.' && walk[2] == '/')
  ------------------
  |  Branch (896:18): [True: 46, False: 141]
  |  Branch (896:36): [True: 22, False: 24]
  |  Branch (896:54): [True: 4, False: 18]
  ------------------
  897|      4|            *out = *(walk += 2);
  898|    183|        else {
  899|  3.29M|            while (*++walk != '/') ;
  ------------------
  |  Branch (899:20): [True: 3.29M, False: 183]
  ------------------
  900|    183|            out = walk;
  901|    183|        }
  902|    256|        ++walk;
  903|    256|    }
  904|       |
  905|  7.80k|    while (walk <= end) {
  ------------------
  |  Branch (905:12): [True: 7.59k, False: 218]
  ------------------
  906|       |        /* previous char is '/' at this point (or start of string w/o '/') */
  907|  7.59k|        if (__builtin_expect( (walk[0] == '/'), 0)) {
  ------------------
  |  Branch (907:13): [True: 1.77k, False: 5.82k]
  ------------------
  908|       |            /* skip repeated '/' (e.g. "///" -> "/") */
  909|  1.77k|            if (++walk < end)
  ------------------
  |  Branch (909:17): [True: 1.70k, False: 65]
  ------------------
  910|  1.70k|                continue;
  911|     65|            else {
  912|     65|                ++out;
  913|     65|                break;
  914|     65|            }
  915|  1.77k|        }
  916|  5.82k|        else if (__builtin_expect( (walk[0] == '.'), 0)) {
  ------------------
  |  Branch (916:18): [True: 4.00k, False: 1.81k]
  ------------------
  917|       |            /* handle "./" and "../" */
  918|  4.00k|            if (walk[1] == '.' && walk[2] == '/') {
  ------------------
  |  Branch (918:17): [True: 1.65k, False: 2.34k]
  |  Branch (918:35): [True: 777, False: 880]
  ------------------
  919|       |                /* handle "../" */
  920|  5.92M|                while (out > b->ptr && *--out != '/') ;
  ------------------
  |  Branch (920:24): [True: 5.92M, False: 548]
  |  Branch (920:40): [True: 5.92M, False: 229]
  ------------------
  921|    777|                *out = '/'; /*(in case path had not started with '/')*/
  922|    777|                if ((walk += 3) >= end) {
  ------------------
  |  Branch (922:21): [True: 52, False: 725]
  ------------------
  923|     52|                    ++out;
  924|     52|                    break;
  925|     52|                }
  926|    725|                else
  927|    725|                    continue;
  928|    777|            }
  929|  3.22k|            else if (walk[1] == '/') {
  ------------------
  |  Branch (929:22): [True: 1.67k, False: 1.55k]
  ------------------
  930|       |                /* handle "./" */
  931|  1.67k|                if ((walk += 2) >= end) {
  ------------------
  |  Branch (931:21): [True: 69, False: 1.60k]
  ------------------
  932|     69|                    ++out;
  933|     69|                    break;
  934|     69|                }
  935|  1.60k|                continue;
  936|  1.67k|            }
  937|  1.55k|            else {
  938|       |                /* accept "." if not part of "../" or "./" */
  939|  1.55k|                *++out = '.';
  940|  1.55k|                ++walk;
  941|  1.55k|            }
  942|  4.00k|        }
  943|       |
  944|  29.1M|        while ((*++out = *walk++) != '/') ;
  ------------------
  |  Branch (944:16): [True: 29.0M, False: 3.36k]
  ------------------
  945|  3.36k|    }
  946|    404|    *out = *end = '\0'; /* overwrite extra '/' added to end of path */
  947|    404|    b->used = (out - b->ptr) + 1;
  948|       |    /*buffer_truncate(b, out - b->ptr);*/
  949|    404|}
buffer.c:buffer_alloc_replace:
   71|  3.51k|static char* buffer_alloc_replace(buffer * const restrict b, const size_t size) {
   72|       |    /*(discard old data so realloc() does not copy)*/
   73|  3.51k|    if (NULL != b->ptr) {
  ------------------
  |  Branch (73:9): [True: 482, False: 3.03k]
  ------------------
   74|    482|        free(b->ptr);
   75|    482|        b->ptr = NULL;
   76|    482|    }
   77|       |    /*(note: if size larger than one lshift, use size instead of power-2)*/
   78|  3.51k|    const size_t bsize2x = (b->size & ~1uL) << 1;
   79|  3.51k|    return buffer_realloc(b, bsize2x > size ? bsize2x-1 : size);
  ------------------
  |  Branch (79:30): [True: 259, False: 3.25k]
  ------------------
   80|  3.51k|}
buffer.c:buffer_realloc:
   49|  3.51k|static char* buffer_realloc(buffer * const restrict b, const size_t len) {
   50|  3.51k|    #define BUFFER_PIECE_SIZE 64uL  /*(must be power-of-2)*/
   51|  3.51k|    size_t sz = (len + 1 + BUFFER_PIECE_SIZE-1) & ~(BUFFER_PIECE_SIZE-1);
  ------------------
  |  |   50|  3.51k|    #define BUFFER_PIECE_SIZE 64uL  /*(must be power-of-2)*/
  ------------------
                  size_t sz = (len + 1 + BUFFER_PIECE_SIZE-1) & ~(BUFFER_PIECE_SIZE-1);
  ------------------
  |  |   50|  3.51k|    #define BUFFER_PIECE_SIZE 64uL  /*(must be power-of-2)*/
  ------------------
   52|  3.51k|    force_assert(sz > len);
  ------------------
  |  |  448|  3.51k|#define force_assert(x) ck_assert(x)
  |  |  ------------------
  |  |  |  |  115|  3.51k|        do { if (!(x)) ck_assert_failed(__FILE__, __LINE__, #x); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (115:18): [True: 0, False: 3.51k]
  |  |  |  |  |  Branch (115:75): [Folded, False: 3.51k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   53|  3.51k|    if ((sz & (sz-1)) && sz < INT_MAX) {/* not power-2; huge val not expected */
  ------------------
  |  Branch (53:9): [True: 1.17k, False: 2.34k]
  |  Branch (53:26): [True: 1.17k, False: 0]
  ------------------
   54|       |        /*(optimizer should recognize this and use ffs or clz or equivalent)*/
   55|  1.17k|        const size_t psz = sz;
   56|  8.25k|        for (sz = 256; sz < psz; sz <<= 1) ;
  ------------------
  |  Branch (56:24): [True: 7.07k, False: 1.17k]
  ------------------
   57|  1.17k|    }
   58|  3.51k|    sz |= 1; /*(extra +1 for '\0' when needed buffer size is exact power-2)*/
   59|       |
   60|  3.51k|    b->size = sz;
   61|  3.51k|    b->ptr = realloc(b->ptr, sz);
   62|       |
   63|  3.51k|    force_assert(NULL != b->ptr);
  ------------------
  |  |  448|  3.51k|#define force_assert(x) ck_assert(x)
  |  |  ------------------
  |  |  |  |  115|  3.51k|        do { if (!(x)) ck_assert_failed(__FILE__, __LINE__, #x); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (115:18): [True: 0, False: 3.51k]
  |  |  |  |  |  Branch (115:75): [Folded, False: 3.51k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   64|  3.51k|    return b->ptr;
   65|  3.51k|}

burl.c:buffer_truncate:
  349|    438|static inline void buffer_truncate(buffer *b, uint32_t len) {
  350|    438|    b->ptr[len] = '\0'; /* b->ptr must exist; use buffer_blank() for trunc 0 */
  351|    438|    b->used = len + 1;
  352|    438|}
burl.c:light_isalnum:
  232|  12.1k|static inline int light_isalnum(int c) {
  233|  12.1k|	return light_isdigit(c) || light_isalpha(c);
  ------------------
  |  Branch (233:9): [True: 239, False: 11.9k]
  |  Branch (233:29): [True: 292, False: 11.6k]
  ------------------
  234|  12.1k|}
burl.c:light_isdigit:
  214|  12.1k|static inline int light_isdigit(int c) {
  215|  12.1k|	return ((uint32_t)c-'0' <= '9'-'0');
  216|  12.1k|}
burl.c:light_isalpha:
  226|  11.9k|static inline int light_isalpha(int c) {
  227|  11.9k|	return (((uint32_t)c | 0x20)-'a' <= 'z'-'a');
  228|  11.9k|}
burl.c:buffer_clen:
  323|  6.38k|static inline uint32_t buffer_clen (const buffer *b) {
  324|  6.38k|    return b->used - (0 != b->used);
  325|  6.38k|}
buffer.c:buffer_clen:
  323|  1.70k|static inline uint32_t buffer_clen (const buffer *b) {
  324|  1.70k|    return b->used - (0 != b->used);
  325|  1.70k|}
buffer.c:buffer_is_blank:
  315|    404|static inline int buffer_is_blank(const buffer *b) {
  316|    404|    return b->used < 2; /* buffer_is_blank() || buffer_is_unset() */
  317|    404|}

burl_normalize:
  344|  1.70k|{
  345|  1.70k|    int qs;
  346|       |
  347|       |  #if defined(_WIN32) || defined(__CYGWIN__)
  348|       |    /* Windows and Cygwin treat '\\' as '/' if '\\' is present in path;
  349|       |     * convert to '/' for consistency before percent-encoding
  350|       |     * normalization which will convert '\\' to "%5C" in the URL.
  351|       |     * (Clients still should not be sending '\\' unencoded in requests.) */
  352|       |    if (flags & HTTP_PARSEOPT_URL_NORMALIZE_PATH_BACKSLASH_TRANS) {
  353|       |        for (char *p = b->ptr; *p != '?' && *p != '\0'; ++p) {
  354|       |            if (*p == '\\') *p = '/';
  355|       |            if (p[0] == '%' && p[1] == '5' && (p[2] | 0x20) == 'c') {
  356|       |                p[1] = '2';
  357|       |                p[2] = 'F';
  358|       |                p += 2;
  359|       |            }
  360|       |        }
  361|       |    }
  362|       |  #endif
  363|       |
  364|  1.70k|    qs = (flags & HTTP_PARSEOPT_URL_NORMALIZE_REQUIRED)
  ------------------
  |  Branch (364:10): [True: 1.00k, False: 698]
  ------------------
  365|  1.70k|      ? burl_normalize_basic_required(b, t)
  366|  1.70k|      : burl_normalize_basic_unreserved(b, t);
  367|  1.70k|    if (-2 == qs) {
  ------------------
  |  Branch (367:9): [True: 514, False: 1.19k]
  ------------------
  368|    514|        if (flags & HTTP_PARSEOPT_URL_NORMALIZE_INVALID_UTF8_REJECT) return -2;
  ------------------
  |  Branch (368:13): [True: 104, False: 410]
  ------------------
  369|    410|        qs = burl_scan_qmark(b);
  370|    410|    }
  371|       |
  372|  1.60k|    if (flags & HTTP_PARSEOPT_URL_NORMALIZE_CTRLS_REJECT) {
  ------------------
  |  Branch (372:9): [True: 381, False: 1.22k]
  ------------------
  373|    381|        if (burl_contains_ctrls(b)) return -2;
  ------------------
  |  Branch (373:13): [True: 101, False: 280]
  ------------------
  374|    381|    }
  375|       |
  376|  1.50k|    if (flags & (HTTP_PARSEOPT_URL_NORMALIZE_PATH_2F_DECODE
  ------------------
  |  Branch (376:9): [True: 1.24k, False: 257]
  ------------------
  377|  1.50k|                |HTTP_PARSEOPT_URL_NORMALIZE_PATH_2F_REJECT)) {
  378|  1.24k|        qs = burl_normalize_2F_to_slash(b, qs, flags);
  379|  1.24k|        if (-2 == qs) return -2;
  ------------------
  |  Branch (379:13): [True: 8, False: 1.23k]
  ------------------
  380|  1.24k|    }
  381|       |
  382|  1.49k|    if (flags & (HTTP_PARSEOPT_URL_NORMALIZE_PATH_DOTSEG_REMOVE
  ------------------
  |  Branch (382:9): [True: 1.21k, False: 283]
  ------------------
  383|  1.49k|                |HTTP_PARSEOPT_URL_NORMALIZE_PATH_DOTSEG_REJECT)) {
  384|  1.21k|        qs = burl_normalize_path(b, t, qs, flags);
  385|  1.21k|        if (-2 == qs) return -2;
  ------------------
  |  Branch (385:13): [True: 14, False: 1.19k]
  ------------------
  386|  1.21k|    }
  387|       |
  388|  1.48k|    if (flags & HTTP_PARSEOPT_URL_NORMALIZE_QUERY_20_PLUS) {
  ------------------
  |  Branch (388:9): [True: 919, False: 561]
  ------------------
  389|    919|        if (qs >= 0) burl_normalize_qs20_to_plus(b, qs);
  ------------------
  |  Branch (389:13): [True: 455, False: 464]
  ------------------
  390|    919|    }
  391|       |
  392|  1.48k|    return qs;
  393|  1.49k|}
burl.c:burl_normalize_basic_required:
  179|  1.00k|{
  180|  1.00k|    const unsigned char * const s = (unsigned char *)b->ptr;
  181|  1.00k|    const int used = (int)buffer_clen(b);
  182|  1.00k|    unsigned int n1, n2, x;
  183|  1.00k|    int qs = -1;
  184|  1.00k|    int invalid_utf8 = 0;
  185|       |
  186|   466k|    for (int i = 0; i < used; ++i) {
  ------------------
  |  Branch (186:21): [True: 466k, False: 225]
  ------------------
  187|   466k|        if (!encoded_chars_http_uri_reqd[s[i]]) {
  ------------------
  |  Branch (187:13): [True: 449k, False: 17.0k]
  ------------------
  188|   449k|            if (__builtin_expect( (s[i] == '?'), 0) && -1 == qs) qs = i;
  ------------------
  |  Branch (188:17): [True: 8.97k, False: 440k]
  |  Branch (188:56): [True: 225, False: 8.74k]
  ------------------
  189|   449k|        }
  190|  17.0k|        else if (s[i]=='%' && li_cton(s[i+1], n1) && li_cton(s[i+2], n2)
  ------------------
  |  |   43|  33.4k|  (((n) = (c) - '0') <= 9 || (((n) = ((c)&0xdf) - 'A') <= 5 ? ((n) += 10) : 0))
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 12.0k, False: 4.37k]
  |  |  |  Branch (43:30): [True: 4.28k, False: 92]
  |  |  |  Branch (43:31): [True: 4.28k, False: 92]
  |  |  ------------------
  ------------------
                      else if (s[i]=='%' && li_cton(s[i+1], n1) && li_cton(s[i+2], n2)
  ------------------
  |  |   43|  33.4k|  (((n) = (c) - '0') <= 9 || (((n) = ((c)&0xdf) - 'A') <= 5 ? ((n) += 10) : 0))
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 8.16k, False: 8.21k]
  |  |  |  Branch (43:30): [True: 8.15k, False: 56]
  |  |  |  Branch (43:31): [True: 8.15k, False: 56]
  |  |  ------------------
  ------------------
  |  Branch (190:18): [True: 16.4k, False: 567]
  ------------------
  191|  16.3k|                 && (encoded_chars_http_uri_reqd[(x = (n1 << 4) | n2)]
  ------------------
  |  Branch (191:22): [True: 6.62k, False: 9.69k]
  ------------------
  192|  9.69k|                     || (qs < 0
  ------------------
  |  Branch (192:25): [True: 9.62k, False: 69]
  |  Branch (192:26): [True: 643, False: 9.05k]
  ------------------
  193|  9.69k|                         ? (x == '/' || x == '?')
  ------------------
  |  Branch (193:29): [True: 403, False: 240]
  |  Branch (193:41): [True: 209, False: 31]
  ------------------
  194|  16.2k|                         : (x == '&' || x == '=' || x == ';' || x == '+')))) {
  ------------------
  |  Branch (194:29): [True: 4.79k, False: 4.25k]
  |  Branch (194:41): [True: 2.41k, False: 1.84k]
  |  Branch (194:53): [True: 432, False: 1.41k]
  |  Branch (194:65): [True: 1.37k, False: 38]
  ------------------
  195|  16.2k|            invalid_utf8 |= li_utf8_invalid_byte(x);
  ------------------
  |  |   49|  16.2k|#define li_utf8_invalid_byte(b) light_utf8_invalid_byte(b)
  |  |  ------------------
  |  |  |  |  260|  16.2k|  (   __builtin_expect( ((c) >= 0xF5),       0) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (260:7): [True: 393, False: 15.8k]
  |  |  |  |  ------------------
  |  |  |  |  261|  16.2k|   || __builtin_expect( (((c)|0x1) == 0xC1), 0) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (261:7): [True: 29, False: 15.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  196|  16.2k|            if (s[i+1] >= 'a') b->ptr[i+1] &= 0xdf; /* uppercase hex */
  ------------------
  |  Branch (196:17): [True: 2.93k, False: 13.3k]
  ------------------
  197|  16.2k|            if (s[i+2] >= 'a') b->ptr[i+2] &= 0xdf; /* uppercase hex */
  ------------------
  |  Branch (197:17): [True: 3.98k, False: 12.2k]
  ------------------
  198|  16.2k|            i+=2;
  199|  16.2k|        }
  200|    784|        else if (s[i] == '#') { /* ignore fragment */
  ------------------
  |  Branch (200:18): [True: 3, False: 781]
  ------------------
  201|      3|            buffer_truncate(b, (size_t)i);
  202|      3|            break;
  203|      3|        }
  204|    781|        else {
  205|    781|            qs = burl_normalize_basic_required_fix(b, t, i, qs);
  206|    781|            break;
  207|    781|        }
  208|   466k|    }
  209|       |
  210|  1.00k|    return !invalid_utf8 ? qs : -2;
  ------------------
  |  Branch (210:12): [True: 982, False: 27]
  ------------------
  211|  1.00k|}
burl.c:burl_normalize_basic_required_fix:
  135|    781|{
  136|    781|    int j = i;
  137|    781|    const int used = (int)buffer_clen(b);
  138|    781|    const unsigned char * const s = (unsigned char *)b->ptr;
  139|    781|    unsigned char * const p =
  140|    781|      (unsigned char *)buffer_string_prepare_copy(t,i+(used-i)*3+1);
  141|    781|    unsigned int n1, n2;
  142|    781|    int invalid_utf8 = 0;
  143|    781|    memcpy(p, s, (size_t)i);
  144|  34.0M|    for (; i < used; ++i, ++j) {
  ------------------
  |  Branch (144:12): [True: 34.0M, False: 766]
  ------------------
  145|  34.0M|        if (!encoded_chars_http_uri_reqd[s[i]]) {
  ------------------
  |  Branch (145:13): [True: 1.49M, False: 32.5M]
  ------------------
  146|  1.49M|            p[j] = s[i];
  147|  1.49M|            if (__builtin_expect( (s[i] == '?'), 0) && -1 == qs) qs = j;
  ------------------
  |  Branch (147:17): [True: 12.0k, False: 1.48M]
  |  Branch (147:56): [True: 215, False: 11.8k]
  ------------------
  148|  1.49M|        }
  149|  32.5M|        else if (s[i]=='%' && li_cton(s[i+1], n1) && li_cton(s[i+2], n2)) {
  ------------------
  |  |   43|  32.6M|  (((n) = (c) - '0') <= 9 || (((n) = ((c)&0xdf) - 'A') <= 5 ? ((n) += 10) : 0))
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 50.6k, False: 13.7k]
  |  |  |  Branch (43:30): [True: 4.82k, False: 8.89k]
  |  |  |  Branch (43:31): [True: 4.82k, False: 8.89k]
  |  |  ------------------
  ------------------
                      else if (s[i]=='%' && li_cton(s[i+1], n1) && li_cton(s[i+2], n2)) {
  ------------------
  |  |   43|  55.5k|  (((n) = (c) - '0') <= 9 || (((n) = ((c)&0xdf) - 'A') <= 5 ? ((n) += 10) : 0))
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 14.1k, False: 41.3k]
  |  |  |  Branch (43:30): [True: 36.5k, False: 4.78k]
  |  |  |  Branch (43:31): [True: 36.5k, False: 4.78k]
  |  |  ------------------
  ------------------
  |  Branch (149:18): [True: 64.4k, False: 32.5M]
  ------------------
  150|  50.7k|            const unsigned int x = (n1 << 4) | n2;
  151|  50.7k|            if (!encoded_chars_http_uri_reqd[x]
  ------------------
  |  Branch (151:17): [True: 40.7k, False: 9.98k]
  ------------------
  152|  40.7k|                && (qs < 0
  ------------------
  |  Branch (152:20): [True: 24.0k, False: 16.6k]
  |  Branch (152:21): [True: 2.85k, False: 37.8k]
  ------------------
  153|  40.7k|                    ? (x != '/' && x != '?')
  ------------------
  |  Branch (153:24): [True: 1.71k, False: 1.13k]
  |  Branch (153:36): [True: 1.14k, False: 576]
  ------------------
  154|  40.7k|                    : (x != '&' && x != '=' && x != ';' && x != '+'))) {
  ------------------
  |  Branch (154:24): [True: 31.4k, False: 6.39k]
  |  Branch (154:36): [True: 28.5k, False: 2.99k]
  |  Branch (154:48): [True: 26.6k, False: 1.87k]
  |  Branch (154:60): [True: 22.9k, False: 3.68k]
  ------------------
  155|  24.0k|                p[j] = x;
  156|  24.0k|            }
  157|  26.6k|            else {
  158|  26.6k|                p[j]   = '%';
  159|  26.6k|                p[++j] = hex_chars_uc[n1]; /*(s[i+1] & 0xdf)*/
  160|  26.6k|                p[++j] = hex_chars_uc[n2]; /*(s[i+2] & 0xdf)*/
  161|  26.6k|                invalid_utf8 |= li_utf8_invalid_byte(x);
  ------------------
  |  |   49|  26.6k|#define li_utf8_invalid_byte(b) light_utf8_invalid_byte(b)
  |  |  ------------------
  |  |  |  |  260|  26.6k|  (   __builtin_expect( ((c) >= 0xF5),       0) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (260:7): [True: 517, False: 26.1k]
  |  |  |  |  ------------------
  |  |  |  |  261|  26.6k|   || __builtin_expect( (((c)|0x1) == 0xC1), 0) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (261:7): [True: 450, False: 25.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  162|  26.6k|            }
  163|  50.7k|            i+=2;
  164|  50.7k|        }
  165|  32.5M|        else if (s[i] == '#') break; /* ignore fragment */
  ------------------
  |  Branch (165:18): [True: 15, False: 32.5M]
  ------------------
  166|  32.5M|        else {
  167|  32.5M|            p[j]   = '%';
  168|  32.5M|            p[++j] = hex_chars_uc[(s[i] >> 4) & 0xF];
  169|  32.5M|            p[++j] = hex_chars_uc[s[i] & 0xF];
  170|  32.5M|            invalid_utf8 |= li_utf8_invalid_byte(s[i]);
  ------------------
  |  |   49|  32.5M|#define li_utf8_invalid_byte(b) light_utf8_invalid_byte(b)
  |  |  ------------------
  |  |  |  |  260|  32.5M|  (   __builtin_expect( ((c) >= 0xF5),       0) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (260:7): [True: 1.33M, False: 31.1M]
  |  |  |  |  ------------------
  |  |  |  |  261|  32.5M|   || __builtin_expect( (((c)|0x1) == 0xC1), 0) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (261:7): [True: 376, False: 31.1M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  171|  32.5M|        }
  172|  34.0M|    }
  173|    781|    buffer_copy_string_len(b, (char *)p, (size_t)j);
  174|    781|    return !invalid_utf8 ? qs : -2;
  ------------------
  |  Branch (174:12): [True: 495, False: 286]
  ------------------
  175|    781|}
burl.c:burl_normalize_basic_unreserved:
  101|    698|{
  102|    698|    const unsigned char * const s = (unsigned char *)b->ptr;
  103|    698|    const int used = (int)buffer_clen(b);
  104|    698|    unsigned int n1, n2, x;
  105|    698|    int qs = -1;
  106|    698|    int invalid_utf8 = 0;
  107|       |
  108|   807k|    for (int i = 0; i < used; ++i) {
  ------------------
  |  Branch (108:21): [True: 806k, False: 164]
  ------------------
  109|   806k|        if (!encoded_chars_http_uri_reqd[s[i]]) {
  ------------------
  |  Branch (109:13): [True: 803k, False: 3.10k]
  ------------------
  110|   803k|            if (__builtin_expect( (s[i] == '?'), 0) && -1 == qs) qs = i;
  ------------------
  |  Branch (110:17): [True: 572, False: 803k]
  |  Branch (110:56): [True: 80, False: 492]
  ------------------
  111|   803k|        }
  112|  3.10k|        else if (s[i]=='%' && li_cton(s[i+1], n1) && li_cton(s[i+2], n2)
  ------------------
  |  |   43|  5.84k|  (((n) = (c) - '0') <= 9 || (((n) = ((c)&0xdf) - 'A') <= 5 ? ((n) += 10) : 0))
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 1.30k, False: 1.43k]
  |  |  |  Branch (43:30): [True: 1.37k, False: 62]
  |  |  |  Branch (43:31): [True: 1.37k, False: 62]
  |  |  ------------------
  ------------------
                      else if (s[i]=='%' && li_cton(s[i+1], n1) && li_cton(s[i+2], n2)
  ------------------
  |  |   43|  5.78k|  (((n) = (c) - '0') <= 9 || (((n) = ((c)&0xdf) - 'A') <= 5 ? ((n) += 10) : 0))
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 1.20k, False: 1.47k]
  |  |  |  Branch (43:30): [True: 1.42k, False: 58]
  |  |  |  Branch (43:31): [True: 1.42k, False: 58]
  |  |  ------------------
  ------------------
  |  Branch (112:18): [True: 2.74k, False: 361]
  ------------------
  113|  2.62k|                 && !burl_is_unreserved((x = (n1 << 4) | n2))) {
  ------------------
  |  Branch (113:21): [True: 2.56k, False: 53]
  ------------------
  114|  2.56k|            invalid_utf8 |= li_utf8_invalid_byte(x);
  ------------------
  |  |   49|  2.56k|#define li_utf8_invalid_byte(b) light_utf8_invalid_byte(b)
  |  |  ------------------
  |  |  |  |  260|  2.56k|  (   __builtin_expect( ((c) >= 0xF5),       0) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (260:7): [True: 720, False: 1.84k]
  |  |  |  |  ------------------
  |  |  |  |  261|  2.56k|   || __builtin_expect( (((c)|0x1) == 0xC1), 0) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (261:7): [True: 253, False: 1.59k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  115|  2.56k|            if (s[i+1] >= 'a') b->ptr[i+1] &= 0xdf; /* uppercase hex */
  ------------------
  |  Branch (115:17): [True: 1.11k, False: 1.45k]
  ------------------
  116|  2.56k|            if (s[i+2] >= 'a') b->ptr[i+2] &= 0xdf; /* uppercase hex */
  ------------------
  |  Branch (116:17): [True: 897, False: 1.67k]
  ------------------
  117|  2.56k|            i+=2;
  118|  2.56k|        }
  119|    534|        else if (s[i] == '#') { /* ignore fragment */
  ------------------
  |  Branch (119:18): [True: 2, False: 532]
  ------------------
  120|      2|            buffer_truncate(b, (size_t)i);
  121|      2|            break;
  122|      2|        }
  123|    532|        else {
  124|    532|            qs = burl_normalize_basic_unreserved_fix(b, t, i, qs);
  125|    532|            break;
  126|    532|        }
  127|   806k|    }
  128|       |
  129|    698|    return !invalid_utf8 ? qs : -2;
  ------------------
  |  Branch (129:12): [True: 663, False: 35]
  ------------------
  130|    698|}
burl.c:burl_is_unreserved:
   53|  12.1k|{
   54|  12.1k|    return (light_isalnum(c) || c == '-' || c == '.' || c == '_' || c == '~');
  ------------------
  |  Branch (54:13): [True: 531, False: 11.6k]
  |  Branch (54:33): [True: 212, False: 11.4k]
  |  Branch (54:45): [True: 364, False: 11.0k]
  |  Branch (54:57): [True: 214, False: 10.8k]
  |  Branch (54:69): [True: 87, False: 10.7k]
  ------------------
   55|  12.1k|}
burl.c:burl_normalize_basic_unreserved_fix:
   60|    532|{
   61|    532|    int j = i;
   62|    532|    const int used = (int)buffer_clen(b);
   63|    532|    const unsigned char * const s = (unsigned char *)b->ptr;
   64|    532|    unsigned char * const p =
   65|    532|      (unsigned char *)buffer_string_prepare_copy(t,i+(used-i)*3+1);
   66|    532|    unsigned int n1, n2;
   67|    532|    int invalid_utf8 = 0;
   68|    532|    memcpy(p, s, (size_t)i);
   69|  23.1M|    for (; i < used; ++i, ++j) {
  ------------------
  |  Branch (69:12): [True: 23.1M, False: 526]
  ------------------
   70|  23.1M|        if (!encoded_chars_http_uri_reqd[s[i]]) {
  ------------------
  |  Branch (70:13): [True: 1.33M, False: 21.8M]
  ------------------
   71|  1.33M|            p[j] = s[i];
   72|  1.33M|            if (__builtin_expect( (s[i] == '?'), 0) && -1 == qs) qs = j;
  ------------------
  |  Branch (72:17): [True: 1.42k, False: 1.33M]
  |  Branch (72:56): [True: 126, False: 1.30k]
  ------------------
   73|  1.33M|        }
   74|  21.8M|        else if (s[i]=='%' && li_cton(s[i+1], n1) && li_cton(s[i+2], n2)) {
  ------------------
  |  |   43|  21.8M|  (((n) = (c) - '0') <= 9 || (((n) = ((c)&0xdf) - 'A') <= 5 ? ((n) += 10) : 0))
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 5.24k, False: 8.22k]
  |  |  |  Branch (43:30): [True: 5.37k, False: 2.85k]
  |  |  |  Branch (43:31): [True: 5.37k, False: 2.85k]
  |  |  ------------------
  ------------------
                      else if (s[i]=='%' && li_cton(s[i+1], n1) && li_cton(s[i+2], n2)) {
  ------------------
  |  |   43|  10.6k|  (((n) = (c) - '0') <= 9 || (((n) = ((c)&0xdf) - 'A') <= 5 ? ((n) += 10) : 0))
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 3.71k, False: 6.89k]
  |  |  |  Branch (43:30): [True: 5.85k, False: 1.04k]
  |  |  |  Branch (43:31): [True: 5.85k, False: 1.04k]
  |  |  ------------------
  ------------------
  |  Branch (74:18): [True: 13.4k, False: 21.8M]
  ------------------
   75|  9.57k|            const unsigned int x = (n1 << 4) | n2;
   76|  9.57k|            if (burl_is_unreserved(x)) {
  ------------------
  |  Branch (76:17): [True: 1.35k, False: 8.21k]
  ------------------
   77|  1.35k|                p[j] = x;
   78|  1.35k|            }
   79|  8.21k|            else {
   80|  8.21k|                p[j]   = '%';
   81|  8.21k|                p[++j] = hex_chars_uc[n1]; /*(s[i+1] & 0xdf)*/
   82|  8.21k|                p[++j] = hex_chars_uc[n2]; /*(s[i+2] & 0xdf)*/
   83|  8.21k|                invalid_utf8 |= li_utf8_invalid_byte(x);
  ------------------
  |  |   49|  8.21k|#define li_utf8_invalid_byte(b) light_utf8_invalid_byte(b)
  |  |  ------------------
  |  |  |  |  260|  8.21k|  (   __builtin_expect( ((c) >= 0xF5),       0) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (260:7): [True: 3.98k, False: 4.23k]
  |  |  |  |  ------------------
  |  |  |  |  261|  8.21k|   || __builtin_expect( (((c)|0x1) == 0xC1), 0) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (261:7): [True: 141, False: 4.09k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   84|  8.21k|            }
   85|  9.57k|            i+=2;
   86|  9.57k|        }
   87|  21.8M|        else if (s[i] == '#') break; /* ignore fragment */
  ------------------
  |  Branch (87:18): [True: 6, False: 21.8M]
  ------------------
   88|  21.8M|        else {
   89|  21.8M|            p[j]   = '%';
   90|  21.8M|            p[++j] = hex_chars_uc[(s[i] >> 4) & 0xF];
   91|  21.8M|            p[++j] = hex_chars_uc[s[i] & 0xF];
   92|  21.8M|            invalid_utf8 |= li_utf8_invalid_byte(s[i]);
  ------------------
  |  |   49|  21.8M|#define li_utf8_invalid_byte(b) light_utf8_invalid_byte(b)
  |  |  ------------------
  |  |  |  |  260|  21.8M|  (   __builtin_expect( ((c) >= 0xF5),       0) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (260:7): [True: 47.5k, False: 21.7M]
  |  |  |  |  ------------------
  |  |  |  |  261|  21.8M|   || __builtin_expect( (((c)|0x1) == 0xC1), 0) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (261:7): [True: 129, False: 21.7M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   93|  21.8M|        }
   94|  23.1M|    }
   95|    532|    buffer_copy_string_len(b, (char *)p, (size_t)j);
   96|    532|    return !invalid_utf8 ? qs : -2;
  ------------------
  |  Branch (96:12): [True: 364, False: 168]
  ------------------
   97|    532|}
burl.c:burl_scan_qmark:
  337|    410|static int burl_scan_qmark (const buffer * const b) {
  338|    410|    const char * const qmark = strchr(b->ptr, '?');
  339|    410|    return qmark ? (int)(qmark - b->ptr) : -1;
  ------------------
  |  Branch (339:12): [True: 229, False: 181]
  ------------------
  340|    410|}
burl.c:burl_contains_ctrls:
  215|    381|{
  216|    381|    const char * const s = b->ptr;
  217|    381|    const int used = (int)buffer_clen(b);
  218|  7.84M|    for (int i = 0; i < used; ++i) {
  ------------------
  |  Branch (218:21): [True: 7.83M, False: 280]
  ------------------
  219|  7.83M|        if (s[i] == '%' && (s[i+1] < '2' || (s[i+1] == '7' && s[i+2] == 'F')))
  ------------------
  |  Branch (219:13): [True: 2.27M, False: 5.56M]
  |  Branch (219:29): [True: 94, False: 2.27M]
  |  Branch (219:46): [True: 842, False: 2.27M]
  |  Branch (219:63): [True: 7, False: 835]
  ------------------
  220|    101|            return 1;
  221|  7.83M|    }
  222|    280|    return 0;
  223|    381|}
burl.c:burl_normalize_2F_to_slash:
  282|  1.24k|{
  283|       |    /*("%2F" must already have been uppercased during normalization)*/
  284|  1.24k|    const char * const s = b->ptr;
  285|  1.24k|    const int used = qs < 0 ? (int)buffer_clen(b) : qs;
  ------------------
  |  Branch (285:22): [True: 735, False: 510]
  ------------------
  286|  82.9M|    for (int i = 0; i < used; ++i) {
  ------------------
  |  Branch (286:21): [True: 82.9M, False: 1.08k]
  ------------------
  287|  82.9M|        if (s[i] == '%' && s[i+1] == '2' && s[i+2] == 'F') {
  ------------------
  |  Branch (287:13): [True: 27.5M, False: 55.3M]
  |  Branch (287:28): [True: 5.05k, False: 27.5M]
  |  Branch (287:45): [True: 162, False: 4.89k]
  ------------------
  288|    162|            return !(flags & HTTP_PARSEOPT_URL_NORMALIZE_PATH_2F_REJECT)
  ------------------
  |  Branch (288:20): [True: 154, False: 8]
  ------------------
  289|    162|              ? burl_normalize_2F_to_slash_fix(b, qs, i)     /* _DECODE */
  290|    162|              : -2; /*(flags & HTTP_PARSEOPT_URL_NORMALIZE_PATH_2F_REJECT)*/
  291|    162|        }
  292|  82.9M|    }
  293|  1.08k|    return qs;
  294|  1.24k|}
burl.c:burl_normalize_2F_to_slash_fix:
  258|    154|{
  259|    154|    char * const s = b->ptr;
  260|    154|    const int blen = (int)buffer_clen(b);
  261|    154|    const int used = qs < 0 ? blen : qs;
  ------------------
  |  Branch (261:22): [True: 96, False: 58]
  ------------------
  262|    154|    int j = i;
  263|  9.40M|    for (; i < used; ++i, ++j) {
  ------------------
  |  Branch (263:12): [True: 9.40M, False: 154]
  ------------------
  264|  9.40M|        s[j] = s[i];
  265|  9.40M|        if (s[i] == '%' && s[i+1] == '2' && s[i+2] == 'F') {
  ------------------
  |  Branch (265:13): [True: 3.13M, False: 6.27M]
  |  Branch (265:28): [True: 7.67k, False: 3.12M]
  |  Branch (265:45): [True: 1.30k, False: 6.36k]
  ------------------
  266|  1.30k|            s[j] = '/';
  267|  1.30k|            i+=2;
  268|  1.30k|        }
  269|  9.40M|    }
  270|    154|    if (qs >= 0) {
  ------------------
  |  Branch (270:9): [True: 58, False: 96]
  ------------------
  271|     58|        const int qslen = blen - qs;
  272|     58|        memmove(s+j, s+qs, (size_t)qslen);
  273|     58|        qs = j;
  274|     58|        j += qslen;
  275|     58|    }
  276|    154|    buffer_truncate(b, j);
  277|    154|    return qs;
  278|    154|}
burl.c:burl_normalize_path:
  298|  1.21k|{
  299|  1.21k|    const unsigned char * const s = (unsigned char *)b->ptr;
  300|  1.21k|    const int used = (int)buffer_clen(b);
  301|  1.21k|    int path_simplify = 0;
  302|  4.17k|    for (int i = 0, len = qs < 0 ? used : qs; i < len; ++i) {
  ------------------
  |  Branch (302:27): [True: 737, False: 474]
  |  Branch (302:47): [True: 3.37k, False: 793]
  ------------------
  303|  3.37k|        if (s[i] == '.' && (s[i+1] != '.' || ++i)
  ------------------
  |  Branch (303:13): [True: 1.29k, False: 2.08k]
  |  Branch (303:29): [True: 740, False: 552]
  |  Branch (303:46): [True: 552, False: 0]
  ------------------
  304|  1.29k|            && (s[i+1] == '/' || s[i+1] == '?' || s[i+1] == '\0')) {
  ------------------
  |  Branch (304:17): [True: 122, False: 1.17k]
  |  Branch (304:34): [True: 49, False: 1.12k]
  |  Branch (304:51): [True: 86, False: 1.03k]
  ------------------
  305|    257|            path_simplify = 1;
  306|    257|            break;
  307|    257|        }
  308|  67.2M|        while (i < len && s[i] != '/') ++i;
  ------------------
  |  Branch (308:16): [True: 67.2M, False: 642]
  |  Branch (308:27): [True: 67.2M, False: 2.48k]
  ------------------
  309|  3.12k|        if (s[i] == '/' && s[i+1] == '/') { /*(s[len] != '/')*/
  ------------------
  |  Branch (309:13): [True: 2.48k, False: 642]
  |  Branch (309:28): [True: 161, False: 2.31k]
  ------------------
  310|    161|            path_simplify = 1;
  311|    161|            break;
  312|    161|        }
  313|  3.12k|    }
  314|       |
  315|  1.21k|    if (path_simplify) {
  ------------------
  |  Branch (315:9): [True: 418, False: 793]
  ------------------
  316|    418|        if (flags & HTTP_PARSEOPT_URL_NORMALIZE_PATH_DOTSEG_REJECT) return -2;
  ------------------
  |  Branch (316:13): [True: 14, False: 404]
  ------------------
  317|    404|        if (qs >= 0) {
  ------------------
  |  Branch (317:13): [True: 145, False: 259]
  ------------------
  318|    145|            buffer_copy_string_len(t, b->ptr+qs, used - qs);
  319|    145|            buffer_truncate(b, qs);
  320|    145|        }
  321|       |
  322|    404|        buffer_path_simplify(b);
  323|       |
  324|    404|        if (qs >= 0) {
  ------------------
  |  Branch (324:13): [True: 145, False: 259]
  ------------------
  325|    145|            qs = (int)buffer_clen(b);
  326|    145|            buffer_append_string_len(b, BUF_PTR_LEN(t));
  ------------------
  |  |  297|    145|#define BUF_PTR_LEN(x)       (x)->ptr, buffer_clen(x)
  ------------------
  327|    145|        }
  328|    404|    }
  329|       |
  330|  1.19k|    return qs;
  331|  1.21k|}
burl.c:burl_normalize_qs20_to_plus:
  244|    455|{
  245|    455|    const char * const s = b->ptr;
  246|    455|    const int used = qs < 0 ? 0 : (int)buffer_clen(b);
  ------------------
  |  Branch (246:22): [True: 0, False: 455]
  ------------------
  247|    455|    int i;
  248|    455|    if (qs < 0) return;
  ------------------
  |  Branch (248:9): [True: 0, False: 455]
  ------------------
  249|  8.67M|    for (i = qs+1; i < used; ++i) {
  ------------------
  |  Branch (249:20): [True: 8.67M, False: 321]
  ------------------
  250|  8.67M|        if (s[i] == '%' && s[i+1] == '2' && s[i+2] == '0') break;
  ------------------
  |  Branch (250:13): [True: 2.84M, False: 5.82M]
  |  Branch (250:28): [True: 16.3k, False: 2.82M]
  |  Branch (250:45): [True: 134, False: 16.1k]
  ------------------
  251|  8.67M|    }
  252|    455|    if (i != used) burl_normalize_qs20_to_plus_fix(b, i);
  ------------------
  |  Branch (252:9): [True: 134, False: 321]
  ------------------
  253|    455|}
burl.c:burl_normalize_qs20_to_plus_fix:
  228|    134|{
  229|    134|    char * const s = b->ptr;
  230|    134|    const int used = (int)buffer_clen(b);
  231|    134|    int j = i;
  232|  7.38M|    for (; i < used; ++i, ++j) {
  ------------------
  |  Branch (232:12): [True: 7.38M, False: 134]
  ------------------
  233|  7.38M|        s[j] = s[i];
  234|  7.38M|        if (s[i] == '%' && s[i+1] == '2' && s[i+2] == '0') {
  ------------------
  |  Branch (234:13): [True: 2.44M, False: 4.93M]
  |  Branch (234:28): [True: 7.44k, False: 2.44M]
  |  Branch (234:45): [True: 1.76k, False: 5.67k]
  ------------------
  235|  1.76k|            s[j] = '+';
  236|  1.76k|            i+=2;
  237|  1.76k|        }
  238|  7.38M|    }
  239|    134|    buffer_truncate(b, j);
  240|    134|}

