LLVMFuzzerTestOneInput:
   31|  2.45k|{
   32|  2.45k|  char *domain;
   33|  2.45k|  char *out;
   34|       |
   35|  2.45k|  if (size > 1024)
  ------------------
  |  Branch (35:7): [True: 12, False: 2.43k]
  ------------------
   36|     12|    return 0;
   37|       |
   38|  2.43k|  domain = (char *) malloc (size + 1);
   39|  2.43k|  assert (domain != NULL);
   40|       |
   41|       |  /* 0 terminate */
   42|      0|  memcpy (domain, data, size);
   43|  2.43k|  domain[size] = 0;
   44|       |
   45|  2.43k|  if ((size & 3) == 0)
  ------------------
  |  Branch (45:7): [True: 1.15k, False: 1.28k]
  ------------------
   46|  1.15k|    {
   47|  1.15k|      uint32_t *u32 = (uint32_t *) malloc (size);
   48|  1.15k|      size_t u32len;
   49|       |
   50|  1.15k|      assert (u32 != NULL);
   51|       |
   52|      0|      u32len = size / 4;
   53|  1.15k|      idna_to_unicode_44i ((uint32_t *) data, size / 4, u32, &u32len, 0);
   54|  1.15k|      u32len = size / 4;
   55|  1.15k|      idna_to_unicode_44i ((uint32_t *) data, size / 4, u32, &u32len,
   56|  1.15k|			   IDNA_ALLOW_UNASSIGNED | IDNA_USE_STD3_ASCII_RULES);
   57|       |
   58|  1.15k|      free (u32);
   59|       |
   60|  1.15k|      uint32_t *data0 = (uint32_t *) malloc (size + 4), *out0;
   61|  1.15k|      assert (data0 != NULL);
   62|      0|      memcpy (data0, data, size);
   63|  1.15k|      data0[size / 4] = 0;
   64|       |
   65|  1.15k|      if (idna_to_unicode_4z4z (data0, &out0, 0) == IDNA_SUCCESS)
  ------------------
  |  Branch (65:11): [True: 1.15k, False: 0]
  ------------------
   66|  1.15k|	idn_free (out0);
   67|  1.15k|      if (idna_to_unicode_4z4z
  ------------------
  |  Branch (67:11): [True: 1.15k, False: 0]
  ------------------
   68|  1.15k|	  (data0, &out0,
   69|  1.15k|	   IDNA_ALLOW_UNASSIGNED | IDNA_USE_STD3_ASCII_RULES) == IDNA_SUCCESS)
   70|  1.15k|	idn_free (out0);
   71|       |
   72|  1.15k|      free (data0);
   73|       |
   74|  1.15k|      if (idna_to_unicode_8z4z (domain, &out0, 0) == IDNA_SUCCESS)
  ------------------
  |  Branch (74:11): [True: 881, False: 273]
  ------------------
   75|    881|	idn_free (out0);
   76|  1.15k|      if (idna_to_unicode_8z4z
  ------------------
  |  Branch (76:11): [True: 881, False: 273]
  ------------------
   77|  1.15k|	  (domain, &out0,
   78|  1.15k|	   IDNA_ALLOW_UNASSIGNED | IDNA_USE_STD3_ASCII_RULES) == IDNA_SUCCESS)
   79|    881|	idn_free (out0);
   80|  1.15k|    }
   81|       |
   82|  2.43k|  if (idna_to_unicode_8z8z (domain, &out, 0) == IDNA_SUCCESS)
  ------------------
  |  Branch (82:7): [True: 2.11k, False: 326]
  ------------------
   83|  2.11k|    idn_free (out);
   84|  2.43k|  if (idna_to_unicode_8z8z
  ------------------
  |  Branch (84:7): [True: 2.11k, False: 326]
  ------------------
   85|  2.43k|      (domain, &out,
   86|  2.43k|       IDNA_ALLOW_UNASSIGNED | IDNA_USE_STD3_ASCII_RULES) == IDNA_SUCCESS)
   87|  2.11k|    idn_free (out);
   88|  2.43k|  if (idna_to_unicode_8zlz (domain, &out, 0) == IDNA_SUCCESS)
  ------------------
  |  Branch (88:7): [True: 917, False: 1.52k]
  ------------------
   89|    917|    idn_free (out);
   90|  2.43k|  if (idna_to_unicode_8zlz
  ------------------
  |  Branch (90:7): [True: 889, False: 1.54k]
  ------------------
   91|  2.43k|      (domain, &out,
   92|  2.43k|       IDNA_ALLOW_UNASSIGNED | IDNA_USE_STD3_ASCII_RULES) == IDNA_SUCCESS)
   93|    889|    idn_free (out);
   94|  2.43k|  if (idna_to_unicode_lzlz (domain, &out, 0) == IDNA_SUCCESS)
  ------------------
  |  Branch (94:7): [True: 893, False: 1.54k]
  ------------------
   95|    893|    idn_free (out);
   96|  2.43k|  if (idna_to_unicode_lzlz
  ------------------
  |  Branch (96:7): [True: 865, False: 1.57k]
  ------------------
   97|  2.43k|      (domain, &out,
   98|  2.43k|       IDNA_ALLOW_UNASSIGNED | IDNA_USE_STD3_ASCII_RULES) == IDNA_SUCCESS)
   99|    865|    idn_free (out);
  100|       |
  101|  2.43k|  free (domain);
  102|       |
  103|  2.43k|  return 0;
  104|  2.45k|}

c_tolower:
  338|   191k|{
  339|   191k|  switch (c)
  340|   191k|    {
  341|  41.5k|    _C_CTYPE_UPPER:
  ------------------
  |  |  148|      0|#define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a')
  |  |  ------------------
  |  |  |  |  122|  13.1k|   _C_CTYPE_LOWER_A_THRU_F_N(N): \
  |  |  |  |  ------------------
  |  |  |  |  |  |  119|  13.1k|   case 'a' + (N): case 'b' + (N): case 'c' + (N): case 'd' + (N): \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (119:4): [True: 11.8k, False: 179k]
  |  |  |  |  |  |  |  Branch (119:20): [True: 1.01k, False: 190k]
  |  |  |  |  |  |  |  Branch (119:36): [True: 49, False: 191k]
  |  |  |  |  |  |  |  Branch (119:52): [True: 222, False: 191k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  120|  13.1k|   case 'e' + (N): case 'f' + (N)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (120:4): [True: 24, False: 191k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (122:4): [True: 56, False: 191k]
  |  |  |  |  ------------------
  |  |  |  |  123|  13.3k|   case 'g' + (N): case 'h' + (N): case 'i' + (N): case 'j' + (N): \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (123:4): [True: 24, False: 191k]
  |  |  |  |  |  Branch (123:20): [True: 16, False: 191k]
  |  |  |  |  |  Branch (123:36): [True: 116, False: 191k]
  |  |  |  |  |  Branch (123:52): [True: 34, False: 191k]
  |  |  |  |  ------------------
  |  |  |  |  124|  19.8k|   case 'k' + (N): case 'l' + (N): case 'm' + (N): case 'n' + (N): \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (124:4): [True: 242, False: 191k]
  |  |  |  |  |  Branch (124:20): [True: 22, False: 191k]
  |  |  |  |  |  Branch (124:36): [True: 14, False: 191k]
  |  |  |  |  |  Branch (124:52): [True: 6.15k, False: 185k]
  |  |  |  |  ------------------
  |  |  |  |  125|  21.0k|   case 'o' + (N): case 'p' + (N): case 'q' + (N): case 'r' + (N): \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:4): [True: 49, False: 191k]
  |  |  |  |  |  Branch (125:20): [True: 217, False: 191k]
  |  |  |  |  |  Branch (125:36): [True: 974, False: 190k]
  |  |  |  |  |  Branch (125:52): [True: 6, False: 191k]
  |  |  |  |  ------------------
  |  |  |  |  126|  32.2k|   case 's' + (N): case 't' + (N): case 'u' + (N): case 'v' + (N): \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (126:4): [True: 26, False: 191k]
  |  |  |  |  |  Branch (126:20): [True: 23, False: 191k]
  |  |  |  |  |  Branch (126:36): [True: 11.1k, False: 180k]
  |  |  |  |  |  Branch (126:52): [True: 10, False: 191k]
  |  |  |  |  ------------------
  |  |  |  |  127|  41.5k|   case 'w' + (N): case 'x' + (N): case 'y' + (N): case 'z' + (N)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (127:4): [True: 201, False: 191k]
  |  |  |  |  |  Branch (127:20): [True: 8.32k, False: 183k]
  |  |  |  |  |  Branch (127:36): [True: 398, False: 191k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  342|  41.5k|      return c - 'A' + 'a';
  343|   150k|    default:
  ------------------
  |  Branch (343:5): [True: 150k, False: 41.5k]
  ------------------
  344|   150k|      return c;
  345|   191k|    }
  346|   191k|}

c_strcasecmp:
   28|  15.6k|{
   29|  15.6k|  register const unsigned char *p1 = (const unsigned char *) s1;
   30|  15.6k|  register const unsigned char *p2 = (const unsigned char *) s2;
   31|  15.6k|  unsigned char c1, c2;
   32|       |
   33|  15.6k|  if (p1 == p2)
  ------------------
  |  Branch (33:7): [True: 0, False: 15.6k]
  ------------------
   34|      0|    return 0;
   35|       |
   36|  15.6k|  do
   37|  25.1k|    {
   38|  25.1k|      c1 = c_tolower (*p1);
   39|  25.1k|      c2 = c_tolower (*p2);
   40|       |
   41|  25.1k|      if (c1 == '\0')
  ------------------
  |  Branch (41:11): [True: 668, False: 24.5k]
  ------------------
   42|    668|        break;
   43|       |
   44|  24.5k|      ++p1;
   45|  24.5k|      ++p2;
   46|  24.5k|    }
   47|  24.5k|  while (c1 == c2);
  ------------------
  |  Branch (47:10): [True: 9.52k, False: 14.9k]
  ------------------
   48|       |
   49|  15.6k|  if (UCHAR_MAX <= INT_MAX)
  ------------------
  |  Branch (49:7): [Folded - Ignored]
  ------------------
   50|  15.6k|    return c1 - c2;
   51|      0|  else
   52|       |    /* On machines where 'char' and 'int' are types of the same size, the
   53|       |       difference of two 'unsigned char' values - including the sign bit -
   54|       |       doesn't fit in an 'int'.  */
   55|      0|    return _GL_CMP (c1, c2);
  ------------------
  |  | 1433|      0|#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
  ------------------
   56|  15.6k|}

c_strncasecmp:
   28|  24.9k|{
   29|  24.9k|  register const unsigned char *p1 = (const unsigned char *) s1;
   30|  24.9k|  register const unsigned char *p2 = (const unsigned char *) s2;
   31|  24.9k|  unsigned char c1, c2;
   32|       |
   33|  24.9k|  if (p1 == p2 || n == 0)
  ------------------
  |  Branch (33:7): [True: 0, False: 24.9k]
  |  Branch (33:19): [True: 0, False: 24.9k]
  ------------------
   34|      0|    return 0;
   35|       |
   36|  24.9k|  do
   37|  70.7k|    {
   38|  70.7k|      c1 = c_tolower (*p1);
   39|  70.7k|      c2 = c_tolower (*p2);
   40|       |
   41|  70.7k|      if (--n == 0 || c1 == '\0')
  ------------------
  |  Branch (41:11): [True: 15.0k, False: 55.7k]
  |  Branch (41:23): [True: 3.94k, False: 51.7k]
  ------------------
   42|  18.9k|        break;
   43|       |
   44|  51.7k|      ++p1;
   45|  51.7k|      ++p2;
   46|  51.7k|    }
   47|  51.7k|  while (c1 == c2);
  ------------------
  |  Branch (47:10): [True: 45.7k, False: 6.02k]
  ------------------
   48|       |
   49|  24.9k|  if (UCHAR_MAX <= INT_MAX)
  ------------------
  |  Branch (49:7): [Folded - Ignored]
  ------------------
   50|  24.9k|    return c1 - c2;
   51|      0|  else
   52|       |    /* On machines where 'char' and 'int' are types of the same size, the
   53|       |       difference of two 'unsigned char' values - including the sign bit -
   54|       |       doesn't fit in an 'int'.  */
   55|      0|    return _GL_CMP (c1, c2);
  ------------------
  |  | 1433|      0|#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
  ------------------
   56|  24.9k|}

rpl_free:
   33|   500k|{
   34|       |# if defined __GNUC__ && !defined __clang__
   35|       |  /* An invalid GCC optimization
   36|       |     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98396>
   37|       |     would optimize away the assignments in the code below, when link-time
   38|       |     optimization (LTO) is enabled.  Make the code more complicated, so that
   39|       |     GCC does not grok how to optimize it.  */
   40|       |  int err[2];
   41|       |  err[0] = errno;
   42|       |  err[1] = errno;
   43|       |  errno = 0;
   44|       |  free (p);
   45|       |  errno = err[errno == 0];
   46|       |# else
   47|   500k|  int err = errno;
   48|   500k|  free (p);
   49|   500k|  errno = err;
   50|   500k|# endif
   51|   500k|}

str_cd_iconv:
  204|  10.7k|{
  205|       |  /* For most encodings, a trailing NUL byte in the input will be converted
  206|       |     to a trailing NUL byte in the output.  But not for UTF-7.  So that this
  207|       |     function is usable for UTF-7, we have to exclude the NUL byte from the
  208|       |     conversion and add it by hand afterwards.  */
  209|       |# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
  210|       |  /* Irix iconv() inserts a NUL byte if it cannot convert.
  211|       |     NetBSD iconv() inserts a question mark if it cannot convert.
  212|       |     Only GNU libiconv and GNU libc are known to prefer to fail rather
  213|       |     than doing a lossy conversion.  For other iconv() implementations,
  214|       |     we have to look at the number of irreversible conversions returned;
  215|       |     but this information is lost when iconv() returns for an E2BIG reason.
  216|       |     Therefore we cannot use the second, faster algorithm.  */
  217|       |
  218|       |  char *result = NULL;
  219|       |  size_t length = 0;
  220|       |  int retval = mem_cd_iconv (src, strlen (src), cd, &result, &length);
  221|       |  char *final_result;
  222|       |
  223|       |  if (retval < 0)
  224|       |    {
  225|       |      if (result != NULL)
  226|       |        abort ();
  227|       |      return NULL;
  228|       |    }
  229|       |
  230|       |  /* Add the terminating NUL byte.  */
  231|       |  final_result =
  232|       |    (result != NULL ? realloc (result, length + 1) : malloc (length + 1));
  233|       |  if (final_result == NULL)
  234|       |    {
  235|       |      free (result);
  236|       |      errno = ENOMEM;
  237|       |      return NULL;
  238|       |    }
  239|       |  final_result[length] = '\0';
  240|       |
  241|       |  return final_result;
  242|       |
  243|       |# else
  244|       |  /* This algorithm is likely faster than the one above.  But it may produce
  245|       |     iconv() returns for an E2BIG reason, when the output size guess is too
  246|       |     small.  Therefore it can only be used when we don't need the number of
  247|       |     irreversible conversions performed.  */
  248|  10.7k|  char *result;
  249|  10.7k|  size_t result_size;
  250|  10.7k|  size_t length;
  251|  10.7k|  const char *inptr = src;
  252|  10.7k|  size_t inbytes_remaining = strlen (src);
  253|       |
  254|       |  /* Make a guess for the worst-case output size, in order to avoid a
  255|       |     realloc.  It's OK if the guess is wrong as long as it is not zero and
  256|       |     doesn't lead to an integer overflow.  */
  257|  10.7k|  result_size = inbytes_remaining;
  258|  10.7k|  {
  259|  10.7k|    size_t approx_sqrt_SIZE_MAX = SIZE_MAX >> (sizeof (size_t) * CHAR_BIT / 2);
  ------------------
  |  |   36|  10.7k|# define SIZE_MAX ((size_t) -1)
  ------------------
  260|  10.7k|    if (result_size <= approx_sqrt_SIZE_MAX / MB_LEN_MAX)
  ------------------
  |  Branch (260:9): [True: 10.7k, False: 0]
  ------------------
  261|  10.7k|      result_size *= MB_LEN_MAX;
  262|  10.7k|  }
  263|  10.7k|  result_size += 1; /* for the terminating NUL */
  264|       |
  265|  10.7k|  result = (char *) malloc (result_size);
  266|  10.7k|  if (result == NULL)
  ------------------
  |  Branch (266:7): [True: 0, False: 10.7k]
  ------------------
  267|      0|    {
  268|      0|      errno = ENOMEM;
  269|      0|      return NULL;
  270|      0|    }
  271|       |
  272|       |  /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
  273|  10.7k|# if defined _LIBICONV_VERSION \
  274|  10.7k|     || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
  275|  10.7k|          || defined __sun)
  276|       |  /* Set to the initial state.  */
  277|  10.7k|  iconv (cd, NULL, NULL, NULL, NULL);
  278|  10.7k|# endif
  279|       |
  280|       |  /* Do the conversion.  */
  281|  10.7k|  {
  282|  10.7k|    char *outptr = result;
  283|  10.7k|    size_t outbytes_remaining = result_size - 1;
  284|       |
  285|  10.7k|    for (;;)
  286|  10.7k|      {
  287|       |        /* Here inptr + inbytes_remaining = src + strlen (src),
  288|       |                outptr + outbytes_remaining = result + result_size - 1.  */
  289|  10.7k|        size_t res = iconv (cd,
  290|  10.7k|                            (ICONV_CONST char **) &inptr, &inbytes_remaining,
  291|  10.7k|                            &outptr, &outbytes_remaining);
  292|       |
  293|  10.7k|        if (res == (size_t)(-1))
  ------------------
  |  Branch (293:13): [True: 5.53k, False: 5.23k]
  ------------------
  294|  5.53k|          {
  295|  5.53k|            if (errno == EINVAL)
  ------------------
  |  Branch (295:17): [True: 0, False: 5.53k]
  ------------------
  296|      0|              break;
  297|  5.53k|            else if (errno == E2BIG)
  ------------------
  |  Branch (297:22): [True: 0, False: 5.53k]
  ------------------
  298|      0|              {
  299|      0|                size_t used = outptr - result;
  300|      0|                size_t newsize = result_size * 2;
  301|      0|                char *newresult;
  302|       |
  303|      0|                if (!(newsize > result_size))
  ------------------
  |  Branch (303:21): [True: 0, False: 0]
  ------------------
  304|      0|                  {
  305|      0|                    errno = ENOMEM;
  306|      0|                    goto failed;
  307|      0|                  }
  308|      0|                newresult = (char *) realloc (result, newsize);
  309|      0|                if (newresult == NULL)
  ------------------
  |  Branch (309:21): [True: 0, False: 0]
  ------------------
  310|      0|                  {
  311|      0|                    errno = ENOMEM;
  312|      0|                    goto failed;
  313|      0|                  }
  314|      0|                result = newresult;
  315|      0|                result_size = newsize;
  316|      0|                outptr = result + used;
  317|      0|                outbytes_remaining = result_size - 1 - used;
  318|      0|              }
  319|  5.53k|            else
  320|  5.53k|              goto failed;
  321|  5.53k|          }
  322|  5.23k|        else
  323|  5.23k|          break;
  324|  10.7k|      }
  325|       |    /* Avoid glibc-2.1 bug and Solaris 2.7 bug.  */
  326|  5.23k|# if defined _LIBICONV_VERSION \
  327|  5.23k|     || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
  328|  5.23k|          || defined __sun)
  329|  5.23k|    for (;;)
  330|  5.23k|      {
  331|       |        /* Here outptr + outbytes_remaining = result + result_size - 1.  */
  332|  5.23k|        size_t res = iconv (cd, NULL, NULL, &outptr, &outbytes_remaining);
  333|       |
  334|  5.23k|        if (res == (size_t)(-1))
  ------------------
  |  Branch (334:13): [True: 0, False: 5.23k]
  ------------------
  335|      0|          {
  336|      0|            if (errno == E2BIG)
  ------------------
  |  Branch (336:17): [True: 0, False: 0]
  ------------------
  337|      0|              {
  338|      0|                size_t used = outptr - result;
  339|      0|                size_t newsize = result_size * 2;
  340|      0|                char *newresult;
  341|       |
  342|      0|                if (!(newsize > result_size))
  ------------------
  |  Branch (342:21): [True: 0, False: 0]
  ------------------
  343|      0|                  {
  344|      0|                    errno = ENOMEM;
  345|      0|                    goto failed;
  346|      0|                  }
  347|      0|                newresult = (char *) realloc (result, newsize);
  348|      0|                if (newresult == NULL)
  ------------------
  |  Branch (348:21): [True: 0, False: 0]
  ------------------
  349|      0|                  {
  350|      0|                    errno = ENOMEM;
  351|      0|                    goto failed;
  352|      0|                  }
  353|      0|                result = newresult;
  354|      0|                result_size = newsize;
  355|      0|                outptr = result + used;
  356|      0|                outbytes_remaining = result_size - 1 - used;
  357|      0|              }
  358|      0|            else
  359|      0|              goto failed;
  360|      0|          }
  361|  5.23k|        else
  362|  5.23k|          break;
  363|  5.23k|      }
  364|  5.23k|# endif
  365|       |
  366|       |    /* Add the terminating NUL byte.  */
  367|  5.23k|    *outptr++ = '\0';
  368|       |
  369|  5.23k|    length = outptr - result;
  370|  5.23k|  }
  371|       |
  372|       |  /* Give away unused memory.  */
  373|  5.23k|  if (length < result_size)
  ------------------
  |  Branch (373:7): [True: 5.23k, False: 0]
  ------------------
  374|  5.23k|    {
  375|  5.23k|      char *smaller_result = (char *) realloc (result, length);
  376|       |
  377|  5.23k|      if (smaller_result != NULL)
  ------------------
  |  Branch (377:11): [True: 5.23k, False: 0]
  ------------------
  378|  5.23k|        result = smaller_result;
  379|  5.23k|    }
  380|       |
  381|  5.23k|  return result;
  382|       |
  383|  5.53k| failed:
  384|  5.53k|  free (result);
  385|  5.53k|  return NULL;
  386|       |
  387|  5.23k|# endif
  388|  5.23k|}
str_iconv:
  394|  10.9k|{
  395|  10.9k|  if (*src == '\0' || c_strcasecmp (from_codeset, to_codeset) == 0)
  ------------------
  |  Branch (395:7): [True: 192, False: 10.7k]
  |  Branch (395:23): [True: 0, False: 10.7k]
  ------------------
  396|    192|    {
  397|    192|      char *result = strdup (src);
  398|       |
  399|    192|      if (result == NULL)
  ------------------
  |  Branch (399:11): [True: 0, False: 192]
  ------------------
  400|      0|        errno = ENOMEM;
  401|    192|      return result;
  402|    192|    }
  403|  10.7k|  else
  404|  10.7k|    {
  405|  10.7k|#if HAVE_ICONV
  406|  10.7k|      iconv_t cd;
  407|  10.7k|      char *result;
  408|       |
  409|       |      /* Avoid glibc-2.1 bug with EUC-KR.  */
  410|       |# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
  411|       |     && !defined _LIBICONV_VERSION
  412|       |      if (c_strcasecmp (from_codeset, "EUC-KR") == 0
  413|       |          || c_strcasecmp (to_codeset, "EUC-KR") == 0)
  414|       |        {
  415|       |          errno = EINVAL;
  416|       |          return NULL;
  417|       |        }
  418|       |# endif
  419|  10.7k|      cd = iconv_open (to_codeset, from_codeset);
  420|  10.7k|      if (cd == (iconv_t) -1)
  ------------------
  |  Branch (420:11): [True: 0, False: 10.7k]
  ------------------
  421|      0|        return NULL;
  422|       |
  423|  10.7k|      result = str_cd_iconv (src, cd);
  424|       |
  425|  10.7k|      if (result == NULL)
  ------------------
  |  Branch (425:11): [True: 5.53k, False: 5.23k]
  ------------------
  426|  5.53k|        {
  427|       |          /* Close cd, but preserve the errno from str_cd_iconv.  */
  428|  5.53k|          int saved_errno = errno;
  429|  5.53k|          iconv_close (cd);
  430|  5.53k|          errno = saved_errno;
  431|  5.53k|        }
  432|  5.23k|      else
  433|  5.23k|        {
  434|  5.23k|          if (iconv_close (cd) < 0)
  ------------------
  |  Branch (434:15): [True: 0, False: 5.23k]
  ------------------
  435|      0|            {
  436|      0|              free (result);
  437|      0|              return NULL;
  438|      0|            }
  439|  5.23k|        }
  440|  10.7k|      return result;
  441|       |#else
  442|       |      /* This is a different error code than if iconv_open existed but didn't
  443|       |         support from_codeset and to_codeset, so that the caller can emit
  444|       |         an error message such as
  445|       |           "iconv() is not supported. Installing GNU libiconv and
  446|       |            then reinstalling this package would fix this."  */
  447|       |      errno = ENOSYS;
  448|       |      return NULL;
  449|       |#endif
  450|  10.7k|    }
  451|  10.9k|}

u8_check:
   25|   132k|{
   26|   132k|  const uint8_t *s_end = s + n;
   27|       |
   28|  6.22M|  while (s < s_end)
  ------------------
  |  Branch (28:10): [True: 6.10M, False: 127k]
  ------------------
   29|  6.10M|    {
   30|       |      /* Keep in sync with unistr.h and u8-mbtouc-aux.c.  */
   31|  6.10M|      uint8_t c = *s;
   32|       |
   33|  6.10M|      if (c < 0x80)
  ------------------
  |  Branch (33:11): [True: 936k, False: 5.16M]
  ------------------
   34|   936k|        {
   35|   936k|          s++;
   36|   936k|          continue;
   37|   936k|        }
   38|  5.16M|      if (c >= 0xc2)
  ------------------
  |  Branch (38:11): [True: 5.16M, False: 280]
  ------------------
   39|  5.16M|        {
   40|  5.16M|          if (c < 0xe0)
  ------------------
  |  Branch (40:15): [True: 1.51M, False: 3.65M]
  ------------------
   41|  1.51M|            {
   42|  1.51M|              if (s + 2 <= s_end
  ------------------
  |  Branch (42:19): [True: 1.51M, False: 60]
  ------------------
   43|  1.51M|                  && (s[1] ^ 0x80) < 0x40)
  ------------------
  |  Branch (43:22): [True: 1.51M, False: 146]
  ------------------
   44|  1.51M|                {
   45|  1.51M|                  s += 2;
   46|  1.51M|                  continue;
   47|  1.51M|                }
   48|  1.51M|            }
   49|  3.65M|          else if (c < 0xf0)
  ------------------
  |  Branch (49:20): [True: 3.62M, False: 22.8k]
  ------------------
   50|  3.62M|            {
   51|  3.62M|              if (s + 3 <= s_end
  ------------------
  |  Branch (51:19): [True: 3.62M, False: 50]
  ------------------
   52|  3.62M|                  && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
  ------------------
  |  Branch (52:22): [True: 3.62M, False: 118]
  |  Branch (52:46): [True: 3.62M, False: 32]
  ------------------
   53|  3.62M|                  && (c >= 0xe1 || s[1] >= 0xa0)
  ------------------
  |  Branch (53:23): [True: 3.59M, False: 34.8k]
  |  Branch (53:36): [True: 34.8k, False: 38]
  ------------------
   54|  3.62M|                  && (c != 0xed || s[1] < 0xa0))
  ------------------
  |  Branch (54:23): [True: 3.62M, False: 1.65k]
  |  Branch (54:36): [True: 1.45k, False: 202]
  ------------------
   55|  3.62M|                {
   56|  3.62M|                  s += 3;
   57|  3.62M|                  continue;
   58|  3.62M|                }
   59|  3.62M|            }
   60|  22.8k|          else if (c <= 0xf4)
  ------------------
  |  Branch (60:20): [True: 19.6k, False: 3.19k]
  ------------------
   61|  19.6k|            {
   62|  19.6k|              if (s + 4 <= s_end
  ------------------
  |  Branch (62:19): [True: 19.6k, False: 28]
  ------------------
   63|  19.6k|                  && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
  ------------------
  |  Branch (63:22): [True: 19.6k, False: 36]
  |  Branch (63:46): [True: 19.5k, False: 24]
  ------------------
   64|  19.6k|                  && (s[3] ^ 0x80) < 0x40
  ------------------
  |  Branch (64:22): [True: 19.5k, False: 12]
  ------------------
   65|  19.6k|                  && (c >= 0xf1 || s[1] >= 0x90)
  ------------------
  |  Branch (65:23): [True: 9.06k, False: 10.4k]
  |  Branch (65:36): [True: 10.4k, False: 30]
  ------------------
   66|  19.6k|                  && (c < 0xf4 || (/* c == 0xf4 && */ s[1] < 0x90)))
  ------------------
  |  Branch (66:23): [True: 17.4k, False: 2.11k]
  |  Branch (66:35): [True: 1.91k, False: 200]
  ------------------
   67|  19.3k|                {
   68|  19.3k|                  s += 4;
   69|  19.3k|                  continue;
   70|  19.3k|                }
   71|  19.6k|            }
   72|  5.16M|        }
   73|       |      /* invalid or incomplete multibyte character */
   74|  4.45k|      return s;
   75|  5.16M|    }
   76|   127k|  return NULL;
   77|   132k|}

idn_free:
   53|  11.8k|{
   54|  11.8k|  free (ptr);
   55|  11.8k|}

idna_to_ascii_4i:
   82|  11.1k|{
   83|  11.1k|  size_t len, outlen;
   84|  11.1k|  uint32_t *src;		/* XXX don't need to copy data? */
   85|  11.1k|  int rc;
   86|       |
   87|       |  /*
   88|       |   * ToASCII consists of the following steps:
   89|       |   *
   90|       |   * 1. If all code points in the sequence are in the ASCII range (0..7F)
   91|       |   * then skip to step 3.
   92|       |   */
   93|       |
   94|  11.1k|  {
   95|  11.1k|    size_t i;
   96|  11.1k|    int inasciirange;
   97|       |
   98|  11.1k|    inasciirange = 1;
   99|   266k|    for (i = 0; i < inlen; i++)
  ------------------
  |  Branch (99:17): [True: 255k, False: 11.1k]
  ------------------
  100|   255k|      if (in[i] > 0x7F)
  ------------------
  |  Branch (100:11): [True: 216k, False: 38.5k]
  ------------------
  101|   216k|	inasciirange = 0;
  102|  11.1k|    if (inasciirange)
  ------------------
  |  Branch (102:9): [True: 4.69k, False: 6.47k]
  ------------------
  103|  4.69k|      {
  104|  4.69k|	src = malloc (sizeof (in[0]) * (inlen + 1));
  105|  4.69k|	if (src == NULL)
  ------------------
  |  Branch (105:6): [True: 0, False: 4.69k]
  ------------------
  106|      0|	  return IDNA_MALLOC_ERROR;
  107|       |
  108|  4.69k|	memcpy (src, in, sizeof (in[0]) * inlen);
  109|  4.69k|	src[inlen] = 0;
  110|       |
  111|  4.69k|	goto step3;
  112|  4.69k|      }
  113|  11.1k|  }
  114|       |
  115|       |  /*
  116|       |   * 2. Perform the steps specified in [NAMEPREP] and fail if there is
  117|       |   * an error. The AllowUnassigned flag is used in [NAMEPREP].
  118|       |   */
  119|       |
  120|  6.47k|  {
  121|  6.47k|    char *p;
  122|       |
  123|  6.47k|    p = stringprep_ucs4_to_utf8 (in, (ssize_t) inlen, NULL, NULL);
  124|  6.47k|    if (p == NULL)
  ------------------
  |  Branch (124:9): [True: 0, False: 6.47k]
  ------------------
  125|      0|      return IDNA_MALLOC_ERROR;
  126|       |
  127|  6.47k|    len = strlen (p);
  128|  6.47k|    do
  129|  9.53k|      {
  130|  9.53k|	char *newp;
  131|       |
  132|  9.53k|	len = 2 * len + 10;	/* XXX better guess? */
  133|  9.53k|	newp = realloc (p, len);
  134|  9.53k|	if (newp == NULL)
  ------------------
  |  Branch (134:6): [True: 0, False: 9.53k]
  ------------------
  135|      0|	  {
  136|      0|	    free (p);
  137|      0|	    return IDNA_MALLOC_ERROR;
  138|      0|	  }
  139|  9.53k|	p = newp;
  140|       |
  141|  9.53k|	if (flags & IDNA_ALLOW_UNASSIGNED)
  ------------------
  |  Branch (141:6): [True: 4.91k, False: 4.61k]
  ------------------
  142|  4.91k|	  rc = stringprep_nameprep (p, len);
  ------------------
  |  |  203|  4.91k|  stringprep(in, maxlen, 0, stringprep_nameprep)
  ------------------
  143|  4.61k|	else
  144|  4.61k|	  rc = stringprep_nameprep_no_unassigned (p, len);
  ------------------
  |  |  206|  4.61k|  stringprep(in, maxlen, STRINGPREP_NO_UNASSIGNED, stringprep_nameprep)
  ------------------
  145|  9.53k|      }
  146|  9.53k|    while (rc == STRINGPREP_TOO_SMALL_BUFFER);
  ------------------
  |  Branch (146:12): [True: 3.06k, False: 6.47k]
  ------------------
  147|       |
  148|  6.47k|    if (rc != STRINGPREP_OK)
  ------------------
  |  Branch (148:9): [True: 1.63k, False: 4.83k]
  ------------------
  149|  1.63k|      {
  150|  1.63k|	free (p);
  151|  1.63k|	return IDNA_STRINGPREP_ERROR;
  152|  1.63k|      }
  153|       |
  154|  4.83k|    src = stringprep_utf8_to_ucs4 (p, -1, NULL);
  155|       |
  156|  4.83k|    free (p);
  157|       |
  158|  4.83k|    if (!src)
  ------------------
  |  Branch (158:9): [True: 0, False: 4.83k]
  ------------------
  159|      0|      return IDNA_MALLOC_ERROR;
  160|  4.83k|  }
  161|       |
  162|  9.52k|step3:
  163|       |  /*
  164|       |   * 3. If the UseSTD3ASCIIRules flag is set, then perform these checks:
  165|       |   *
  166|       |   * (a) Verify the absence of non-LDH ASCII code points; that is,
  167|       |   * the absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
  168|       |   *
  169|       |   * (b) Verify the absence of leading and trailing hyphen-minus;
  170|       |   * that is, the absence of U+002D at the beginning and end of
  171|       |   * the sequence.
  172|       |   */
  173|       |
  174|  9.52k|  if (flags & IDNA_USE_STD3_ASCII_RULES)
  ------------------
  |  Branch (174:7): [True: 5.07k, False: 4.45k]
  ------------------
  175|  5.07k|    {
  176|  5.07k|      size_t i;
  177|       |
  178|  83.2k|      for (i = 0; src[i]; i++)
  ------------------
  |  Branch (178:19): [True: 80.2k, False: 3.05k]
  ------------------
  179|  80.2k|	if (src[i] <= 0x2C || src[i] == 0x2E || src[i] == 0x2F ||
  ------------------
  |  Branch (179:6): [True: 782, False: 79.4k]
  |  Branch (179:24): [True: 208, False: 79.2k]
  |  Branch (179:42): [True: 218, False: 79.0k]
  ------------------
  180|  80.2k|	    (src[i] >= 0x3A && src[i] <= 0x40) ||
  ------------------
  |  Branch (180:7): [True: 75.7k, False: 3.20k]
  |  Branch (180:25): [True: 267, False: 75.5k]
  ------------------
  181|  80.2k|	    (src[i] >= 0x5B && src[i] <= 0x60) ||
  ------------------
  |  Branch (181:7): [True: 75.2k, False: 3.44k]
  |  Branch (181:25): [True: 300, False: 74.9k]
  ------------------
  182|  80.2k|	    (src[i] >= 0x7B && src[i] <= 0x7F))
  ------------------
  |  Branch (182:7): [True: 64.1k, False: 14.3k]
  |  Branch (182:25): [True: 248, False: 63.8k]
  ------------------
  183|  2.02k|	  {
  184|  2.02k|	    free (src);
  185|  2.02k|	    return IDNA_CONTAINS_NON_LDH;
  186|  2.02k|	  }
  187|       |
  188|  3.05k|      if (src[0] == 0x002D || (i > 0 && src[i - 1] == 0x002D))
  ------------------
  |  Branch (188:11): [True: 208, False: 2.84k]
  |  Branch (188:32): [True: 2.47k, False: 367]
  |  Branch (188:41): [True: 217, False: 2.26k]
  ------------------
  189|    425|	{
  190|    425|	  free (src);
  191|    425|	  return IDNA_CONTAINS_MINUS;
  192|    425|	}
  193|  3.05k|    }
  194|       |
  195|       |  /*
  196|       |   * 4. If all code points in the sequence are in the ASCII range
  197|       |   * (0..7F), then skip to step 8.
  198|       |   */
  199|       |
  200|  7.08k|  {
  201|  7.08k|    size_t i;
  202|  7.08k|    int inasciirange;
  203|       |
  204|  7.08k|    inasciirange = 1;
  205|   899k|    for (i = 0; src[i]; i++)
  ------------------
  |  Branch (205:17): [True: 892k, False: 7.08k]
  ------------------
  206|   892k|      {
  207|   892k|	if (src[i] > 0x7F)
  ------------------
  |  Branch (207:6): [True: 731k, False: 160k]
  ------------------
  208|   731k|	  inasciirange = 0;
  209|       |	/* copy string to output buffer if we are about to skip to step8 */
  210|   892k|	if (i < 64)
  ------------------
  |  Branch (210:6): [True: 99.8k, False: 792k]
  ------------------
  211|  99.8k|	  out[i] = src[i];
  212|   892k|      }
  213|  7.08k|    if (i < 64)
  ------------------
  |  Branch (213:9): [True: 6.55k, False: 524]
  ------------------
  214|  6.55k|      out[i] = '\0';
  215|    524|    else
  216|    524|      {
  217|    524|	free (src);
  218|    524|	return IDNA_INVALID_LENGTH;
  219|    524|      }
  220|  6.55k|    if (inasciirange)
  ------------------
  |  Branch (220:9): [True: 3.43k, False: 3.12k]
  ------------------
  221|  3.43k|      goto step8;
  222|  6.55k|  }
  223|       |
  224|       |  /*
  225|       |   * 5. Verify that the sequence does NOT begin with the ACE prefix.
  226|       |   *
  227|       |   */
  228|       |
  229|  3.12k|  {
  230|  3.12k|    size_t i;
  231|  3.12k|    int match;
  232|       |
  233|  3.12k|    match = 1;
  234|  6.99k|    for (i = 0; match && i < strlen (IDNA_ACE_PREFIX); i++)
  ------------------
  |  |   99|  4.07k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
  |  Branch (234:17): [True: 4.07k, False: 2.92k]
  |  Branch (234:26): [True: 3.87k, False: 194]
  ------------------
  235|  3.87k|      if (((uint32_t) IDNA_ACE_PREFIX[i] & 0xFF) != src[i])
  ------------------
  |  |   99|  3.87k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
  |  Branch (235:11): [True: 2.92k, False: 950]
  ------------------
  236|  2.92k|	match = 0;
  237|  3.12k|    if (match)
  ------------------
  |  Branch (237:9): [True: 194, False: 2.92k]
  ------------------
  238|    194|      {
  239|    194|	free (src);
  240|    194|	return IDNA_CONTAINS_ACE_PREFIX;
  241|    194|      }
  242|  3.12k|  }
  243|       |
  244|       |  /*
  245|       |   * 6. Encode the sequence using the encoding algorithm in [PUNYCODE]
  246|       |   * and fail if there is an error.
  247|       |   */
  248|  63.0k|  for (len = 0; src[len]; len++)
  ------------------
  |  Branch (248:17): [True: 60.0k, False: 2.92k]
  ------------------
  249|  60.0k|    ;
  250|  2.92k|  src[len] = '\0';
  251|  2.92k|  outlen = 63 - strlen (IDNA_ACE_PREFIX);
  ------------------
  |  |   99|  2.92k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
  252|  2.92k|  rc = punycode_encode (len, src, NULL,
  253|  2.92k|			&outlen, &out[strlen (IDNA_ACE_PREFIX)]);
  ------------------
  |  |   99|  2.92k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
  254|  2.92k|  if (rc != PUNYCODE_SUCCESS)
  ------------------
  |  Branch (254:7): [True: 749, False: 2.17k]
  ------------------
  255|    749|    {
  256|    749|      free (src);
  257|    749|      return IDNA_PUNYCODE_ERROR;
  258|    749|    }
  259|  2.17k|  out[strlen (IDNA_ACE_PREFIX) + outlen] = '\0';
  ------------------
  |  |   99|  2.17k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
  260|       |
  261|       |  /*
  262|       |   * 7. Prepend the ACE prefix.
  263|       |   */
  264|       |
  265|  2.17k|  memcpy (out, IDNA_ACE_PREFIX, strlen (IDNA_ACE_PREFIX));
  ------------------
  |  |   99|  2.17k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
                memcpy (out, IDNA_ACE_PREFIX, strlen (IDNA_ACE_PREFIX));
  ------------------
  |  |   99|  2.17k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
  266|       |
  267|       |  /*
  268|       |   * 8. Verify that the number of code points is in the range 1 to 63
  269|       |   * inclusive (0 is excluded).
  270|       |   */
  271|       |
  272|  5.61k|step8:
  273|  5.61k|  free (src);
  274|  5.61k|  if (strlen (out) < 1)
  ------------------
  |  Branch (274:7): [True: 734, False: 4.88k]
  ------------------
  275|    734|    return IDNA_INVALID_LENGTH;
  276|       |
  277|  4.88k|  return IDNA_SUCCESS;
  278|  5.61k|}
idna_to_unicode_44i:
  439|  32.8k|{
  440|  32.8k|  int rc;
  441|  32.8k|  size_t outlensave = *outlen;
  442|  32.8k|  char *p;
  443|       |
  444|  32.8k|  p = stringprep_ucs4_to_utf8 (in, (ssize_t) inlen, NULL, NULL);
  445|  32.8k|  if (p == NULL)
  ------------------
  |  Branch (445:7): [True: 2.18k, False: 30.7k]
  ------------------
  446|  2.18k|    return IDNA_MALLOC_ERROR;
  447|       |
  448|  30.7k|  rc = idna_to_unicode_internal (p, out, outlen, flags);
  449|  30.7k|  if (rc != IDNA_SUCCESS)
  ------------------
  |  Branch (449:7): [True: 30.0k, False: 668]
  ------------------
  450|  30.0k|    {
  451|  30.0k|      memcpy (out, in, sizeof (in[0]) * (inlen < outlensave ?
  ------------------
  |  Branch (451:42): [True: 0, False: 30.0k]
  ------------------
  452|  30.0k|					 inlen : outlensave));
  453|  30.0k|      *outlen = inlen;
  454|  30.0k|    }
  455|       |
  456|       |  /* p is freed in idna_to_unicode_internal.  */
  457|       |
  458|  30.7k|  return rc;
  459|  32.8k|}
idna_to_unicode_4z4z:
  641|  14.3k|{
  642|  14.3k|  const uint32_t *start = input;
  643|  14.3k|  const uint32_t *end;
  644|  14.3k|  uint32_t *buf;
  645|  14.3k|  size_t buflen;
  646|  14.3k|  uint32_t *out = NULL;
  647|  14.3k|  size_t outlen = 0;
  648|       |
  649|  14.3k|  *output = NULL;
  650|       |
  651|  14.3k|  do
  652|  30.5k|    {
  653|  30.5k|      end = start;
  654|       |
  655|   468k|      for (; *end && !DOTP (*end); end++)
  ------------------
  |  |   44|   453k|#define DOTP(c) ((c) == 0x002E || (c) == 0x3002 ||	\
  |  |  ------------------
  |  |  |  Branch (44:18): [True: 15.0k, False: 438k]
  |  |  |  Branch (44:35): [True: 380, False: 438k]
  |  |  ------------------
  |  |   45|   453k|		 (c) == 0xFF0E || (c) == 0xFF61)
  |  |  ------------------
  |  |  |  Branch (45:4): [True: 746, False: 437k]
  |  |  |  Branch (45:21): [True: 82, False: 437k]
  |  |  ------------------
  ------------------
  |  Branch (655:14): [True: 453k, False: 14.3k]
  ------------------
  656|   437k|	;
  657|       |
  658|  30.5k|      buflen = (size_t) (end - start);
  659|  30.5k|      buf = malloc (sizeof (buf[0]) * (buflen + 1));
  660|  30.5k|      if (!buf)
  ------------------
  |  Branch (660:11): [True: 0, False: 30.5k]
  ------------------
  661|      0|	{
  662|      0|	  free (out);
  663|      0|	  return IDNA_MALLOC_ERROR;
  664|      0|	}
  665|       |
  666|       |      /* don't check return code as per specification! */
  667|  30.5k|      idna_to_unicode_44i (start, (size_t) (end - start),
  668|  30.5k|			   buf, &buflen, flags);
  669|       |
  670|  30.5k|      if (out)
  ------------------
  |  Branch (670:11): [True: 16.2k, False: 14.3k]
  ------------------
  671|  16.2k|	{
  672|  16.2k|	  uint32_t *newp = realloc (out,
  673|  16.2k|				    sizeof (out[0])
  674|  16.2k|				    * (outlen + 1 + buflen + 1));
  675|  16.2k|	  if (!newp)
  ------------------
  |  Branch (675:8): [True: 0, False: 16.2k]
  ------------------
  676|      0|	    {
  677|      0|	      free (buf);
  678|      0|	      free (out);
  679|      0|	      return IDNA_MALLOC_ERROR;
  680|      0|	    }
  681|  16.2k|	  out = newp;
  682|  16.2k|	  out[outlen++] = 0x002E;	/* '.' (full stop) */
  683|  16.2k|	  memcpy (out + outlen, buf, sizeof (buf[0]) * buflen);
  684|  16.2k|	  outlen += buflen;
  685|  16.2k|	  out[outlen] = 0x0;
  686|  16.2k|	  free (buf);
  687|  16.2k|	}
  688|  14.3k|      else
  689|  14.3k|	{
  690|  14.3k|	  out = buf;
  691|  14.3k|	  outlen = buflen;
  692|  14.3k|	  out[outlen] = 0x0;
  693|  14.3k|	}
  694|       |
  695|  30.5k|      start = end + 1;
  696|  30.5k|    }
  697|  30.5k|  while (*end);
  ------------------
  |  Branch (697:10): [True: 16.2k, False: 14.3k]
  ------------------
  698|       |
  699|  14.3k|  *output = out;
  700|       |
  701|  14.3k|  return IDNA_SUCCESS;
  702|  14.3k|}
idna_to_unicode_8z4z:
  720|  13.9k|{
  721|  13.9k|  uint32_t *ucs4;
  722|  13.9k|  size_t ucs4len;
  723|  13.9k|  int rc;
  724|       |
  725|  13.9k|  ucs4 = stringprep_utf8_to_ucs4 (input, -1, &ucs4len);
  726|  13.9k|  if (!ucs4)
  ------------------
  |  Branch (726:7): [True: 1.85k, False: 12.0k]
  ------------------
  727|  1.85k|    return IDNA_ICONV_ERROR;
  728|       |
  729|  12.0k|  rc = idna_to_unicode_4z4z (ucs4, output, flags);
  730|  12.0k|  free (ucs4);
  731|       |
  732|  12.0k|  return rc;
  733|  13.9k|}
idna_to_unicode_8z8z:
  751|  11.6k|{
  752|  11.6k|  uint32_t *ucs4;
  753|  11.6k|  int rc;
  754|       |
  755|  11.6k|  rc = idna_to_unicode_8z4z (input, &ucs4, flags);
  756|  11.6k|  if (rc != IDNA_SUCCESS)
  ------------------
  |  Branch (756:7): [True: 1.30k, False: 10.3k]
  ------------------
  757|  1.30k|    return rc;
  758|       |
  759|  10.3k|  *output = stringprep_ucs4_to_utf8 (ucs4, -1, NULL, NULL);
  760|  10.3k|  free (ucs4);
  761|       |
  762|  10.3k|  if (!*output)
  ------------------
  |  Branch (762:7): [True: 0, False: 10.3k]
  ------------------
  763|      0|    return IDNA_ICONV_ERROR;
  764|       |
  765|  10.3k|  return IDNA_SUCCESS;
  766|  10.3k|}
idna_to_unicode_8zlz:
  785|  6.73k|{
  786|  6.73k|  char *utf8;
  787|  6.73k|  int rc;
  788|       |
  789|  6.73k|  rc = idna_to_unicode_8z8z (input, &utf8, flags);
  790|  6.73k|  if (rc != IDNA_SUCCESS)
  ------------------
  |  Branch (790:7): [True: 652, False: 6.08k]
  ------------------
  791|    652|    return rc;
  792|       |
  793|  6.08k|  *output = stringprep_utf8_to_locale (utf8);
  794|  6.08k|  free (utf8);
  795|       |
  796|  6.08k|  if (!*output)
  ------------------
  |  Branch (796:7): [True: 2.51k, False: 3.56k]
  ------------------
  797|  2.51k|    return IDNA_ICONV_ERROR;
  798|       |
  799|  3.56k|  return IDNA_SUCCESS;
  800|  6.08k|}
idna_to_unicode_lzlz:
  820|  4.87k|{
  821|  4.87k|  char *utf8;
  822|  4.87k|  int rc;
  823|       |
  824|  4.87k|  utf8 = stringprep_locale_to_utf8 (input);
  825|  4.87k|  if (!utf8)
  ------------------
  |  Branch (825:7): [True: 3.01k, False: 1.85k]
  ------------------
  826|  3.01k|    return IDNA_ICONV_ERROR;
  827|       |
  828|  1.85k|  rc = idna_to_unicode_8zlz (utf8, output, flags);
  829|  1.85k|  free (utf8);
  830|       |
  831|  1.85k|  return rc;
  832|  4.87k|}
idna.c:idna_to_unicode_internal:
  284|  30.7k|{
  285|  30.7k|  int rc;
  286|  30.7k|  char tmpout[64];
  287|  30.7k|  size_t utf8len = strlen (utf8in) + 1;
  288|  30.7k|  size_t addlen = 0, addinc = utf8len / 10 + 1;
  289|       |
  290|       |  /*
  291|       |   * ToUnicode consists of the following steps:
  292|       |   *
  293|       |   * 1. If the sequence contains any code points outside the ASCII range
  294|       |   * (0..7F) then proceed to step 2, otherwise skip to step 3.
  295|       |   */
  296|       |
  297|  30.7k|  {
  298|  30.7k|    size_t i;
  299|  30.7k|    int inasciirange;
  300|       |
  301|  30.7k|    inasciirange = 1;
  302|   624k|    for (i = 0; utf8in[i]; i++)
  ------------------
  |  Branch (302:17): [True: 593k, False: 30.7k]
  ------------------
  303|   593k|      if (utf8in[i] & ~0x7F)
  ------------------
  |  Branch (303:11): [True: 193k, False: 400k]
  ------------------
  304|   193k|	inasciirange = 0;
  305|  30.7k|    if (inasciirange)
  ------------------
  |  Branch (305:9): [True: 17.6k, False: 13.1k]
  ------------------
  306|  17.6k|      goto step3;
  307|  30.7k|  }
  308|       |
  309|       |  /*
  310|       |   * 2. Perform the steps specified in [NAMEPREP] and fail if there is an
  311|       |   * error. (If step 3 of ToASCII is also performed here, it will not
  312|       |   * affect the overall behavior of ToUnicode, but it is not
  313|       |   * necessary.) The AllowUnassigned flag is used in [NAMEPREP].
  314|       |   */
  315|  13.1k|  do
  316|  25.0k|    {
  317|  25.0k|      char *newp = realloc (utf8in, utf8len + addlen);
  318|  25.0k|      if (newp == NULL)
  ------------------
  |  Branch (318:11): [True: 0, False: 25.0k]
  ------------------
  319|      0|	{
  320|      0|	  free (utf8in);
  321|      0|	  return IDNA_MALLOC_ERROR;
  322|      0|	}
  323|  25.0k|      utf8in = newp;
  324|  25.0k|      if (flags & IDNA_ALLOW_UNASSIGNED)
  ------------------
  |  Branch (324:11): [True: 13.2k, False: 11.8k]
  ------------------
  325|  13.2k|	rc = stringprep_nameprep (utf8in, utf8len + addlen);
  ------------------
  |  |  203|  13.2k|  stringprep(in, maxlen, 0, stringprep_nameprep)
  ------------------
  326|  11.8k|      else
  327|  11.8k|	rc = stringprep_nameprep_no_unassigned (utf8in, utf8len + addlen);
  ------------------
  |  |  206|  11.8k|  stringprep(in, maxlen, STRINGPREP_NO_UNASSIGNED, stringprep_nameprep)
  ------------------
  328|  25.0k|      addlen += addinc;
  329|  25.0k|      addinc *= 2;
  330|  25.0k|    }
  331|  25.0k|  while (rc == STRINGPREP_TOO_SMALL_BUFFER);
  ------------------
  |  Branch (331:10): [True: 11.9k, False: 13.1k]
  ------------------
  332|       |
  333|  13.1k|  if (rc != STRINGPREP_OK)
  ------------------
  |  Branch (333:7): [True: 5.73k, False: 7.36k]
  ------------------
  334|  5.73k|    {
  335|  5.73k|      free (utf8in);
  336|  5.73k|      return IDNA_STRINGPREP_ERROR;
  337|  5.73k|    }
  338|       |
  339|       |  /* 3. Verify that the sequence begins with the ACE prefix, and save a
  340|       |   * copy of the sequence.
  341|       |   * ... The ToASCII and ToUnicode operations MUST recognize the ACE
  342|       |   prefix in a case-insensitive manner.
  343|       |   */
  344|       |
  345|  24.9k|step3:
  346|  24.9k|  if (c_strncasecmp (utf8in, IDNA_ACE_PREFIX, strlen (IDNA_ACE_PREFIX)) != 0)
  ------------------
  |  |   99|  24.9k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
                if (c_strncasecmp (utf8in, IDNA_ACE_PREFIX, strlen (IDNA_ACE_PREFIX)) != 0)
  ------------------
  |  |   99|  24.9k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
  |  Branch (346:7): [True: 10.3k, False: 14.6k]
  ------------------
  347|  10.3k|    {
  348|  10.3k|      free (utf8in);
  349|  10.3k|      return IDNA_NO_ACE_PREFIX;
  350|  10.3k|    }
  351|       |
  352|       |  /* 4. Remove the ACE prefix.
  353|       |   */
  354|       |
  355|  14.6k|  memmove (utf8in, &utf8in[strlen (IDNA_ACE_PREFIX)],
  ------------------
  |  |   99|  14.6k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
  356|  14.6k|	   strlen (utf8in) - strlen (IDNA_ACE_PREFIX) + 1);
  ------------------
  |  |   99|  14.6k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
  357|       |
  358|       |  /* 5. Decode the sequence using the decoding algorithm in [PUNYCODE]
  359|       |   * and fail if there is an error. Save a copy of the result of
  360|       |   * this step.
  361|       |   */
  362|       |
  363|  14.6k|  (*outlen)--;			/* reserve one for the zero */
  364|       |
  365|  14.6k|  rc = punycode_decode (strlen (utf8in), utf8in, outlen, out, NULL);
  366|  14.6k|  if (rc != PUNYCODE_SUCCESS)
  ------------------
  |  Branch (366:7): [True: 3.50k, False: 11.1k]
  ------------------
  367|  3.50k|    {
  368|  3.50k|      free (utf8in);
  369|  3.50k|      return IDNA_PUNYCODE_ERROR;
  370|  3.50k|    }
  371|       |
  372|  11.1k|  out[*outlen] = 0;		/* add zero */
  373|       |
  374|       |  /* 6. Apply ToASCII.
  375|       |   */
  376|       |
  377|  11.1k|  rc = idna_to_ascii_4i (out, *outlen, tmpout, flags);
  378|  11.1k|  if (rc != IDNA_SUCCESS)
  ------------------
  |  Branch (378:7): [True: 6.28k, False: 4.88k]
  ------------------
  379|  6.28k|    {
  380|  6.28k|      free (utf8in);
  381|  6.28k|      return rc;
  382|  6.28k|    }
  383|       |
  384|       |  /* 7. Verify that the result of step 6 matches the saved copy from
  385|       |   * step 3, using a case-insensitive ASCII comparison.
  386|       |   */
  387|       |
  388|  4.88k|  if (c_strcasecmp (utf8in, tmpout + strlen (IDNA_ACE_PREFIX)) != 0)
  ------------------
  |  |   99|  4.88k|#  define IDNA_ACE_PREFIX "xn--"
  ------------------
  |  Branch (388:7): [True: 4.21k, False: 668]
  ------------------
  389|  4.21k|    {
  390|  4.21k|      free (utf8in);
  391|  4.21k|      return IDNA_ROUNDTRIP_VERIFY_ERROR;
  392|  4.21k|    }
  393|       |
  394|       |  /* 8. Return the saved copy from step 5.
  395|       |   */
  396|       |
  397|    668|  free (utf8in);
  398|    668|  return IDNA_SUCCESS;
  399|  4.88k|}

stringprep_utf8_to_ucs4:
 1007|   132k|{
 1008|   132k|  size_t n;
 1009|       |
 1010|   132k|  if (len < 0)
  ------------------
  |  Branch (1010:7): [True: 132k, False: 0]
  ------------------
 1011|   132k|    n = strlen (str);
 1012|      0|  else
 1013|      0|    n = len;
 1014|       |
 1015|   132k|  if (u8_check ((const uint8_t *) str, n))
  ------------------
  |  Branch (1015:7): [True: 4.45k, False: 127k]
  ------------------
 1016|  4.45k|    return NULL;
 1017|       |
 1018|   127k|  return g_utf8_to_ucs4_fast (str, len, items_written);
 1019|   132k|}
stringprep_ucs4_to_utf8:
 1041|   185k|{
 1042|   185k|  return g_ucs4_to_utf8 (str, len, items_read, items_written);
 1043|   185k|}
stringprep_ucs4_nfkc_normalize:
 1097|   108k|{
 1098|   108k|  char *p;
 1099|   108k|  uint32_t *result_wc;
 1100|       |
 1101|   108k|  p = stringprep_ucs4_to_utf8 (str, len, 0, 0);
 1102|   108k|  if (!p)
  ------------------
  |  Branch (1102:7): [True: 0, False: 108k]
  ------------------
 1103|      0|    return NULL;
 1104|       |
 1105|   108k|  result_wc = _g_utf8_normalize_wc (p, -1, G_NORMALIZE_NFKC);
 1106|   108k|  free (p);
 1107|       |
 1108|   108k|  return result_wc;
 1109|   108k|}
nfkc.c:g_utf8_get_char:
  270|  62.4M|{
  271|  62.4M|  int i, mask = 0, len;
  272|  62.4M|  gunichar result;
  ------------------
  |  |   48|  62.4M|#define gunichar uint32_t
  ------------------
  273|  62.4M|  unsigned char c = (unsigned char) *p;
  274|       |
  275|  62.4M|  UTF8_COMPUTE (c, mask, len);
  ------------------
  |  |  153|  62.4M|  if (Char < 128)				\
  |  |  ------------------
  |  |  |  Branch (153:7): [True: 9.19M, False: 53.2M]
  |  |  ------------------
  |  |  154|  62.4M|    {						\
  |  |  155|  9.19M|      Len = 1;					\
  |  |  156|  9.19M|      Mask = 0x7f;				\
  |  |  157|  9.19M|    }						\
  |  |  158|  62.4M|  else if ((Char & 0xe0) == 0xc0)		\
  |  |  ------------------
  |  |  |  Branch (158:12): [True: 43.2M, False: 9.99M]
  |  |  ------------------
  |  |  159|  53.2M|    {						\
  |  |  160|  43.2M|      Len = 2;					\
  |  |  161|  43.2M|      Mask = 0x1f;				\
  |  |  162|  43.2M|    }						\
  |  |  163|  53.2M|  else if ((Char & 0xf0) == 0xe0)		\
  |  |  ------------------
  |  |  |  Branch (163:12): [True: 9.95M, False: 37.8k]
  |  |  ------------------
  |  |  164|  9.99M|    {						\
  |  |  165|  9.95M|      Len = 3;					\
  |  |  166|  9.95M|      Mask = 0x0f;				\
  |  |  167|  9.95M|    }						\
  |  |  168|  9.99M|  else if ((Char & 0xf8) == 0xf0)		\
  |  |  ------------------
  |  |  |  Branch (168:12): [True: 37.8k, False: 0]
  |  |  ------------------
  |  |  169|  37.8k|    {						\
  |  |  170|  37.8k|      Len = 4;					\
  |  |  171|  37.8k|      Mask = 0x07;				\
  |  |  172|  37.8k|    }						\
  |  |  173|  37.8k|  else if ((Char & 0xfc) == 0xf8)		\
  |  |  ------------------
  |  |  |  Branch (173:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  174|      0|    {						\
  |  |  175|      0|      Len = 5;					\
  |  |  176|      0|      Mask = 0x03;				\
  |  |  177|      0|    }						\
  |  |  178|      0|  else if ((Char & 0xfe) == 0xfc)		\
  |  |  ------------------
  |  |  |  Branch (178:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  179|      0|    {						\
  |  |  180|      0|      Len = 6;					\
  |  |  181|      0|      Mask = 0x01;				\
  |  |  182|      0|    }						\
  |  |  183|      0|  else						\
  |  |  184|      0|    Len = -1;
  ------------------
  276|  62.4M|  if (len == -1)
  ------------------
  |  Branch (276:7): [True: 0, False: 62.4M]
  ------------------
  277|      0|    return (gunichar) - 1;
  278|  62.4M|  UTF8_GET (result, p, i, mask, len);
  ------------------
  |  |  194|  62.4M|  (Result) = (Chars)[0] & (Mask);					      \
  |  |  195|   125M|  for ((Count) = 1; (Count) < (Len); ++(Count))				      \
  |  |  ------------------
  |  |  |  Branch (195:21): [True: 63.3M, False: 62.4M]
  |  |  ------------------
  |  |  196|  63.3M|    {									      \
  |  |  197|  63.3M|      if (((Chars)[(Count)] & 0xc0) != 0x80)				      \
  |  |  ------------------
  |  |  |  Branch (197:11): [True: 0, False: 63.3M]
  |  |  ------------------
  |  |  198|  63.3M|	{								      \
  |  |  199|      0|	  (Result) = -1;						      \
  |  |  200|      0|	  break;							      \
  |  |  201|      0|	}								      \
  |  |  202|  63.3M|      (Result) <<= 6;							      \
  |  |  203|  63.3M|      (Result) |= ((Chars)[(Count)] & 0x3f);				      \
  |  |  204|  63.3M|    }
  ------------------
  279|       |
  280|  62.4M|  return result;
  281|  62.4M|}
nfkc.c:g_unichar_to_utf8:
  296|  12.3M|{
  297|       |  /* If this gets modified, also update the copy in g_string_insert_unichar() */
  298|  12.3M|  guint len = 0;
  ------------------
  |  |   44|  12.3M|#define guint unsigned int
  ------------------
  299|  12.3M|  int first;
  300|  12.3M|  int i;
  301|       |
  302|  12.3M|  if (c < 0x80)
  ------------------
  |  Branch (302:7): [True: 2.28M, False: 10.0M]
  ------------------
  303|  2.28M|    {
  304|  2.28M|      first = 0;
  305|  2.28M|      len = 1;
  306|  2.28M|    }
  307|  10.0M|  else if (c < 0x800)
  ------------------
  |  Branch (307:12): [True: 5.79M, False: 4.26M]
  ------------------
  308|  5.79M|    {
  309|  5.79M|      first = 0xc0;
  310|  5.79M|      len = 2;
  311|  5.79M|    }
  312|  4.26M|  else if (c < 0x10000)
  ------------------
  |  Branch (312:12): [True: 4.21M, False: 53.0k]
  ------------------
  313|  4.21M|    {
  314|  4.21M|      first = 0xe0;
  315|  4.21M|      len = 3;
  316|  4.21M|    }
  317|  53.0k|  else if (c < 0x200000)
  ------------------
  |  Branch (317:12): [True: 31.8k, False: 21.1k]
  ------------------
  318|  31.8k|    {
  319|  31.8k|      first = 0xf0;
  320|  31.8k|      len = 4;
  321|  31.8k|    }
  322|  21.1k|  else if (c < 0x4000000)
  ------------------
  |  Branch (322:12): [True: 670, False: 20.4k]
  ------------------
  323|    670|    {
  324|    670|      first = 0xf8;
  325|    670|      len = 5;
  326|    670|    }
  327|  20.4k|  else
  328|  20.4k|    {
  329|  20.4k|      first = 0xfc;
  330|  20.4k|      len = 6;
  331|  20.4k|    }
  332|       |
  333|  12.3M|  if (outbuf)
  ------------------
  |  Branch (333:7): [True: 12.3M, False: 0]
  ------------------
  334|  12.3M|    {
  335|  26.7M|      for (i = len - 1; i > 0; --i)
  ------------------
  |  Branch (335:25): [True: 14.4M, False: 12.3M]
  ------------------
  336|  14.4M|	{
  337|  14.4M|	  outbuf[i] = (c & 0x3f) | 0x80;
  338|  14.4M|	  c >>= 6;
  339|  14.4M|	}
  340|  12.3M|      outbuf[0] = c | first;
  341|  12.3M|    }
  342|       |
  343|  12.3M|  return len;
  344|  12.3M|}
nfkc.c:g_utf8_to_ucs4_fast:
  365|   127k|{
  366|   127k|  gunichar *result;
  ------------------
  |  |   48|   127k|#define gunichar uint32_t
  ------------------
  367|   127k|  gsize n_chars, i;
  ------------------
  |  |   49|   127k|#define gsize size_t
  ------------------
  368|   127k|  const gchar *p;
  369|       |
  370|   127k|  g_return_val_if_fail (str != NULL, NULL);
  ------------------
  |  |   53|   127k|#define g_return_val_if_fail(expr,val)	{		\
  |  |   54|   127k|    if (!(expr))					\
  |  |  ------------------
  |  |  |  Branch (54:9): [True: 0, False: 127k]
  |  |  ------------------
  |  |   55|   127k|      return (val);					\
  |  |   56|   127k|  }
  ------------------
  371|       |
  372|   127k|  p = str;
  373|   127k|  n_chars = 0;
  374|   127k|  if (len < 0)
  ------------------
  |  Branch (374:7): [True: 127k, False: 0]
  ------------------
  375|   127k|    {
  376|  6.22M|      while (*p)
  ------------------
  |  Branch (376:14): [True: 6.09M, False: 127k]
  ------------------
  377|  6.09M|	{
  378|  6.09M|	  p = g_utf8_next_char (p);
  ------------------
  |  |  127|  6.09M|#define g_utf8_next_char(p) ((p) + g_utf8_skip[*(const guchar *)(p)])
  ------------------
  379|  6.09M|	  ++n_chars;
  380|  6.09M|	}
  381|   127k|    }
  382|      0|  else
  383|      0|    {
  384|      0|      while (p < str + len && *p)
  ------------------
  |  Branch (384:14): [True: 0, False: 0]
  |  Branch (384:31): [True: 0, False: 0]
  ------------------
  385|      0|	{
  386|      0|	  p = g_utf8_next_char (p);
  ------------------
  |  |  127|      0|#define g_utf8_next_char(p) ((p) + g_utf8_skip[*(const guchar *)(p)])
  ------------------
  387|      0|	  ++n_chars;
  388|      0|	}
  389|      0|    }
  390|       |
  391|   127k|  result = g_malloc (sizeof (gunichar) * (n_chars + 1));
  ------------------
  |  |   51|   127k|#define g_malloc malloc
  ------------------
  392|   127k|  if (!result)
  ------------------
  |  Branch (392:7): [True: 0, False: 127k]
  ------------------
  393|      0|    return NULL;
  394|       |
  395|   127k|  p = str;
  396|  6.22M|  for (i = 0; i < n_chars; i++)
  ------------------
  |  Branch (396:15): [True: 6.09M, False: 127k]
  ------------------
  397|  6.09M|    {
  398|  6.09M|      gunichar wc = (guchar) * p++;
  ------------------
  |  |   48|  6.09M|#define gunichar uint32_t
  ------------------
  399|       |
  400|  6.09M|      if (wc < 0x80)
  ------------------
  |  Branch (400:11): [True: 935k, False: 5.16M]
  ------------------
  401|   935k|	{
  402|   935k|	  result[i] = wc;
  403|   935k|	}
  404|  5.16M|      else
  405|  5.16M|	{
  406|  5.16M|	  gunichar mask = 0x40;
  ------------------
  |  |   48|  5.16M|#define gunichar uint32_t
  ------------------
  407|       |
  408|  5.16M|	  if (G_UNLIKELY ((wc & mask) == 0))
  ------------------
  |  |   89|  5.16M|#define G_UNLIKELY(expr) (expr)
  |  |  ------------------
  |  |  |  Branch (89:26): [True: 0, False: 5.16M]
  |  |  ------------------
  ------------------
  409|      0|	    {
  410|       |	      /* It's an out-of-sequence 10xxxxxxx byte.
  411|       |	       * Rather than making an ugly hash of this and the next byte
  412|       |	       * and overrunning the buffer, it's more useful to treat it
  413|       |	       * with a replacement character */
  414|      0|	      result[i] = 0xfffd;
  415|      0|	      continue;
  416|      0|	    }
  417|       |
  418|  5.16M|	  do
  419|  8.82M|	    {
  420|  8.82M|	      wc <<= 6;
  421|  8.82M|	      wc |= (guchar) (*p++) & 0x3f;
  422|  8.82M|	      mask <<= 5;
  423|  8.82M|	    }
  424|  8.82M|	  while ((wc & mask) != 0);
  ------------------
  |  Branch (424:11): [True: 3.66M, False: 5.16M]
  ------------------
  425|       |
  426|  5.16M|	  wc &= mask - 1;
  427|       |
  428|  5.16M|	  result[i] = wc;
  429|  5.16M|	}
  430|  6.09M|    }
  431|   127k|  result[i] = 0;
  432|       |
  433|   127k|  if (items_written)
  ------------------
  |  Branch (433:7): [True: 123k, False: 4.83k]
  ------------------
  434|   123k|    *items_written = i;
  435|       |
  436|   127k|  return result;
  437|   127k|}
nfkc.c:g_ucs4_to_utf8:
  465|   185k|{
  466|   185k|  gint result_length;
  ------------------
  |  |   43|   185k|#define gint int
  ------------------
  467|   185k|  gchar *result = NULL;
  ------------------
  |  |   41|   185k|#define gchar char
  ------------------
  468|   185k|  gchar *p;
  ------------------
  |  |   41|   185k|#define gchar char
  ------------------
  469|   185k|  gsize i;
  ------------------
  |  |   49|   185k|#define gsize size_t
  ------------------
  470|       |
  471|   185k|  result_length = 0;
  472|  12.5M|  for (i = 0; i < len; i++)
  ------------------
  |  Branch (472:15): [True: 12.3M, False: 173k]
  ------------------
  473|  12.3M|    {
  474|  12.3M|      if (!str[i])
  ------------------
  |  Branch (474:11): [True: 10.3k, False: 12.3M]
  ------------------
  475|  10.3k|	break;
  476|       |
  477|  12.3M|      if (str[i] >= 0x80000000)
  ------------------
  |  Branch (477:11): [True: 2.18k, False: 12.3M]
  ------------------
  478|  2.18k|	goto err_out;
  479|       |
  480|  12.3M|      result_length += UTF8_LENGTH (str[i]);
  ------------------
  |  |  187|  12.3M|  ((Char) < 0x80 ? 1 :				\
  |  |  ------------------
  |  |  |  Branch (187:4): [True: 2.28M, False: 10.0M]
  |  |  ------------------
  |  |  188|  12.3M|   ((Char) < 0x800 ? 2 :			\
  |  |  ------------------
  |  |  |  Branch (188:5): [True: 5.79M, False: 4.26M]
  |  |  ------------------
  |  |  189|  10.0M|    ((Char) < 0x10000 ? 3 :			\
  |  |  ------------------
  |  |  |  Branch (189:6): [True: 4.21M, False: 53.9k]
  |  |  ------------------
  |  |  190|  4.26M|     ((Char) < 0x200000 ? 4 :			\
  |  |  ------------------
  |  |  |  Branch (190:7): [True: 31.8k, False: 22.0k]
  |  |  ------------------
  |  |  191|  53.9k|      ((Char) < 0x4000000 ? 5 : 6)))))
  |  |  ------------------
  |  |  |  Branch (191:8): [True: 674, False: 21.4k]
  |  |  ------------------
  ------------------
  481|  12.3M|    }
  482|       |
  483|   183k|  result = g_malloc (result_length + 1);
  ------------------
  |  |   51|   183k|#define g_malloc malloc
  ------------------
  484|   183k|  if (!result)
  ------------------
  |  Branch (484:7): [True: 0, False: 183k]
  ------------------
  485|      0|    return NULL;
  486|   183k|  p = result;
  487|       |
  488|   183k|  i = 0;
  489|  12.5M|  while (p < result + result_length)
  ------------------
  |  Branch (489:10): [True: 12.3M, False: 183k]
  ------------------
  490|  12.3M|    p += g_unichar_to_utf8 (str[i++], p);
  491|       |
  492|   183k|  *p = '\0';
  493|       |
  494|   183k|  if (items_written)
  ------------------
  |  Branch (494:7): [True: 0, False: 183k]
  ------------------
  495|      0|    *items_written = p - result;
  496|       |
  497|   185k|err_out:
  498|   185k|  if (items_read)
  ------------------
  |  Branch (498:7): [True: 0, False: 185k]
  ------------------
  499|      0|    *items_read = i;
  500|       |
  501|   185k|  return result;
  502|   183k|}
nfkc.c:_g_utf8_normalize_wc:
  768|   108k|{
  769|   108k|  gsize n_wc;
  ------------------
  |  |   49|   108k|#define gsize size_t
  ------------------
  770|   108k|  gunichar *wc_buffer;
  ------------------
  |  |   48|   108k|#define gunichar uint32_t
  ------------------
  771|   108k|  const char *p;
  772|   108k|  gsize last_start;
  ------------------
  |  |   49|   108k|#define gsize size_t
  ------------------
  773|   108k|  gboolean do_compat = (mode == G_NORMALIZE_NFKC || mode == G_NORMALIZE_NFKD);
  ------------------
  |  |   40|   108k|#define gboolean int
  ------------------
  |  Branch (773:25): [True: 108k, False: 0]
  |  Branch (773:53): [True: 0, False: 0]
  ------------------
  774|   108k|  gboolean do_compose = (mode == G_NORMALIZE_NFC || mode == G_NORMALIZE_NFKC);
  ------------------
  |  |   40|   108k|#define gboolean int
  ------------------
  |  Branch (774:26): [True: 0, False: 108k]
  |  Branch (774:53): [True: 108k, False: 0]
  ------------------
  775|       |
  776|   108k|  n_wc = 0;
  777|   108k|  p = str;
  778|  3.96M|  while ((max_len < 0 || p < str + max_len) && *p)
  ------------------
  |  Branch (778:11): [True: 3.96M, False: 0]
  |  Branch (778:26): [True: 0, False: 0]
  |  Branch (778:48): [True: 3.85M, False: 108k]
  ------------------
  779|  3.85M|    {
  780|  3.85M|      const gchar *decomp;
  781|  3.85M|      gunichar wc = g_utf8_get_char (p);
  ------------------
  |  |   48|  3.85M|#define gunichar uint32_t
  ------------------
  782|       |
  783|  3.85M|      if (wc >= SBase && wc < SBase + SCount)
  ------------------
  |  |  548|  7.71M|#define SBase 0xAC00
  ------------------
                    if (wc >= SBase && wc < SBase + SCount)
  ------------------
  |  |  548|  2.96M|#define SBase 0xAC00
  ------------------
                    if (wc >= SBase && wc < SBase + SCount)
  ------------------
  |  |  556|  2.96M|#define SCount (LCount * NCount)
  |  |  ------------------
  |  |  |  |  552|  2.96M|#define LCount 19
  |  |  ------------------
  |  |               #define SCount (LCount * NCount)
  |  |  ------------------
  |  |  |  |  555|  2.96M|#define NCount (VCount * TCount)
  |  |  |  |  ------------------
  |  |  |  |  |  |  553|  2.96M|#define VCount 21
  |  |  |  |  ------------------
  |  |  |  |               #define NCount (VCount * TCount)
  |  |  |  |  ------------------
  |  |  |  |  |  |  554|  2.96M|#define TCount 28
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (783:11): [True: 2.96M, False: 891k]
  |  Branch (783:26): [True: 4.19k, False: 2.96M]
  ------------------
  784|  4.19k|	{
  785|  4.19k|	  gsize result_len;
  ------------------
  |  |   49|  4.19k|#define gsize size_t
  ------------------
  786|  4.19k|	  decompose_hangul (wc, NULL, &result_len);
  787|  4.19k|	  n_wc += result_len;
  788|  4.19k|	}
  789|  3.85M|      else
  790|  3.85M|	{
  791|  3.85M|	  decomp = find_decomposition (wc, do_compat);
  792|       |
  793|  3.85M|	  if (decomp)
  ------------------
  |  Branch (793:8): [True: 3.55M, False: 295k]
  ------------------
  794|  3.55M|	    n_wc += g_utf8_strlen (decomp);
  795|   295k|	  else
  796|   295k|	    n_wc++;
  797|  3.85M|	}
  798|       |
  799|  3.85M|      p = g_utf8_next_char (p);
  ------------------
  |  |  127|  3.85M|#define g_utf8_next_char(p) ((p) + g_utf8_skip[*(const guchar *)(p)])
  ------------------
  800|  3.85M|    }
  801|       |
  802|   108k|  wc_buffer = g_malloc (sizeof (gunichar) * (n_wc + 1));
  ------------------
  |  |   51|   108k|#define g_malloc malloc
  ------------------
  803|   108k|  if (!wc_buffer)
  ------------------
  |  Branch (803:7): [True: 0, False: 108k]
  ------------------
  804|      0|    return NULL;
  805|       |
  806|   108k|  last_start = 0;
  807|   108k|  n_wc = 0;
  808|   108k|  p = str;
  809|  3.96M|  while ((max_len < 0 || p < str + max_len) && *p)
  ------------------
  |  Branch (809:11): [True: 3.96M, False: 0]
  |  Branch (809:26): [True: 0, False: 0]
  |  Branch (809:48): [True: 3.85M, False: 108k]
  ------------------
  810|  3.85M|    {
  811|  3.85M|      gunichar wc = g_utf8_get_char (p);
  ------------------
  |  |   48|  3.85M|#define gunichar uint32_t
  ------------------
  812|  3.85M|      const gchar *decomp;
  813|  3.85M|      int cc;
  814|  3.85M|      gsize old_n_wc = n_wc;
  ------------------
  |  |   49|  3.85M|#define gsize size_t
  ------------------
  815|       |
  816|  3.85M|      if (wc >= SBase && wc < SBase + SCount)
  ------------------
  |  |  548|  7.71M|#define SBase 0xAC00
  ------------------
                    if (wc >= SBase && wc < SBase + SCount)
  ------------------
  |  |  548|  2.96M|#define SBase 0xAC00
  ------------------
                    if (wc >= SBase && wc < SBase + SCount)
  ------------------
  |  |  556|  2.96M|#define SCount (LCount * NCount)
  |  |  ------------------
  |  |  |  |  552|  2.96M|#define LCount 19
  |  |  ------------------
  |  |               #define SCount (LCount * NCount)
  |  |  ------------------
  |  |  |  |  555|  2.96M|#define NCount (VCount * TCount)
  |  |  |  |  ------------------
  |  |  |  |  |  |  553|  2.96M|#define VCount 21
  |  |  |  |  ------------------
  |  |  |  |               #define NCount (VCount * TCount)
  |  |  |  |  ------------------
  |  |  |  |  |  |  554|  2.96M|#define TCount 28
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (816:11): [True: 2.96M, False: 891k]
  |  Branch (816:26): [True: 4.19k, False: 2.96M]
  ------------------
  817|  4.19k|	{
  818|  4.19k|	  gsize result_len;
  ------------------
  |  |   49|  4.19k|#define gsize size_t
  ------------------
  819|  4.19k|	  decompose_hangul (wc, wc_buffer + n_wc, &result_len);
  820|  4.19k|	  n_wc += result_len;
  821|  4.19k|	}
  822|  3.85M|      else
  823|  3.85M|	{
  824|  3.85M|	  decomp = find_decomposition (wc, do_compat);
  825|       |
  826|  3.85M|	  if (decomp)
  ------------------
  |  Branch (826:8): [True: 3.55M, False: 295k]
  ------------------
  827|  3.55M|	    {
  828|  3.55M|	      const char *pd;
  829|  58.3M|	      for (pd = decomp; *pd != '\0'; pd = g_utf8_next_char (pd))
  ------------------
  |  |  127|  54.7M|#define g_utf8_next_char(p) ((p) + g_utf8_skip[*(const guchar *)(p)])
  ------------------
  |  Branch (829:26): [True: 54.7M, False: 3.55M]
  ------------------
  830|  54.7M|		wc_buffer[n_wc++] = g_utf8_get_char (pd);
  831|  3.55M|	    }
  832|   295k|	  else
  833|   295k|	    wc_buffer[n_wc++] = wc;
  834|  3.85M|	}
  835|       |
  836|  3.85M|      if (n_wc > 0)
  ------------------
  |  Branch (836:11): [True: 3.85M, False: 0]
  ------------------
  837|  3.85M|	{
  838|  3.85M|	  cc = COMBINING_CLASS (wc_buffer[old_n_wc]);
  ------------------
  |  |  541|  3.85M|  (((Char) <= G_UNICODE_LAST_CHAR_PART1)			\
  |  |  ------------------
  |  |  |  |   12|  3.85M|#define G_UNICODE_LAST_CHAR_PART1 0x2FAFF
  |  |  ------------------
  |  |  |  Branch (541:4): [True: 3.84M, False: 8.66k]
  |  |  ------------------
  |  |  542|  3.85M|   ? CC_PART1 ((Char) >> 8, (Char) & 0xff)			\
  |  |  ------------------
  |  |  |  |  531|  3.84M|  ((combining_class_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  3.84M|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:4): [True: 330k, False: 3.51M]
  |  |  |  |  ------------------
  |  |  |  |  532|  3.84M|   ? (combining_class_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|   330k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  533|  3.84M|   : (cclass_data[combining_class_table_part1[Page]][Char]))
  |  |  ------------------
  |  |  543|  3.85M|   : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR)	\
  |  |  ------------------
  |  |  |  |    8|  4.33k|#define G_UNICODE_LAST_CHAR 0x10ffff
  |  |  ------------------
  |  |  |  Branch (543:8): [True: 4.33k, False: 4.33k]
  |  |  |  Branch (543:29): [True: 4.33k, False: 0]
  |  |  ------------------
  |  |  544|  8.66k|      ? CC_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff)	\
  |  |  ------------------
  |  |  |  |  536|  4.33k|  ((combining_class_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  4.33k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (536:4): [True: 4.33k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  537|  4.33k|   ? (combining_class_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  4.33k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  538|  4.33k|   : (cclass_data[combining_class_table_part2[Page]][Char]))
  |  |  ------------------
  |  |  545|  8.66k|      : 0))
  ------------------
  839|       |
  840|  3.85M|	  if (cc == 0)
  ------------------
  |  Branch (840:8): [True: 3.79M, False: 62.6k]
  ------------------
  841|  3.79M|	    {
  842|  3.79M|	      g_unicode_canonical_ordering (wc_buffer + last_start,
  843|  3.79M|					    n_wc - last_start);
  844|  3.79M|	      last_start = old_n_wc;
  845|  3.79M|	    }
  846|  3.85M|	}
  847|       |
  848|  3.85M|      p = g_utf8_next_char (p);
  ------------------
  |  |  127|  3.85M|#define g_utf8_next_char(p) ((p) + g_utf8_skip[*(const guchar *)(p)])
  ------------------
  849|  3.85M|    }
  850|       |
  851|   108k|  if (n_wc > 0)
  ------------------
  |  Branch (851:7): [True: 107k, False: 1.10k]
  ------------------
  852|   107k|    {
  853|   107k|      g_unicode_canonical_ordering (wc_buffer + last_start,
  854|   107k|				    n_wc - last_start);
  855|       |      /* dead assignment: last_start = n_wc; */
  856|   107k|    }
  857|       |
  858|   108k|  wc_buffer[n_wc] = 0;
  859|       |
  860|       |  /* All decomposed and reordered */
  861|       |
  862|   108k|  if (do_compose && n_wc > 0)
  ------------------
  |  Branch (862:7): [True: 108k, False: 0]
  |  Branch (862:21): [True: 107k, False: 1.10k]
  ------------------
  863|   107k|    {
  864|   107k|      gsize i, j;
  ------------------
  |  |   49|   107k|#define gsize size_t
  ------------------
  865|   107k|      int last_cc = 0;
  866|   107k|      last_start = 0;
  867|       |
  868|  55.1M|      for (i = 0; i < n_wc; i++)
  ------------------
  |  Branch (868:19): [True: 55.0M, False: 107k]
  ------------------
  869|  55.0M|	{
  870|  55.0M|	  int cc = COMBINING_CLASS (wc_buffer[i]);
  ------------------
  |  |  541|  55.0M|  (((Char) <= G_UNICODE_LAST_CHAR_PART1)			\
  |  |  ------------------
  |  |  |  |   12|  55.0M|#define G_UNICODE_LAST_CHAR_PART1 0x2FAFF
  |  |  ------------------
  |  |  |  Branch (541:4): [True: 55.0M, False: 8.66k]
  |  |  ------------------
  |  |  542|  55.0M|   ? CC_PART1 ((Char) >> 8, (Char) & 0xff)			\
  |  |  ------------------
  |  |  |  |  531|  55.0M|  ((combining_class_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  55.0M|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:4): [True: 9.05M, False: 46.0M]
  |  |  |  |  ------------------
  |  |  |  |  532|  55.0M|   ? (combining_class_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  9.05M|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  533|  55.0M|   : (cclass_data[combining_class_table_part1[Page]][Char]))
  |  |  ------------------
  |  |  543|  55.0M|   : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR)	\
  |  |  ------------------
  |  |  |  |    8|  4.33k|#define G_UNICODE_LAST_CHAR 0x10ffff
  |  |  ------------------
  |  |  |  Branch (543:8): [True: 4.33k, False: 4.33k]
  |  |  |  Branch (543:29): [True: 4.33k, False: 0]
  |  |  ------------------
  |  |  544|  8.66k|      ? CC_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff)	\
  |  |  ------------------
  |  |  |  |  536|  4.33k|  ((combining_class_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  4.33k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (536:4): [True: 4.33k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  537|  4.33k|   ? (combining_class_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  4.33k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  538|  4.33k|   : (cclass_data[combining_class_table_part2[Page]][Char]))
  |  |  ------------------
  |  |  545|  8.66k|      : 0))
  ------------------
  871|       |
  872|  55.0M|	  if (i > 0 &&
  ------------------
  |  Branch (872:8): [True: 54.9M, False: 107k]
  ------------------
  873|  55.0M|	      (last_cc == 0 || last_cc != cc) &&
  ------------------
  |  Branch (873:9): [True: 54.8M, False: 118k]
  |  Branch (873:25): [True: 22.4k, False: 95.9k]
  ------------------
  874|  55.0M|	      combine (wc_buffer[last_start], wc_buffer[i],
  ------------------
  |  Branch (874:8): [True: 79.3k, False: 54.7M]
  ------------------
  875|  54.8M|		       &wc_buffer[last_start]))
  876|  79.3k|	    {
  877|  60.4M|	      for (j = i + 1; j < n_wc; j++)
  ------------------
  |  Branch (877:24): [True: 60.3M, False: 79.3k]
  ------------------
  878|  60.3M|		wc_buffer[j - 1] = wc_buffer[j];
  879|  79.3k|	      n_wc--;
  880|  79.3k|	      i--;
  881|       |
  882|  79.3k|	      if (i == last_start)
  ------------------
  |  Branch (882:12): [True: 74.8k, False: 4.52k]
  ------------------
  883|  74.8k|		last_cc = 0;
  884|  4.52k|	      else
  885|  4.52k|		last_cc = COMBINING_CLASS (wc_buffer[i - 1]);
  ------------------
  |  |  541|  4.52k|  (((Char) <= G_UNICODE_LAST_CHAR_PART1)			\
  |  |  ------------------
  |  |  |  |   12|  4.52k|#define G_UNICODE_LAST_CHAR_PART1 0x2FAFF
  |  |  ------------------
  |  |  |  Branch (541:4): [True: 4.52k, False: 0]
  |  |  ------------------
  |  |  542|  4.52k|   ? CC_PART1 ((Char) >> 8, (Char) & 0xff)			\
  |  |  ------------------
  |  |  |  |  531|  4.52k|  ((combining_class_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  4.52k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:4): [True: 1.51k, False: 3.01k]
  |  |  |  |  ------------------
  |  |  |  |  532|  4.52k|   ? (combining_class_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  1.51k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  533|  4.52k|   : (cclass_data[combining_class_table_part1[Page]][Char]))
  |  |  ------------------
  |  |  543|  4.52k|   : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR)	\
  |  |  ------------------
  |  |  |  |    8|      0|#define G_UNICODE_LAST_CHAR 0x10ffff
  |  |  ------------------
  |  |  |  Branch (543:8): [True: 0, False: 0]
  |  |  |  Branch (543:29): [True: 0, False: 0]
  |  |  ------------------
  |  |  544|      0|      ? CC_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff)	\
  |  |  ------------------
  |  |  |  |  536|      0|  ((combining_class_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|      0|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (536:4): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  537|      0|   ? (combining_class_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|      0|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  538|      0|   : (cclass_data[combining_class_table_part2[Page]][Char]))
  |  |  ------------------
  |  |  545|      0|      : 0))
  ------------------
  886|       |
  887|  79.3k|	      continue;
  888|  79.3k|	    }
  889|       |
  890|  54.9M|	  if (cc == 0)
  ------------------
  |  Branch (890:8): [True: 54.8M, False: 120k]
  ------------------
  891|  54.8M|	    last_start = i;
  892|       |
  893|  54.9M|	  last_cc = cc;
  894|  54.9M|	}
  895|   107k|    }
  896|       |
  897|   108k|  wc_buffer[n_wc] = 0;
  898|       |
  899|   108k|  return wc_buffer;
  900|   108k|}
nfkc.c:decompose_hangul:
  611|  8.38k|{
  612|  8.38k|  gint SIndex = s - SBase;
  ------------------
  |  |   43|  8.38k|#define gint int
  ------------------
                gint SIndex = s - SBase;
  ------------------
  |  |  548|  8.38k|#define SBase 0xAC00
  ------------------
  613|  8.38k|  gint TIndex = SIndex % TCount;
  ------------------
  |  |   43|  8.38k|#define gint int
  ------------------
                gint TIndex = SIndex % TCount;
  ------------------
  |  |  554|  8.38k|#define TCount 28
  ------------------
  614|       |
  615|  8.38k|  if (r)
  ------------------
  |  Branch (615:7): [True: 4.19k, False: 4.19k]
  ------------------
  616|  4.19k|    {
  617|  4.19k|      r[0] = LBase + SIndex / NCount;
  ------------------
  |  |  549|  4.19k|#define LBase 0x1100
  ------------------
                    r[0] = LBase + SIndex / NCount;
  ------------------
  |  |  555|  4.19k|#define NCount (VCount * TCount)
  |  |  ------------------
  |  |  |  |  553|  4.19k|#define VCount 21
  |  |  ------------------
  |  |               #define NCount (VCount * TCount)
  |  |  ------------------
  |  |  |  |  554|  4.19k|#define TCount 28
  |  |  ------------------
  ------------------
  618|  4.19k|      r[1] = VBase + (SIndex % NCount) / TCount;
  ------------------
  |  |  550|  4.19k|#define VBase 0x1161
  ------------------
                    r[1] = VBase + (SIndex % NCount) / TCount;
  ------------------
  |  |  555|  4.19k|#define NCount (VCount * TCount)
  |  |  ------------------
  |  |  |  |  553|  4.19k|#define VCount 21
  |  |  ------------------
  |  |               #define NCount (VCount * TCount)
  |  |  ------------------
  |  |  |  |  554|  4.19k|#define TCount 28
  |  |  ------------------
  ------------------
                    r[1] = VBase + (SIndex % NCount) / TCount;
  ------------------
  |  |  554|  4.19k|#define TCount 28
  ------------------
  619|  4.19k|    }
  620|       |
  621|  8.38k|  if (TIndex)
  ------------------
  |  Branch (621:7): [True: 6.59k, False: 1.79k]
  ------------------
  622|  6.59k|    {
  623|  6.59k|      if (r)
  ------------------
  |  Branch (623:11): [True: 3.29k, False: 3.29k]
  ------------------
  624|  3.29k|	r[2] = TBase + TIndex;
  ------------------
  |  |  551|  3.29k|#define TBase 0x11A7
  ------------------
  625|  6.59k|      *result_len = 3;
  626|  6.59k|    }
  627|  1.79k|  else
  628|  1.79k|    *result_len = 2;
  629|  8.38k|}
nfkc.c:find_decomposition:
  634|  7.70M|{
  635|  7.70M|  int start = 0;
  636|  7.70M|  int end = G_N_ELEMENTS (decomp_table);
  ------------------
  |  |   87|  7.70M|#define G_N_ELEMENTS(arr)		(sizeof (arr) / sizeof ((arr)[0]))
  ------------------
  637|       |
  638|  7.70M|  if (ch >= decomp_table[start].ch && ch <= decomp_table[end - 1].ch)
  ------------------
  |  Branch (638:7): [True: 7.23M, False: 465k]
  |  Branch (638:39): [True: 7.22M, False: 17.5k]
  ------------------
  639|  7.22M|    {
  640|  86.4M|      while (TRUE)
  ------------------
  |  |   84|  86.4M|# define	TRUE	(!FALSE)
  |  |  ------------------
  |  |  |  |   80|  86.4M|# define	FALSE	(0)
  |  |  ------------------
  |  |  |  Branch (84:15): [Folded - Ignored]
  |  |  ------------------
  ------------------
  641|  86.4M|	{
  642|  86.4M|	  int half = (start + end) / 2;
  643|  86.4M|	  if (ch == decomp_table[half].ch)
  ------------------
  |  Branch (643:8): [True: 7.11M, False: 79.3M]
  ------------------
  644|  7.11M|	    {
  645|  7.11M|	      int offset;
  646|       |
  647|  7.11M|	      if (compat)
  ------------------
  |  Branch (647:12): [True: 7.11M, False: 0]
  ------------------
  648|  7.11M|		{
  649|  7.11M|		  offset = decomp_table[half].compat_offset;
  650|  7.11M|		  if (offset == G_UNICODE_NOT_PRESENT_OFFSET)
  ------------------
  |  |   16|  7.11M|#define G_UNICODE_NOT_PRESENT_OFFSET 65535
  ------------------
  |  Branch (650:9): [True: 119k, False: 6.99M]
  ------------------
  651|   119k|		    offset = decomp_table[half].canon_offset;
  652|  7.11M|		}
  653|      0|	      else
  654|      0|		{
  655|      0|		  offset = decomp_table[half].canon_offset;
  656|      0|		  if (offset == G_UNICODE_NOT_PRESENT_OFFSET)
  ------------------
  |  |   16|      0|#define G_UNICODE_NOT_PRESENT_OFFSET 65535
  ------------------
  |  Branch (656:9): [True: 0, False: 0]
  ------------------
  657|      0|		    return NULL;
  658|      0|		}
  659|       |
  660|  7.11M|	      return &(decomp_expansion_string[offset]);
  661|  7.11M|	    }
  662|  79.3M|	  else if (half == start)
  ------------------
  |  Branch (662:13): [True: 109k, False: 79.2M]
  ------------------
  663|   109k|	    break;
  664|  79.2M|	  else if (ch > decomp_table[half].ch)
  ------------------
  |  Branch (664:13): [True: 41.1M, False: 38.1M]
  ------------------
  665|  41.1M|	    start = half;
  666|  38.1M|	  else
  667|  38.1M|	    end = half;
  668|  86.4M|	}
  669|  7.22M|    }
  670|       |
  671|   591k|  return NULL;
  672|  7.70M|}
nfkc.c:g_utf8_strlen:
  242|  3.55M|{
  243|  3.55M|  gsize len = 0;
  ------------------
  |  |   49|  3.55M|#define gsize size_t
  ------------------
  244|       |
  245|  3.55M|  g_return_val_if_fail (p != NULL, 0);
  ------------------
  |  |   53|  3.55M|#define g_return_val_if_fail(expr,val)	{		\
  |  |   54|  3.55M|    if (!(expr))					\
  |  |  ------------------
  |  |  |  Branch (54:9): [True: 0, False: 3.55M]
  |  |  ------------------
  |  |   55|  3.55M|      return (val);					\
  |  |   56|  3.55M|  }
  ------------------
  246|       |
  247|  58.3M|  while (*p)
  ------------------
  |  Branch (247:10): [True: 54.7M, False: 3.55M]
  ------------------
  248|  54.7M|    {
  249|  54.7M|      p = g_utf8_next_char (p);
  ------------------
  |  |  127|  54.7M|#define g_utf8_next_char(p) ((p) + g_utf8_skip[*(const guchar *)(p)])
  ------------------
  250|  54.7M|      ++len;
  251|  54.7M|    }
  252|       |
  253|  3.55M|  return len;
  254|  3.55M|}
nfkc.c:g_unicode_canonical_ordering:
  570|  3.90M|{
  571|  3.90M|  gsize i;
  ------------------
  |  |   49|  3.90M|#define gsize size_t
  ------------------
  572|  3.90M|  int swap = 1;
  573|       |
  574|  7.81M|  while (swap)
  ------------------
  |  Branch (574:10): [True: 3.90M, False: 3.90M]
  ------------------
  575|  3.90M|    {
  576|  3.90M|      int last;
  577|  3.90M|      swap = 0;
  578|  3.90M|      last = COMBINING_CLASS (string[0]);
  ------------------
  |  |  541|  3.90M|  (((Char) <= G_UNICODE_LAST_CHAR_PART1)			\
  |  |  ------------------
  |  |  |  |   12|  3.90M|#define G_UNICODE_LAST_CHAR_PART1 0x2FAFF
  |  |  ------------------
  |  |  |  Branch (541:4): [True: 3.89M, False: 11.4k]
  |  |  ------------------
  |  |  542|  3.90M|   ? CC_PART1 ((Char) >> 8, (Char) & 0xff)			\
  |  |  ------------------
  |  |  |  |  531|  3.89M|  ((combining_class_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  3.89M|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:4): [True: 361k, False: 3.53M]
  |  |  |  |  ------------------
  |  |  |  |  532|  3.89M|   ? (combining_class_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|   361k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  533|  3.89M|   : (cclass_data[combining_class_table_part1[Page]][Char]))
  |  |  ------------------
  |  |  543|  3.90M|   : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR)	\
  |  |  ------------------
  |  |  |  |    8|  5.62k|#define G_UNICODE_LAST_CHAR 0x10ffff
  |  |  ------------------
  |  |  |  Branch (543:8): [True: 5.62k, False: 5.87k]
  |  |  |  Branch (543:29): [True: 5.62k, False: 0]
  |  |  ------------------
  |  |  544|  11.4k|      ? CC_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff)	\
  |  |  ------------------
  |  |  |  |  536|  5.62k|  ((combining_class_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  5.62k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (536:4): [True: 5.62k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  537|  5.62k|   ? (combining_class_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  5.62k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  538|  5.62k|   : (cclass_data[combining_class_table_part2[Page]][Char]))
  |  |  ------------------
  |  |  545|  11.4k|      : 0))
  ------------------
  579|   110M|      for (i = 0; i < len - 1; ++i)
  ------------------
  |  Branch (579:19): [True: 106M, False: 3.90M]
  ------------------
  580|   106M|	{
  581|   106M|	  int next = COMBINING_CLASS (string[i + 1]);
  ------------------
  |  |  541|   106M|  (((Char) <= G_UNICODE_LAST_CHAR_PART1)			\
  |  |  ------------------
  |  |  |  |   12|   106M|#define G_UNICODE_LAST_CHAR_PART1 0x2FAFF
  |  |  ------------------
  |  |  |  Branch (541:4): [True: 106M, False: 7.10k]
  |  |  ------------------
  |  |  542|   106M|   ? CC_PART1 ((Char) >> 8, (Char) & 0xff)			\
  |  |  ------------------
  |  |  |  |  531|   106M|  ((combining_class_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|   106M|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:4): [True: 17.7M, False: 88.5M]
  |  |  |  |  ------------------
  |  |  |  |  532|   106M|   ? (combining_class_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  17.7M|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  533|   106M|   : (cclass_data[combining_class_table_part1[Page]][Char]))
  |  |  ------------------
  |  |  543|   106M|   : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR)	\
  |  |  ------------------
  |  |  |  |    8|  3.63k|#define G_UNICODE_LAST_CHAR 0x10ffff
  |  |  ------------------
  |  |  |  Branch (543:8): [True: 3.63k, False: 3.46k]
  |  |  |  Branch (543:29): [True: 3.63k, False: 0]
  |  |  ------------------
  |  |  544|  7.10k|      ? CC_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff)	\
  |  |  ------------------
  |  |  |  |  536|  3.63k|  ((combining_class_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  3.63k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (536:4): [True: 3.63k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  537|  3.63k|   ? (combining_class_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  3.63k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  538|  3.63k|   : (cclass_data[combining_class_table_part2[Page]][Char]))
  |  |  ------------------
  |  |  545|  7.10k|      : 0))
  ------------------
  582|   106M|	  if (next != 0 && last > next)
  ------------------
  |  Branch (582:8): [True: 373k, False: 105M]
  |  Branch (582:21): [True: 47.8k, False: 325k]
  ------------------
  583|  47.8k|	    {
  584|  47.8k|	      gsize j;
  ------------------
  |  |   49|  47.8k|#define gsize size_t
  ------------------
  585|       |	      /* Percolate item leftward through string.  */
  586|  3.28M|	      for (j = i + 1; j > 0; --j)
  ------------------
  |  Branch (586:24): [True: 3.28M, False: 1.27k]
  ------------------
  587|  3.28M|		{
  588|  3.28M|		  gunichar t;
  ------------------
  |  |   48|  3.28M|#define gunichar uint32_t
  ------------------
  589|  3.28M|		  if (COMBINING_CLASS (string[j - 1]) <= next)
  ------------------
  |  |  541|  3.28M|  (((Char) <= G_UNICODE_LAST_CHAR_PART1)			\
  |  |  ------------------
  |  |  |  |   12|  3.28M|#define G_UNICODE_LAST_CHAR_PART1 0x2FAFF
  |  |  ------------------
  |  |  |  Branch (541:4): [True: 3.28M, False: 1.56k]
  |  |  ------------------
  |  |  542|  3.28M|   ? CC_PART1 ((Char) >> 8, (Char) & 0xff)			\
  |  |  ------------------
  |  |  |  |  531|  3.28M|  ((combining_class_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  3.28M|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:4): [True: 1.96k, False: 3.28M]
  |  |  |  |  ------------------
  |  |  |  |  532|  3.28M|   ? (combining_class_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  1.96k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  533|  3.28M|   : (cclass_data[combining_class_table_part1[Page]][Char]))
  |  |  ------------------
  |  |  543|  3.28M|   : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR)	\
  |  |  ------------------
  |  |  |  |    8|    778|#define G_UNICODE_LAST_CHAR 0x10ffff
  |  |  ------------------
  |  |  |  Branch (543:8): [True: 778, False: 782]
  |  |  |  Branch (543:29): [True: 778, False: 0]
  |  |  ------------------
  |  |  544|  1.56k|      ? CC_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff)	\
  |  |  ------------------
  |  |  |  |  536|    778|  ((combining_class_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|    778|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (536:4): [True: 778, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  537|    778|   ? (combining_class_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|    778|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  538|    778|   : (cclass_data[combining_class_table_part2[Page]][Char]))
  |  |  ------------------
  |  |  545|  1.56k|      : 0))
  ------------------
  |  Branch (589:9): [True: 46.5k, False: 3.23M]
  ------------------
  590|  46.5k|		    break;
  591|  3.23M|		  t = string[j];
  592|  3.23M|		  string[j] = string[j - 1];
  593|  3.23M|		  string[j - 1] = t;
  594|  3.23M|		  swap = 1;
  595|  3.23M|		}
  596|       |	      /* We're re-entering the loop looking at the old
  597|       |	         character again.  */
  598|  47.8k|	      next = last;
  599|  47.8k|	    }
  600|   106M|	  last = next;
  601|   106M|	}
  602|  3.90M|    }
  603|  3.90M|}
nfkc.c:combine:
  713|  54.8M|{
  714|  54.8M|  gushort index_a, index_b;
  ------------------
  |  |   45|  54.8M|#define gushort unsigned short
  ------------------
  715|       |
  716|  54.8M|  if (combine_hangul (a, b, result))
  ------------------
  |  Branch (716:7): [True: 8.48k, False: 54.8M]
  ------------------
  717|  8.48k|    return TRUE;
  ------------------
  |  |   84|  8.48k|# define	TRUE	(!FALSE)
  |  |  ------------------
  |  |  |  |   80|  8.48k|# define	FALSE	(0)
  |  |  ------------------
  ------------------
  718|       |
  719|  54.8M|  index_a = COMPOSE_INDEX (a);
  ------------------
  |  |  709|  54.8M|  (((Char >> 8) > (COMPOSE_TABLE_LAST)) ? 0 : CI((Char) >> 8, (Char) & 0xff))
  |  |  ------------------
  |  |  |  |   10|  54.8M|#define COMPOSE_TABLE_LAST 48
  |  |  ------------------
  |  |                 (((Char >> 8) > (COMPOSE_TABLE_LAST)) ? 0 : CI((Char) >> 8, (Char) & 0xff))
  |  |  ------------------
  |  |  |  |  704|  54.8M|  ((compose_table[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  54.8M|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (704:4): [True: 25.6k, False: 54.7M]
  |  |  |  |  ------------------
  |  |  |  |  705|  54.8M|   ? (compose_table[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  25.6k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  706|  54.8M|   : (compose_data[compose_table[Page]][Char]))
  |  |  ------------------
  |  |  |  Branch (709:4): [True: 53.4k, False: 54.8M]
  |  |  ------------------
  ------------------
  720|       |
  721|  54.8M|  if (index_a >= COMPOSE_FIRST_SINGLE_START && index_a < COMPOSE_SECOND_START)
  ------------------
  |  |    6|   109M|#define COMPOSE_FIRST_SINGLE_START 147
  ------------------
                if (index_a >= COMPOSE_FIRST_SINGLE_START && index_a < COMPOSE_SECOND_START)
  ------------------
  |  |    7|  6.62M|#define COMPOSE_SECOND_START 357
  ------------------
  |  Branch (721:7): [True: 6.62M, False: 48.2M]
  |  Branch (721:48): [True: 6.62M, False: 1.65k]
  ------------------
  722|  6.62M|    {
  723|  6.62M|      if (b == compose_first_single[index_a - COMPOSE_FIRST_SINGLE_START][0])
  ------------------
  |  |    6|  6.62M|#define COMPOSE_FIRST_SINGLE_START 147
  ------------------
  |  Branch (723:11): [True: 36.1k, False: 6.58M]
  ------------------
  724|  36.1k|	{
  725|  36.1k|	  *result =
  726|  36.1k|	    compose_first_single[index_a - COMPOSE_FIRST_SINGLE_START][1];
  ------------------
  |  |    6|  36.1k|#define COMPOSE_FIRST_SINGLE_START 147
  ------------------
  727|  36.1k|	  return TRUE;
  ------------------
  |  |   84|  36.1k|# define	TRUE	(!FALSE)
  |  |  ------------------
  |  |  |  |   80|  36.1k|# define	FALSE	(0)
  |  |  ------------------
  ------------------
  728|  36.1k|	}
  729|  6.58M|      else
  730|  6.58M|	return FALSE;
  ------------------
  |  |   80|  6.58M|# define	FALSE	(0)
  ------------------
  731|  6.62M|    }
  732|       |
  733|  48.2M|  index_b = COMPOSE_INDEX (b);
  ------------------
  |  |  709|  48.2M|  (((Char >> 8) > (COMPOSE_TABLE_LAST)) ? 0 : CI((Char) >> 8, (Char) & 0xff))
  |  |  ------------------
  |  |  |  |   10|  48.2M|#define COMPOSE_TABLE_LAST 48
  |  |  ------------------
  |  |                 (((Char >> 8) > (COMPOSE_TABLE_LAST)) ? 0 : CI((Char) >> 8, (Char) & 0xff))
  |  |  ------------------
  |  |  |  |  704|  48.1M|  ((compose_table[Page] >= G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  48.1M|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (704:4): [True: 30.7k, False: 48.1M]
  |  |  |  |  ------------------
  |  |  |  |  705|  48.1M|   ? (compose_table[Page] - G_UNICODE_MAX_TABLE_INDEX)	\
  |  |  |  |  ------------------
  |  |  |  |  |  |   10|  30.7k|#define G_UNICODE_MAX_TABLE_INDEX (0x110000 / 256)
  |  |  |  |  ------------------
  |  |  |  |  706|  48.1M|   : (compose_data[compose_table[Page]][Char]))
  |  |  ------------------
  |  |  |  Branch (709:4): [True: 46.4k, False: 48.1M]
  |  |  ------------------
  ------------------
  734|       |
  735|  48.2M|  if (index_b >= COMPOSE_SECOND_SINGLE_START)
  ------------------
  |  |    8|  48.2M|#define COMPOSE_SECOND_SINGLE_START 388
  ------------------
  |  Branch (735:7): [True: 21.4k, False: 48.2M]
  ------------------
  736|  21.4k|    {
  737|  21.4k|      if (a ==
  ------------------
  |  Branch (737:11): [True: 20.6k, False: 800]
  ------------------
  738|  21.4k|	  compose_second_single[index_b - COMPOSE_SECOND_SINGLE_START][0])
  ------------------
  |  |    8|  21.4k|#define COMPOSE_SECOND_SINGLE_START 388
  ------------------
  739|  20.6k|	{
  740|  20.6k|	  *result =
  741|  20.6k|	    compose_second_single[index_b - COMPOSE_SECOND_SINGLE_START][1];
  ------------------
  |  |    8|  20.6k|#define COMPOSE_SECOND_SINGLE_START 388
  ------------------
  742|  20.6k|	  return TRUE;
  ------------------
  |  |   84|  20.6k|# define	TRUE	(!FALSE)
  |  |  ------------------
  |  |  |  |   80|  20.6k|# define	FALSE	(0)
  |  |  ------------------
  ------------------
  743|  20.6k|	}
  744|    800|      else
  745|    800|	return FALSE;
  ------------------
  |  |   80|    800|# define	FALSE	(0)
  ------------------
  746|  21.4k|    }
  747|       |
  748|  48.2M|  if (index_a >= COMPOSE_FIRST_START && index_a < COMPOSE_FIRST_SINGLE_START
  ------------------
  |  |    5|  96.4M|#define COMPOSE_FIRST_START 1
  ------------------
                if (index_a >= COMPOSE_FIRST_START && index_a < COMPOSE_FIRST_SINGLE_START
  ------------------
  |  |    6|  51.3M|#define COMPOSE_FIRST_SINGLE_START 147
  ------------------
  |  Branch (748:7): [True: 3.17M, False: 45.0M]
  |  Branch (748:41): [True: 3.17M, False: 1.65k]
  ------------------
  749|  48.2M|      && index_b >= COMPOSE_SECOND_START
  ------------------
  |  |    7|  51.3M|#define COMPOSE_SECOND_START 357
  ------------------
  |  Branch (749:10): [True: 15.4k, False: 3.16M]
  ------------------
  750|  48.2M|      && index_b < COMPOSE_SECOND_SINGLE_START)
  ------------------
  |  |    8|  15.4k|#define COMPOSE_SECOND_SINGLE_START 388
  ------------------
  |  Branch (750:10): [True: 15.4k, False: 0]
  ------------------
  751|  15.4k|    {
  752|  15.4k|      gunichar res =
  ------------------
  |  |   48|  15.4k|#define gunichar uint32_t
  ------------------
  753|  15.4k|	compose_array[index_a - COMPOSE_FIRST_START][index_b -
  ------------------
  |  |    5|  15.4k|#define COMPOSE_FIRST_START 1
  ------------------
  754|  15.4k|						     COMPOSE_SECOND_START];
  ------------------
  |  |    7|  15.4k|#define COMPOSE_SECOND_START 357
  ------------------
  755|       |
  756|  15.4k|      if (res)
  ------------------
  |  Branch (756:11): [True: 14.0k, False: 1.36k]
  ------------------
  757|  14.0k|	{
  758|  14.0k|	  *result = res;
  759|  14.0k|	  return TRUE;
  ------------------
  |  |   84|  14.0k|# define	TRUE	(!FALSE)
  |  |  ------------------
  |  |  |  |   80|  14.0k|# define	FALSE	(0)
  |  |  ------------------
  ------------------
  760|  14.0k|	}
  761|  15.4k|    }
  762|       |
  763|  48.2M|  return FALSE;
  ------------------
  |  |   80|  48.2M|# define	FALSE	(0)
  ------------------
  764|  48.2M|}
nfkc.c:combine_hangul:
  677|  54.8M|{
  678|  54.8M|  if (a >= LBase && a < LCount + LBase && b >= VBase && b < VCount + VBase)
  ------------------
  |  |  549|   109M|#define LBase 0x1100
  ------------------
                if (a >= LBase && a < LCount + LBase && b >= VBase && b < VCount + VBase)
  ------------------
  |  |  552|  2.87M|#define LCount 19
  ------------------
                if (a >= LBase && a < LCount + LBase && b >= VBase && b < VCount + VBase)
  ------------------
  |  |  549|  57.7M|#define LBase 0x1100
  ------------------
                if (a >= LBase && a < LCount + LBase && b >= VBase && b < VCount + VBase)
  ------------------
  |  |  550|  54.8M|#define VBase 0x1161
  ------------------
                if (a >= LBase && a < LCount + LBase && b >= VBase && b < VCount + VBase)
  ------------------
  |  |  553|  6.23k|#define VCount 21
  ------------------
                if (a >= LBase && a < LCount + LBase && b >= VBase && b < VCount + VBase)
  ------------------
  |  |  550|  6.23k|#define VBase 0x1161
  ------------------
  |  Branch (678:7): [True: 2.87M, False: 51.9M]
  |  Branch (678:21): [True: 7.88k, False: 2.86M]
  |  Branch (678:43): [True: 6.23k, False: 1.64k]
  |  Branch (678:57): [True: 5.18k, False: 1.05k]
  ------------------
  679|  5.18k|    {
  680|  5.18k|      gint LIndex = a - LBase;
  ------------------
  |  |   43|  5.18k|#define gint int
  ------------------
                    gint LIndex = a - LBase;
  ------------------
  |  |  549|  5.18k|#define LBase 0x1100
  ------------------
  681|  5.18k|      gint VIndex = b - VBase;
  ------------------
  |  |   43|  5.18k|#define gint int
  ------------------
                    gint VIndex = b - VBase;
  ------------------
  |  |  550|  5.18k|#define VBase 0x1161
  ------------------
  682|       |
  683|  5.18k|      *result = SBase + (LIndex * VCount + VIndex) * TCount;
  ------------------
  |  |  548|  5.18k|#define SBase 0xAC00
  ------------------
                    *result = SBase + (LIndex * VCount + VIndex) * TCount;
  ------------------
  |  |  553|  5.18k|#define VCount 21
  ------------------
                    *result = SBase + (LIndex * VCount + VIndex) * TCount;
  ------------------
  |  |  554|  5.18k|#define TCount 28
  ------------------
  684|  5.18k|      return TRUE;
  ------------------
  |  |   84|  5.18k|# define	TRUE	(!FALSE)
  |  |  ------------------
  |  |  |  |   80|  5.18k|# define	FALSE	(0)
  |  |  ------------------
  ------------------
  685|  5.18k|    }
  686|       |
  687|  54.8M|  if (a >= SBase && a < SCount + SBase && b > TBase && b < TCount + TBase)
  ------------------
  |  |  548|   109M|#define SBase 0xAC00
  ------------------
                if (a >= SBase && a < SCount + SBase && b > TBase && b < TCount + TBase)
  ------------------
  |  |  556|  31.0k|#define SCount (LCount * NCount)
  |  |  ------------------
  |  |  |  |  552|  31.0k|#define LCount 19
  |  |  ------------------
  |  |               #define SCount (LCount * NCount)
  |  |  ------------------
  |  |  |  |  555|  31.0k|#define NCount (VCount * TCount)
  |  |  |  |  ------------------
  |  |  |  |  |  |  553|  31.0k|#define VCount 21
  |  |  |  |  ------------------
  |  |  |  |               #define NCount (VCount * TCount)
  |  |  |  |  ------------------
  |  |  |  |  |  |  554|  31.0k|#define TCount 28
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                if (a >= SBase && a < SCount + SBase && b > TBase && b < TCount + TBase)
  ------------------
  |  |  548|  54.8M|#define SBase 0xAC00
  ------------------
                if (a >= SBase && a < SCount + SBase && b > TBase && b < TCount + TBase)
  ------------------
  |  |  551|  54.8M|#define TBase 0x11A7
  ------------------
                if (a >= SBase && a < SCount + SBase && b > TBase && b < TCount + TBase)
  ------------------
  |  |  554|  5.60k|#define TCount 28
  ------------------
                if (a >= SBase && a < SCount + SBase && b > TBase && b < TCount + TBase)
  ------------------
  |  |  551|  5.60k|#define TBase 0x11A7
  ------------------
  |  Branch (687:7): [True: 31.0k, False: 54.8M]
  |  Branch (687:21): [True: 8.09k, False: 22.9k]
  |  Branch (687:43): [True: 5.60k, False: 2.49k]
  |  Branch (687:56): [True: 4.10k, False: 1.49k]
  ------------------
  688|  4.10k|    {
  689|  4.10k|      gint SIndex = a - SBase;
  ------------------
  |  |   43|  4.10k|#define gint int
  ------------------
                    gint SIndex = a - SBase;
  ------------------
  |  |  548|  4.10k|#define SBase 0xAC00
  ------------------
  690|       |
  691|  4.10k|      if ((SIndex % TCount) == 0)
  ------------------
  |  |  554|  4.10k|#define TCount 28
  ------------------
  |  Branch (691:11): [True: 3.30k, False: 804]
  ------------------
  692|  3.30k|	{
  693|  3.30k|	  gint TIndex = b - TBase;
  ------------------
  |  |   43|  3.30k|#define gint int
  ------------------
              	  gint TIndex = b - TBase;
  ------------------
  |  |  551|  3.30k|#define TBase 0x11A7
  ------------------
  694|       |
  695|  3.30k|	  *result = a + TIndex;
  696|  3.30k|	  return TRUE;
  ------------------
  |  |   84|  3.30k|# define	TRUE	(!FALSE)
  |  |  ------------------
  |  |  |  |   80|  3.30k|# define	FALSE	(0)
  |  |  ------------------
  ------------------
  697|  3.30k|	}
  698|  4.10k|    }
  699|       |
  700|  54.8M|  return FALSE;
  ------------------
  |  |   80|  54.8M|# define	FALSE	(0)
  ------------------
  701|  54.8M|}

punycode_encode:
  200|  2.92k|{
  201|  2.92k|  punycode_uint input_len, n, delta, h, b, bias, j, m, q, k, t;
  202|  2.92k|  size_t out, max_out;
  203|       |
  204|       |  /* The Punycode spec assumes that the input length is the same type */
  205|       |  /* of integer as a code point, so we need to convert the size_t to  */
  206|       |  /* a punycode_uint, which could overflow.                           */
  207|       |
  208|  2.92k|  if (input_length > maxint)
  ------------------
  |  Branch (208:7): [True: 0, False: 2.92k]
  ------------------
  209|      0|    return punycode_overflow;
  210|  2.92k|  input_len = (punycode_uint) input_length;
  211|       |
  212|       |  /* Initialize the state: */
  213|       |
  214|  2.92k|  n = initial_n;
  215|  2.92k|  delta = 0;
  216|  2.92k|  out = 0;
  217|  2.92k|  max_out = *output_length;
  218|  2.92k|  bias = initial_bias;
  219|       |
  220|       |  /* Handle the basic code points: */
  221|       |
  222|  62.3k|  for (j = 0; j < input_len; ++j)
  ------------------
  |  Branch (222:15): [True: 59.7k, False: 2.64k]
  ------------------
  223|  59.7k|    {
  224|  59.7k|      if (basic (input[j]))
  ------------------
  |  |   82|  59.7k|#define basic(cp) ((punycode_uint)(cp) < 0x80)
  |  |  ------------------
  |  |  |  Branch (82:19): [True: 22.1k, False: 37.5k]
  |  |  ------------------
  ------------------
  225|  22.1k|	{
  226|  22.1k|	  if (max_out - out < 2)
  ------------------
  |  Branch (226:8): [True: 284, False: 21.8k]
  ------------------
  227|    284|	    return punycode_big_output;
  228|  21.8k|	  output[out++] = case_flags ?
  ------------------
  |  Branch (228:20): [True: 0, False: 21.8k]
  ------------------
  229|  21.8k|	    encode_basic (input[j], case_flags[j]) : (char) input[j];
  230|  21.8k|	}
  231|  37.5k|      else if (input[j] > 0x10FFFF
  ------------------
  |  Branch (231:16): [True: 0, False: 37.5k]
  ------------------
  232|  37.5k|	       || (input[j] >= 0xD800 && input[j] <= 0xDBFF))
  ------------------
  |  Branch (232:13): [True: 2.03k, False: 35.5k]
  |  Branch (232:35): [True: 0, False: 2.03k]
  ------------------
  233|      0|	return punycode_bad_input;
  234|       |      /* else if (input[j] < n) return punycode_bad_input; */
  235|       |      /* (not needed for Punycode with unsigned code points) */
  236|  59.7k|    }
  237|       |
  238|  2.64k|  h = b = (punycode_uint) out;
  239|       |  /* cannot overflow because out <= input_len <= maxint */
  240|       |
  241|       |  /* h is the number of code points that have been handled, b is the  */
  242|       |  /* number of basic code points, and out is the number of ASCII code */
  243|       |  /* points that have been output.                                    */
  244|       |
  245|  2.64k|  if (b > 0)
  ------------------
  |  Branch (245:7): [True: 774, False: 1.86k]
  ------------------
  246|    774|    output[out++] = delimiter;
  247|       |
  248|       |  /* Main encoding loop: */
  249|       |
  250|  19.9k|  while (h < input_len)
  ------------------
  |  Branch (250:10): [True: 17.7k, False: 2.17k]
  ------------------
  251|  17.7k|    {
  252|       |      /* All non-basic code points < n have been     */
  253|       |      /* handled already.  Find the next larger one: */
  254|       |
  255|   586k|      for (m = maxint, j = 0; j < input_len; ++j)
  ------------------
  |  Branch (255:31): [True: 568k, False: 17.7k]
  ------------------
  256|   568k|	{
  257|       |	  /* if (basic(input[j])) continue; */
  258|       |	  /* (not needed for Punycode) */
  259|   568k|	  if (input[j] >= n && input[j] < m)
  ------------------
  |  Branch (259:8): [True: 318k, False: 249k]
  |  Branch (259:25): [True: 41.2k, False: 277k]
  ------------------
  260|  41.2k|	    m = input[j];
  261|   568k|	}
  262|       |
  263|       |      /* Increase delta enough to advance the decoder's    */
  264|       |      /* <n,i> state to <m,0>, but guard against overflow: */
  265|       |
  266|  17.7k|      if (m - n > (maxint - delta) / (h + 1))
  ------------------
  |  Branch (266:11): [True: 0, False: 17.7k]
  ------------------
  267|      0|	return punycode_overflow;
  268|  17.7k|      delta += (m - n) * (h + 1);
  269|  17.7k|      n = m;
  270|       |
  271|   577k|      for (j = 0; j < input_len; ++j)
  ------------------
  |  Branch (271:19): [True: 560k, False: 17.2k]
  ------------------
  272|   560k|	{
  273|       |	  /* Punycode does not need to check whether input[j] is basic: */
  274|   560k|	  if (input[j] < n /* || basic(input[j]) */ )
  ------------------
  |  Branch (274:8): [True: 241k, False: 318k]
  ------------------
  275|   241k|	    {
  276|   241k|	      if (++delta == 0)
  ------------------
  |  Branch (276:12): [True: 0, False: 241k]
  ------------------
  277|      0|		return punycode_overflow;
  278|   241k|	    }
  279|       |
  280|   560k|	  if (input[j] == n)
  ------------------
  |  Branch (280:8): [True: 36.5k, False: 523k]
  ------------------
  281|  36.5k|	    {
  282|       |	      /* Represent delta as a generalized variable-length integer: */
  283|       |
  284|  36.5k|	      for (q = delta, k = base;; k += base)
  285|  57.1k|		{
  286|  57.1k|		  if (out >= max_out)
  ------------------
  |  Branch (286:9): [True: 465, False: 56.6k]
  ------------------
  287|    465|		    return punycode_big_output;
  288|  56.6k|		  t = k <= bias /* + tmin */ ? tmin :	/* +tmin not needed */
  ------------------
  |  Branch (288:9): [True: 7.10k, False: 49.5k]
  ------------------
  289|  56.6k|		    k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (289:7): [True: 40.4k, False: 9.09k]
  ------------------
  290|  56.6k|		  if (q < t)
  ------------------
  |  Branch (290:9): [True: 36.1k, False: 20.5k]
  ------------------
  291|  36.1k|		    break;
  292|  20.5k|		  output[out++] = encode_digit (t + (q - t) % (base - t), 0);
  293|  20.5k|		  q = (q - t) / (base - t);
  294|  20.5k|		}
  295|       |
  296|  36.1k|	      output[out++] = encode_digit (q, case_flags && case_flags[j]);
  ------------------
  |  Branch (296:41): [True: 0, False: 36.1k]
  |  Branch (296:55): [True: 0, False: 0]
  ------------------
  297|  36.1k|	      bias = adapt (delta, h + 1, h == b);
  298|  36.1k|	      delta = 0;
  299|  36.1k|	      ++h;
  300|  36.1k|	    }
  301|   560k|	}
  302|       |
  303|  17.2k|      ++delta, ++n;
  304|  17.2k|    }
  305|       |
  306|  2.17k|  *output_length = out;
  307|  2.17k|  return punycode_success;
  308|  2.64k|}
punycode_decode:
  352|  14.6k|{
  353|  14.6k|  punycode_uint n, out, i, max_out, bias, oldi, w, k, digit, t;
  354|  14.6k|  size_t b, j, in;
  355|       |
  356|       |  /* Initialize the state: */
  357|       |
  358|  14.6k|  n = initial_n;
  359|  14.6k|  out = i = 0;
  360|  14.6k|  max_out = *output_length > maxint ? maxint
  ------------------
  |  Branch (360:13): [True: 0, False: 14.6k]
  ------------------
  361|  14.6k|    : (punycode_uint) * output_length;
  362|  14.6k|  bias = initial_bias;
  363|       |
  364|       |  /* Handle the basic code points:  Let b be the number of input code */
  365|       |  /* points before the last delimiter, or 0 if there is none, then    */
  366|       |  /* copy the first b code points to the output.                      */
  367|       |
  368|   461k|  for (b = j = 0; j < input_length; ++j)
  ------------------
  |  Branch (368:19): [True: 446k, False: 14.6k]
  ------------------
  369|   446k|    if (delim (input[j]))
  ------------------
  |  |   85|   446k|#define delim(cp) ((cp) == delimiter)
  |  |  ------------------
  |  |  |  Branch (85:19): [True: 9.60k, False: 437k]
  |  |  ------------------
  ------------------
  370|  9.60k|      b = j;
  371|  14.6k|  if (b > max_out)
  ------------------
  |  Branch (371:7): [True: 310, False: 14.3k]
  ------------------
  372|    310|    return punycode_big_output;
  373|       |
  374|  64.4k|  for (j = 0; j < b; ++j)
  ------------------
  |  Branch (374:15): [True: 50.3k, False: 14.1k]
  ------------------
  375|  50.3k|    {
  376|  50.3k|      if (case_flags)
  ------------------
  |  Branch (376:11): [True: 0, False: 50.3k]
  ------------------
  377|      0|	case_flags[out] = flagged (input[j]);
  ------------------
  |  |  116|      0|#define flagged(bcp) ((punycode_uint)(bcp) - 65 < 26)
  ------------------
  378|  50.3k|      if (!basic (input[j]))
  ------------------
  |  |   82|  50.3k|#define basic(cp) ((punycode_uint)(cp) < 0x80)
  ------------------
  |  Branch (378:11): [True: 236, False: 50.1k]
  ------------------
  379|    236|	return punycode_bad_input;
  380|  50.1k|      output[out++] = input[j];
  381|  50.1k|    }
  382|   284k|  for (j = b + (b > 0); j < input_length; ++j)
  ------------------
  |  Branch (382:25): [True: 270k, False: 13.8k]
  ------------------
  383|   270k|    if (!basic (input[j]))
  ------------------
  |  |   82|   270k|#define basic(cp) ((punycode_uint)(cp) < 0x80)
  ------------------
  |  Branch (383:9): [True: 294, False: 270k]
  ------------------
  384|    294|      return punycode_bad_input;
  385|       |
  386|       |  /* Main decoding loop:  Start just after the last delimiter if any  */
  387|       |  /* basic code points were copied; start at the beginning otherwise. */
  388|       |
  389|   245k|  for (in = b > 0 ? b + 1 : 0; in < input_length; ++out)
  ------------------
  |  Branch (389:13): [True: 4.86k, False: 8.96k]
  |  Branch (389:32): [True: 234k, False: 11.1k]
  ------------------
  390|   234k|    {
  391|       |
  392|       |      /* in is the index of the next ASCII code point to be consumed, */
  393|       |      /* and out is the number of code points in the output array.    */
  394|       |
  395|       |      /* Decode a generalized variable-length integer into delta,  */
  396|       |      /* which gets added to i.  The overflow checking is easier   */
  397|       |      /* if we increase i as we go, then subtract off its starting */
  398|       |      /* value at the end to obtain delta.                         */
  399|       |
  400|   234k|      for (oldi = i, w = 1, k = base;; k += base)
  401|   268k|	{
  402|   268k|	  if (in >= input_length)
  ------------------
  |  Branch (402:8): [True: 518, False: 267k]
  ------------------
  403|    518|	    return punycode_bad_input;
  404|   267k|	  digit = decode_digit (input[in++]);
  405|   267k|	  if (digit >= base)
  ------------------
  |  Branch (405:8): [True: 294, False: 267k]
  ------------------
  406|    294|	    return punycode_bad_input;
  407|   267k|	  if (digit > (maxint - i) / w)
  ------------------
  |  Branch (407:8): [True: 222, False: 267k]
  ------------------
  408|    222|	    return punycode_overflow;
  409|   267k|	  i += digit * w;
  410|   267k|	  t = k <= bias /* + tmin */ ? tmin :	/* +tmin not needed */
  ------------------
  |  Branch (410:8): [True: 19.6k, False: 247k]
  ------------------
  411|   267k|	    k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (411:6): [True: 241k, False: 5.91k]
  ------------------
  412|   267k|	  if (digit < t)
  ------------------
  |  Branch (412:8): [True: 233k, False: 34.1k]
  ------------------
  413|   233k|	    break;
  414|  34.1k|	  if (w > maxint / (base - t))
  ------------------
  |  Branch (414:8): [True: 0, False: 34.1k]
  ------------------
  415|      0|	    return punycode_overflow;
  416|  34.1k|	  w *= (base - t);
  417|  34.1k|	}
  418|       |
  419|   233k|      bias = adapt (i - oldi, out + 1, oldi == 0);
  420|       |
  421|       |      /* i was supposed to wrap around from out+1 to 0,   */
  422|       |      /* incrementing n each time, so we'll fix that now: */
  423|       |
  424|   233k|      if (i / (out + 1) > maxint - n)
  ------------------
  |  Branch (424:11): [True: 550, False: 232k]
  ------------------
  425|    550|	return punycode_overflow;
  426|   232k|      n += i / (out + 1);
  427|   232k|      if (n > 0x10FFFF || (n >= 0xD800 && n <= 0xDBFF))
  ------------------
  |  Branch (427:11): [True: 602, False: 231k]
  |  Branch (427:28): [True: 142k, False: 89.6k]
  |  Branch (427:43): [True: 272, False: 141k]
  ------------------
  428|    874|	return punycode_bad_input;
  429|   231k|      i %= (out + 1);
  430|       |
  431|       |      /* Insert n at position i of the output: */
  432|       |
  433|       |      /* not needed for Punycode: */
  434|       |      /* if (basic(n)) return punycode_bad_input; */
  435|   231k|      if (out >= max_out)
  ------------------
  |  Branch (435:11): [True: 204, False: 231k]
  ------------------
  436|    204|	return punycode_big_output;
  437|       |
  438|   231k|      if (case_flags)
  ------------------
  |  Branch (438:11): [True: 0, False: 231k]
  ------------------
  439|      0|	{
  440|      0|	  memmove (case_flags + i + 1, case_flags + i, out - i);
  441|       |	  /* Case of last ASCII code point determines case flag: */
  442|      0|	  case_flags[i] = flagged (input[in - 1]);
  ------------------
  |  |  116|      0|#define flagged(bcp) ((punycode_uint)(bcp) - 65 < 26)
  ------------------
  443|      0|	}
  444|       |
  445|   231k|      memmove (output + i + 1, output + i, (out - i) * sizeof *output);
  446|   231k|      output[i++] = n;
  447|   231k|    }
  448|       |
  449|  11.1k|  *output_length = (size_t) out;
  450|       |  /* cannot overflow because out <= old value of *output_length */
  451|  11.1k|  return punycode_success;
  452|  13.8k|}
punycode.c:encode_digit:
  106|  56.6k|{
  107|  56.6k|  return d + 22 + 75 * (d < 26) - ((flag != 0) << 5);
  108|       |  /*  0..25 map to ASCII a..z or A..Z */
  109|       |  /* 26..35 map to ASCII 0..9         */
  110|  56.6k|}
punycode.c:adapt:
  141|   269k|{
  142|   269k|  punycode_uint k;
  143|       |
  144|   269k|  delta = firsttime ? delta / damp : delta >> 1;
  ------------------
  |  Branch (144:11): [True: 10.8k, False: 258k]
  ------------------
  145|       |  /* delta >> 1 is a faster way of doing delta / 2 */
  146|   269k|  delta += delta / numpoints;
  147|       |
  148|   279k|  for (k = 0; delta > ((base - tmin) * tmax) / 2; k += base)
  ------------------
  |  Branch (148:15): [True: 9.95k, False: 269k]
  ------------------
  149|  9.95k|    {
  150|  9.95k|      delta /= base - tmin;
  151|  9.95k|    }
  152|       |
  153|   269k|  return k + (base - tmin + 1) * delta / (delta + skew);
  154|   269k|}
punycode.c:decode_digit:
   93|   267k|{
   94|   267k|  return (unsigned) (cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 :
  ------------------
  |  Branch (94:22): [True: 66.8k, False: 200k]
  |  Branch (94:47): [True: 93.8k, False: 107k]
  ------------------
   95|   200k|		     cp - 97 < 26 ? cp - 97 : base);
  ------------------
  |  Branch (95:8): [True: 106k, False: 212]
  ------------------
   96|   267k|}

stringprep_4i:
  184|   111k|{
  185|   111k|  size_t i, j;
  186|   111k|  ssize_t k;
  187|   111k|  size_t ucs4len = *len;
  188|   111k|  int rc;
  189|       |
  190|   783k|  for (i = 0; profile[i].operation; i++)
  ------------------
  |  Branch (190:15): [True: 755k, False: 27.2k]
  ------------------
  191|   755k|    {
  192|   755k|      switch (profile[i].operation)
  193|   755k|	{
  194|   108k|	case STRINGPREP_NFKC:
  ------------------
  |  Branch (194:2): [True: 108k, False: 647k]
  ------------------
  195|   108k|	  {
  196|   108k|	    uint32_t *q = 0;
  197|       |
  198|   108k|	    if (UNAPPLICAPLEFLAGS (flags, profile[i].flags))
  ------------------
  |  |  146|   108k|  ((!INVERTED(profileflags) && !(profileflags & flags) && profileflags) || \
  |  |  ------------------
  |  |  |  |  144|   217k|#define INVERTED(x) ((x) & ((~0UL) >> 1))
  |  |  ------------------
  |  |  |  Branch (146:5): [True: 108k, False: 0]
  |  |  |  Branch (146:32): [True: 108k, False: 0]
  |  |  |  Branch (146:59): [True: 0, False: 108k]
  |  |  ------------------
  |  |  147|   108k|   ( INVERTED(profileflags) && (profileflags & flags)))
  |  |  ------------------
  |  |  |  |  144|   217k|#define INVERTED(x) ((x) & ((~0UL) >> 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:21): [True: 0, False: 108k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (147:32): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  199|      0|	      break;
  200|       |
  201|   108k|	    if (flags & STRINGPREP_NO_NFKC && !profile[i].flags)
  ------------------
  |  Branch (201:10): [True: 0, False: 108k]
  |  Branch (201:40): [True: 0, False: 0]
  ------------------
  202|       |	      /* Profile requires NFKC, but callee asked for no NFKC. */
  203|      0|	      return STRINGPREP_FLAG_ERROR;
  204|       |
  205|   108k|	    q = stringprep_ucs4_nfkc_normalize (ucs4, ucs4len);
  206|   108k|	    if (!q)
  ------------------
  |  Branch (206:10): [True: 0, False: 108k]
  ------------------
  207|      0|	      return STRINGPREP_NFKC_FAILED;
  208|       |
  209|  55.1M|	    for (ucs4len = 0; q[ucs4len]; ucs4len++)
  ------------------
  |  Branch (209:24): [True: 54.9M, False: 108k]
  ------------------
  210|  54.9M|	      ;
  211|       |
  212|   108k|	    if (ucs4len >= maxucs4len)
  ------------------
  |  Branch (212:10): [True: 76.7k, False: 32.0k]
  ------------------
  213|  76.7k|	      {
  214|  76.7k|		free (q);
  215|  76.7k|		return STRINGPREP_TOO_SMALL_BUFFER;
  216|  76.7k|	      }
  217|       |
  218|  32.0k|	    memcpy (ucs4, q, ucs4len * sizeof (ucs4[0]));
  219|       |
  220|  32.0k|	    free (q);
  221|  32.0k|	  }
  222|      0|	  break;
  223|       |
  224|   278k|	case STRINGPREP_PROHIBIT_TABLE:
  ------------------
  |  Branch (224:2): [True: 278k, False: 477k]
  ------------------
  225|   278k|	  k = stringprep_find_string_in_table (ucs4, ucs4len,
  226|   278k|					       NULL, profile[i].table,
  227|   278k|					       profile[i].table_size);
  228|   278k|	  if (k != -1)
  ------------------
  |  Branch (228:8): [True: 1.73k, False: 276k]
  ------------------
  229|  1.73k|	    return STRINGPREP_CONTAINS_PROHIBITED;
  230|   276k|	  break;
  231|       |
  232|   276k|	case STRINGPREP_UNASSIGNED_TABLE:
  ------------------
  |  Branch (232:2): [True: 29.1k, False: 726k]
  ------------------
  233|  29.1k|	  if (UNAPPLICAPLEFLAGS (flags, profile[i].flags))
  ------------------
  |  |  146|  29.1k|  ((!INVERTED(profileflags) && !(profileflags & flags) && profileflags) || \
  |  |  ------------------
  |  |  |  |  144|  58.3k|#define INVERTED(x) ((x) & ((~0UL) >> 1))
  |  |  ------------------
  |  |  |  Branch (146:5): [True: 0, False: 29.1k]
  |  |  |  Branch (146:32): [True: 0, False: 0]
  |  |  |  Branch (146:59): [True: 0, False: 0]
  |  |  ------------------
  |  |  147|  29.1k|   ( INVERTED(profileflags) && (profileflags & flags)))
  |  |  ------------------
  |  |  |  |  144|  58.3k|#define INVERTED(x) ((x) & ((~0UL) >> 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:21): [True: 29.1k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (147:32): [True: 0, False: 29.1k]
  |  |  ------------------
  ------------------
  234|      0|	    break;
  235|  29.1k|	  if (flags & STRINGPREP_NO_UNASSIGNED)
  ------------------
  |  Branch (235:8): [True: 13.7k, False: 15.4k]
  ------------------
  236|  13.7k|	    {
  237|  13.7k|	      k = stringprep_find_string_in_table
  238|  13.7k|		(ucs4, ucs4len, NULL, profile[i].table,
  239|  13.7k|		 profile[i].table_size);
  240|  13.7k|	      if (k != -1)
  ------------------
  |  Branch (240:12): [True: 1.92k, False: 11.7k]
  ------------------
  241|  1.92k|		return STRINGPREP_CONTAINS_UNASSIGNED;
  242|  13.7k|	    }
  243|  27.2k|	  break;
  244|       |
  245|   222k|	case STRINGPREP_MAP_TABLE:
  ------------------
  |  Branch (245:2): [True: 222k, False: 533k]
  ------------------
  246|   222k|	  if (UNAPPLICAPLEFLAGS (flags, profile[i].flags))
  ------------------
  |  |  146|   222k|  ((!INVERTED(profileflags) && !(profileflags & flags) && profileflags) || \
  |  |  ------------------
  |  |  |  |  144|   444k|#define INVERTED(x) ((x) & ((~0UL) >> 1))
  |  |  ------------------
  |  |  |  Branch (146:5): [True: 222k, False: 0]
  |  |  |  Branch (146:32): [True: 222k, False: 0]
  |  |  |  Branch (146:59): [True: 0, False: 222k]
  |  |  ------------------
  |  |  147|   222k|   ( INVERTED(profileflags) && (profileflags & flags)))
  |  |  ------------------
  |  |  |  |  144|   444k|#define INVERTED(x) ((x) & ((~0UL) >> 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:21): [True: 0, False: 222k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (147:32): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  247|      0|	    break;
  248|   222k|	  rc = stringprep_apply_table_to_string
  249|   222k|	    (ucs4, &ucs4len, maxucs4len, profile[i].table,
  250|   222k|	     profile[i].table_size);
  251|   222k|	  if (rc != STRINGPREP_OK)
  ------------------
  |  Branch (251:8): [True: 2.35k, False: 219k]
  ------------------
  252|  2.35k|	    return rc;
  253|   219k|	  break;
  254|       |
  255|   219k|	case STRINGPREP_BIDI_PROHIBIT_TABLE:
  ------------------
  |  Branch (255:2): [True: 29.1k, False: 726k]
  ------------------
  256|  58.3k|	case STRINGPREP_BIDI_RAL_TABLE:
  ------------------
  |  Branch (256:2): [True: 29.1k, False: 726k]
  ------------------
  257|  87.4k|	case STRINGPREP_BIDI_L_TABLE:
  ------------------
  |  Branch (257:2): [True: 29.1k, False: 726k]
  ------------------
  258|  87.4k|	  break;
  259|       |
  260|  30.2k|	case STRINGPREP_BIDI:
  ------------------
  |  Branch (260:2): [True: 30.2k, False: 725k]
  ------------------
  261|  30.2k|	  {
  262|  30.2k|	    int done_prohibited = 0;
  263|  30.2k|	    int done_ral = 0;
  264|  30.2k|	    int done_l = 0;
  265|  30.2k|	    size_t contains_ral = SIZE_MAX;
  266|  30.2k|	    size_t contains_l = SIZE_MAX;
  267|       |
  268|   544k|	    for (j = 0; profile[j].operation; j++)
  ------------------
  |  Branch (268:18): [True: 514k, False: 30.2k]
  ------------------
  269|   514k|	      if (profile[j].operation == STRINGPREP_BIDI_PROHIBIT_TABLE)
  ------------------
  |  Branch (269:12): [True: 30.2k, False: 484k]
  ------------------
  270|  30.2k|		{
  271|  30.2k|		  done_prohibited = 1;
  272|  30.2k|		  k = stringprep_find_string_in_table (ucs4, ucs4len,
  273|  30.2k|						       NULL,
  274|  30.2k|						       profile[j].table,
  275|  30.2k|						       profile[j].table_size);
  276|  30.2k|		  if (k != -1)
  ------------------
  |  Branch (276:9): [True: 0, False: 30.2k]
  ------------------
  277|      0|		    return STRINGPREP_BIDI_CONTAINS_PROHIBITED;
  278|  30.2k|		}
  279|   484k|	      else if (profile[j].operation == STRINGPREP_BIDI_RAL_TABLE)
  ------------------
  |  Branch (279:17): [True: 30.2k, False: 454k]
  ------------------
  280|  30.2k|		{
  281|  30.2k|		  done_ral = 1;
  282|  30.2k|		  if (stringprep_find_string_in_table
  ------------------
  |  Branch (282:9): [True: 9.89k, False: 20.3k]
  ------------------
  283|  30.2k|		      (ucs4, ucs4len, NULL, profile[j].table,
  284|  30.2k|		       profile[j].table_size) != -1)
  285|  9.89k|		    contains_ral = j;
  286|  30.2k|		}
  287|   454k|	      else if (profile[j].operation == STRINGPREP_BIDI_L_TABLE)
  ------------------
  |  Branch (287:17): [True: 30.2k, False: 423k]
  ------------------
  288|  30.2k|		{
  289|  30.2k|		  done_l = 1;
  290|  30.2k|		  if (stringprep_find_string_in_table
  ------------------
  |  Branch (290:9): [True: 16.0k, False: 14.2k]
  ------------------
  291|  30.2k|		      (ucs4, ucs4len, NULL, profile[j].table,
  292|  30.2k|		       profile[j].table_size) != -1)
  293|  16.0k|		    contains_l = j;
  294|  30.2k|		}
  295|       |
  296|  30.2k|	    if (!done_prohibited || !done_ral || !done_l)
  ------------------
  |  Branch (296:10): [True: 0, False: 30.2k]
  |  Branch (296:30): [True: 0, False: 30.2k]
  |  Branch (296:43): [True: 0, False: 30.2k]
  ------------------
  297|      0|	      return STRINGPREP_PROFILE_ERROR;
  298|       |
  299|  30.2k|	    if (contains_ral != SIZE_MAX && contains_l != SIZE_MAX)
  ------------------
  |  Branch (299:10): [True: 9.89k, False: 20.3k]
  |  Branch (299:38): [True: 456, False: 9.43k]
  ------------------
  300|    456|	      return STRINGPREP_BIDI_BOTH_L_AND_RAL;
  301|       |
  302|  29.8k|	    if (contains_ral != SIZE_MAX)
  ------------------
  |  Branch (302:10): [True: 9.43k, False: 20.3k]
  ------------------
  303|  9.43k|	      {
  304|  9.43k|		if (!(stringprep_find_character_in_table
  ------------------
  |  Branch (304:9): [True: 9.11k, False: 320]
  ------------------
  305|  9.43k|		      (ucs4[0], profile[contains_ral].table,
  306|  9.43k|		       profile[contains_ral].table_size) != -1
  307|  9.43k|		      &&
  308|  9.43k|		      stringprep_find_character_in_table (ucs4[ucs4len - 1],
  ------------------
  |  Branch (308:9): [True: 8.78k, False: 334]
  ------------------
  309|  9.11k|							  profile
  310|  9.11k|							  [contains_ral].table,
  311|  9.11k|							  profile
  312|  9.11k|							  [contains_ral].table_size)
  313|  9.11k|		      != -1))
  314|    654|		  return STRINGPREP_BIDI_LEADTRAIL_NOT_RAL;
  315|  9.43k|	      }
  316|  29.8k|	  }
  317|  29.1k|	  break;
  318|       |
  319|  29.1k|	default:
  ------------------
  |  Branch (319:2): [True: 0, False: 755k]
  ------------------
  320|      0|	  return STRINGPREP_PROFILE_ERROR;
  321|      0|	  break;
  322|   755k|	}
  323|   755k|    }
  324|       |
  325|  27.2k|  *len = ucs4len;
  326|       |
  327|  27.2k|  return STRINGPREP_OK;
  328|   111k|}
stringprep:
  417|  34.6k|{
  418|  34.6k|  int rc;
  419|  34.6k|  char *utf8 = NULL;
  420|  34.6k|  uint32_t *ucs4 = NULL;
  421|  34.6k|  size_t ucs4len, maxucs4len, adducs4len = strlen (in) / 10 + 1;
  422|       |
  423|  34.6k|  do
  424|   113k|    {
  425|   113k|      uint32_t *newp;
  426|       |
  427|   113k|      free (ucs4);
  428|   113k|      ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len);
  429|   113k|      if (ucs4 == NULL)
  ------------------
  |  Branch (429:11): [True: 2.60k, False: 111k]
  ------------------
  430|  2.60k|	return STRINGPREP_ICONV_ERROR;
  431|   111k|      maxucs4len = ucs4len + adducs4len;
  432|   111k|      newp = realloc (ucs4, maxucs4len * sizeof (uint32_t));
  433|   111k|      if (!newp)
  ------------------
  |  Branch (433:11): [True: 0, False: 111k]
  ------------------
  434|      0|	{
  435|      0|	  free (ucs4);
  436|      0|	  return STRINGPREP_MALLOC_ERROR;
  437|      0|	}
  438|   111k|      ucs4 = newp;
  439|       |
  440|   111k|      rc = stringprep_4i (ucs4, &ucs4len, maxucs4len, flags, profile);
  441|   111k|      adducs4len *= 2;
  442|   111k|    }
  443|   111k|  while (rc == STRINGPREP_TOO_SMALL_BUFFER);
  ------------------
  |  Branch (443:10): [True: 79.0k, False: 32.0k]
  ------------------
  444|  32.0k|  if (rc != STRINGPREP_OK)
  ------------------
  |  Branch (444:7): [True: 4.77k, False: 27.2k]
  ------------------
  445|  4.77k|    {
  446|  4.77k|      free (ucs4);
  447|  4.77k|      return rc;
  448|  4.77k|    }
  449|       |
  450|  27.2k|  utf8 = stringprep_ucs4_to_utf8 (ucs4, ucs4len, 0, 0);
  451|  27.2k|  free (ucs4);
  452|  27.2k|  if (!utf8)
  ------------------
  |  Branch (452:7): [True: 0, False: 27.2k]
  ------------------
  453|      0|    return STRINGPREP_ICONV_ERROR;
  454|       |
  455|  27.2k|  if (strlen (utf8) >= maxlen)
  ------------------
  |  Branch (455:7): [True: 15.0k, False: 12.2k]
  ------------------
  456|  15.0k|    {
  457|  15.0k|      free (utf8);
  458|  15.0k|      return STRINGPREP_TOO_SMALL_BUFFER;
  459|  15.0k|    }
  460|       |
  461|  12.2k|  strcpy (in, utf8);		/* flawfinder: ignore */
  462|       |
  463|  12.2k|  free (utf8);
  464|       |
  465|  12.2k|  return STRINGPREP_OK;
  466|  27.2k|}
stringprep.c:stringprep_find_string_in_table:
   93|   685k|{
   94|   685k|  size_t j;
   95|   685k|  ssize_t pos;
   96|       |
   97|   100M|  for (j = 0; j < ucs4len; j++)
  ------------------
  |  Branch (97:15): [True: 99.5M, False: 572k]
  ------------------
   98|  99.5M|    if ((pos =
  ------------------
  |  Branch (98:9): [True: 113k, False: 99.4M]
  ------------------
   99|  99.5M|	 stringprep_find_character_in_table (ucs4[j], table,
  100|  99.5M|					     table_size)) != -1)
  101|   113k|      {
  102|   113k|	if (tablepos)
  ------------------
  |  Branch (102:6): [True: 83.5k, False: 29.5k]
  ------------------
  103|  83.5k|	  *tablepos = pos;
  104|   113k|	return j;
  105|   113k|      }
  106|       |
  107|   572k|  return -1;
  108|   685k|}
stringprep.c:stringprep_apply_table_to_string:
  116|   222k|{
  117|   222k|  ssize_t pos;
  118|   222k|  size_t i, maplen;
  119|   222k|  uint32_t *src = ucs4;		/* points to unprocessed data */
  120|   222k|  size_t srclen = *ucs4len;	/* length of unprocessed data */
  121|       |
  122|   303k|  while ((pos = stringprep_find_string_in_table (src, srclen,
  ------------------
  |  Branch (122:10): [True: 83.5k, False: 219k]
  ------------------
  123|   303k|						 &i, table,
  124|   303k|						 table_size)) != -1)
  125|  83.5k|    {
  126|  83.5k|      for (maplen = STRINGPREP_MAX_MAP_CHARS;
  ------------------
  |  |  106|  83.5k|# define STRINGPREP_MAX_MAP_CHARS 4
  ------------------
  127|   325k|	   maplen > 0 && table[i].map[maplen - 1] == 0; maplen--)
  ------------------
  |  Branch (127:5): [True: 322k, False: 2.56k]
  |  Branch (127:19): [True: 241k, False: 80.9k]
  ------------------
  128|   241k|	;
  129|       |
  130|  83.5k|      if (*ucs4len - 1 + maplen >= maxucs4len)
  ------------------
  |  Branch (130:11): [True: 2.35k, False: 81.1k]
  ------------------
  131|  2.35k|	return STRINGPREP_TOO_SMALL_BUFFER;
  132|       |
  133|  81.1k|      memmove (src + pos + maplen, src + pos + 1,
  134|  81.1k|	       sizeof (uint32_t) * (srclen - pos - 1));
  135|  81.1k|      memcpy (src + pos, table[i].map, sizeof (uint32_t) * maplen);
  136|  81.1k|      *ucs4len = *ucs4len - 1 + maplen;
  137|  81.1k|      src += pos + maplen;
  138|  81.1k|      srclen -= pos + 1;
  139|  81.1k|    }
  140|       |
  141|   219k|  return STRINGPREP_OK;
  142|   222k|}
stringprep.c:stringprep_find_character_in_table:
   53|  99.5M|{
   54|       |  /* This is where typical uses of Libidn spends very close to all CPU
   55|       |     time and causes most cache misses.  One could easily do a binary
   56|       |     search instead.  Before rewriting this, I want hard evidence this
   57|       |     slowness is at all relevant in typical applications.  (I don't
   58|       |     dispute optimization may improve matters significantly, I'm
   59|       |     mostly interested in having someone give real-world benchmark on
   60|       |     the impact of libidn.)
   61|       |     *
   62|       |     * Answer (Tim Rühsen rockdaboot@gmx.de):
   63|       |     * Testing the fuzz corpora just once via make check takes ~54 billion CPU cycles.
   64|       |     * That is almost 20s on my Intel i3 3.1GHz !!!
   65|       |     * That even makes fuzzing almost useless, eating up CPU cycles for nothing.
   66|       |     *
   67|       |     * The bsearch() approach takes ~3 billion CPU cycles.
   68|       |     * Almost a factor of 20 faster (but still pretty slow).
   69|       |     * There are still ~2 million calls to bsearch() which make ~30% of CPU time used.
   70|       |     * Most time is spent in _g_utf8_normalize_wc().
   71|       |
   72|       |     ssize_t i;
   73|       |
   74|       |     for (i = 0; table[i].start || table[i].end; i++)
   75|       |     if (ucs4 >= table[i].start &&
   76|       |     ucs4 <= (table[i].end ? table[i].end : table[i].start))
   77|       |     return i;
   78|       |   */
   79|       |
   80|  99.5M|  const Stringprep_table_element *p =
   81|  99.5M|    bsearch (&ucs4, table, table_size, sizeof (Stringprep_table_element),
   82|  99.5M|	     (int (*)(const void *, const void *)) _compare_table_element);
   83|       |
   84|  99.5M|  return p ? (p - table) : -1;
  ------------------
  |  Branch (84:10): [True: 131k, False: 99.4M]
  ------------------
   85|  99.5M|}
stringprep.c:_compare_table_element:
   41|   412M|{
   42|   412M|  if (*c < e->start)
  ------------------
  |  Branch (42:7): [True: 330M, False: 81.4M]
  ------------------
   43|   330M|    return -1;
   44|  81.4M|  if (*c > e->end)
  ------------------
  |  Branch (44:7): [True: 81.2M, False: 131k]
  ------------------
   45|  81.2M|    return 1;
   46|   131k|  return 0;
   47|  81.4M|}

stringprep_locale_charset:
   86|  10.9k|{
   87|  10.9k|  const char *charset = getenv ("CHARSET");	/* flawfinder: ignore */
   88|       |
   89|  10.9k|  if (charset && *charset)
  ------------------
  |  Branch (89:7): [True: 0, False: 10.9k]
  |  Branch (89:18): [True: 0, False: 0]
  ------------------
   90|      0|    return charset;
   91|       |
   92|  10.9k|# ifdef HAVE_LANGINFO_CODESET
   93|  10.9k|  charset = nl_langinfo (CODESET);
   94|       |
   95|  10.9k|  if (charset && *charset)
  ------------------
  |  Branch (95:7): [True: 10.9k, False: 0]
  |  Branch (95:18): [True: 10.9k, False: 0]
  ------------------
   96|  10.9k|    return charset;
   97|      0|# endif
   98|       |
   99|      0|  return "ASCII";
  100|  10.9k|}
stringprep_convert:
  118|  10.9k|{
  119|  10.9k|#if HAVE_ICONV
  120|  10.9k|  return str_iconv (str, from_codeset, to_codeset);
  121|       |#else
  122|       |  char *p;
  123|       |  (void) to_codeset;
  124|       |  (void) from_codeset;
  125|       |  fprintf (stderr, "libidn: warning: libiconv not installed, cannot "
  126|       |	   "convert data to UTF-8\n");
  127|       |  p = malloc (strlen (str) + 1);
  128|       |  if (!p)
  129|       |    return NULL;
  130|       |  return strcpy (p, str);
  131|       |#endif
  132|  10.9k|}
stringprep_locale_to_utf8:
  146|  4.87k|{
  147|  4.87k|  return stringprep_convert (str, "UTF-8", stringprep_locale_charset ());
  148|  4.87k|}
stringprep_utf8_to_locale:
  162|  6.08k|{
  163|  6.08k|  return stringprep_convert (str, stringprep_locale_charset (), "UTF-8");
  164|  6.08k|}

